Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
POTTIER Francois
menhir
Commits
56e3805d
Commit
56e3805d
authored
Oct 27, 2015
by
POTTIER Francois
Browse files
--interpret-error now obeys --trace.
parent
7c8c5a62
Changes
5
Hide whitespace changes
Inline
Side-by-side
TODO
View file @
56e3805d
...
...
@@ -18,7 +18,7 @@
expansion of the parameterized non-terminals.)
This would allow some simplifications in CompCert's grammar.
* Document --list-errors --interpret-error --compile-errors --compare-errors --update-errors --echo-errors
--
on
-
error
-
reduce
* Document --list-errors --interpret-error --compile-errors --compare-errors --update-errors --echo-errors
%
on
_
error
_
reduce
explain that any production that contains [error] is ignored by --list-errors
document the .messages file format
likely pitfall: if Menhir says, "foo" is not a valid nonterminal symbol,
...
...
@@ -29,8 +29,7 @@
and should remove any spaces in the names!
could also warn statically about out-of-range $i?
document the workflow
remove lr.csv when done
Could --interpret-error obey --trace?
--interpret-error obeys --trace
* Clear up the Windows path confusion. Can we use "/" in Menhir's
source code and in the Makefiles? Does OPAM work on Windows?
...
...
src/LRijkstra.ml
View file @
56e3805d
...
...
@@ -1141,7 +1141,7 @@ let fail msg =
let
validate
nt
s'
w
:
ReferenceInterpreter
.
target
=
let
open
ReferenceInterpreter
in
match
check_error_path
nt
(
W
.
elements
w
)
check_error_path
false
nt
(
W
.
elements
w
)
with
|
OInputReadPastEnd
->
fail
"input was read past its end"
...
...
src/interpret.ml
View file @
56e3805d
...
...
@@ -206,10 +206,10 @@ let interpret ((_, toks) as sentence) : unit =
(* [interpret_error_aux] interprets a sentence, expecting it to end in an
error. Failure or success is reported via two continuations. *)
let
interpret_error_aux
poss
((
_
,
terminals
)
as
sentence
)
fail
succeed
=
let
interpret_error_aux
log
poss
((
_
,
terminals
)
as
sentence
)
fail
succeed
=
let
nt
=
start
poss
sentence
in
let
open
ReferenceInterpreter
in
match
check_error_path
nt
terminals
with
match
check_error_path
log
nt
terminals
with
|
OInputReadPastEnd
->
fail
"no syntax error occurs."
|
OInputNotFullyConsumed
->
...
...
@@ -329,7 +329,7 @@ let succeed nt terminals target =
exit
0
let
interpret_error
sentence
=
interpret_error_aux
[]
sentence
fail
succeed
interpret_error_aux
Settings
.
trace
[]
sentence
fail
succeed
(* --------------------------------------------------------------------------- *)
...
...
@@ -342,7 +342,7 @@ let target_sentence
:
located_sentence
->
maybe_targeted_sentence
=
fun
(
poss
,
sentence
)
->
(
poss
,
sentence
)
,
interpret_error_aux
poss
sentence
interpret_error_aux
false
poss
sentence
(* failure: *)
(
fun
msg
->
signal
poss
...
...
src/referenceInterpreter.ml
View file @
56e3805d
...
...
@@ -261,14 +261,14 @@ type check_error_path_outcome =
LR automaton. *)
|
OK
of
target
let
check_error_path
nt
input
=
let
check_error_path
log
nt
input
=
(* Instantiate the LR engine. *)
let
module
E
=
MenhirLib
.
Engine
.
Make
(
struct
include
T
let
log
=
false
let
log
=
log
end
)
in
...
...
src/referenceInterpreter.mli
View file @
56e3805d
...
...
@@ -47,6 +47,7 @@ type check_error_path_outcome =
|
OK
of
target
val
check_error_path
:
bool
->
(* --trace *)
Nonterminal
.
t
->
(* initial non-terminal symbol *)
Terminal
.
t
list
->
(* input *)
check_error_path_outcome
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment