Commit 1c907c21 authored by POTTIER Francois's avatar POTTIER Francois

Added a flag --list-errors.

parent 794d0cde
......@@ -959,14 +959,14 @@ let () =
(* TODO:
can we store fewer facts when we hit a default reduction?
subject to --coverage
write to .coverage file or to standard output?
remove CompletedNatWitness?, revert Fix
collect performance data, correlated with star size and alphabet size; draw a graph
count the unreachable states and see if they are numerous in practice
optionally report several ways of reaching an error in state s
(with different lookahead tokens) (report all of them?)
warn if --coverage is set AND the grammar uses [error]
warn if --list-errors is set AND the grammar uses [error]
remove $syntaxerror?
how do we maintain the list of error messages when the grammar evolves?
implement a naive semi-algorithm that enumerates all input sentences,
and evaluate how well (or how badly) it scales
*)
......
......@@ -3,8 +3,8 @@
an error, a minimal path (starting in some initial state) that actually
triggers this error. *)
(* The output of this analysis is written to a .coverage file. No result
is returned. *)
(* The result of this analysis is written to the standard output channel.
No result is returned. *)
module Run (X : sig end) : sig end
......@@ -2,6 +2,14 @@
module I = Interpret (* artificial dependency; ensures that [Interpret] runs first *)
(* If [--list-errors] is set, produce a list of erroneous input sentences, then stop. *)
let () =
if Settings.list_errors then begin
let module L = LRijkstra.Run(struct end) in
exit 0
end
(* Define an .ml file writer . *)
let write program =
......
......@@ -4,4 +4,3 @@
module B = Back (* artificial dependency *)
module L = LRijkstra (* TEMPORARY *)
......@@ -159,6 +159,9 @@ type suggestion =
let suggestion =
ref SuggestNothing
let list_errors =
ref false
let options = Arg.align [
"--base", Arg.Set_string base, "<basename> Specifies a base name for the output file(s)";
"--canonical", Arg.Unit (fun () -> construction_mode := ModeCanonical), " Construct a canonical Knuth LR(1) automaton";
......@@ -179,6 +182,7 @@ let options = Arg.align [
"--interpret", Arg.Set interpret, " Interpret the sentences provided on stdin";
"--interpret-show-cst", Arg.Set interpret_show_cst, " Show a concrete syntax tree upon acceptance";
"--lalr", Arg.Unit (fun () -> construction_mode := ModeLALR), " Construct an LALR(1) automaton";
"--list-errors", Arg.Set list_errors, " Produce a list of erroneous inputs";
"--log-automaton", Arg.Set_int logA, "<level> Log information about the automaton";
"--log-code", Arg.Set_int logC, "<level> Log information about the generated code";
"--log-grammar", Arg.Set_int logG, "<level> Log information about the grammar";
......@@ -389,3 +393,6 @@ let strict =
let fixedexc =
!fixedexc
let list_errors =
!list_errors
......@@ -163,3 +163,9 @@ val strict: bool
val fixedexc: bool
(* This flag causes Menhir to produce a list of erroneous input sentences.
Enough sentences are computed to produce exactly one error in every state
where an error can occur. *)
val list_errors: bool
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment