Commit 41e390f7 authored by POTTIER Francois's avatar POTTIER Francois
Browse files

Publish [Slr.check] and remove one artificial dependency.

parent ec0d6acc
...@@ -12,11 +12,16 @@ ...@@ -12,11 +12,16 @@
(******************************************************************************) (******************************************************************************)
open Grammar open Grammar
module S = Slr (* artificial dependency; ensures that [Slr] runs first *)
(* This module constructs an LR(1) automaton by following Pager's method, that (* This module constructs an LR(1) automaton by following Pager's method, that
is, by merging states on the fly when they are weakly compatible. *) is, by merging states on the fly when they are weakly compatible. *)
(* ------------------------------------------------------------------------ *)
(* Run the SLR(1) check first. *)
let () =
Slr.check()
(* ------------------------------------------------------------------------ *) (* ------------------------------------------------------------------------ *)
(* Nodes. *) (* Nodes. *)
......
...@@ -160,7 +160,7 @@ let count_slr_violations () : int = ...@@ -160,7 +160,7 @@ let count_slr_violations () : int =
(* At log level 1, indicate whether the grammar is SLR(1). *) (* At log level 1, indicate whether the grammar is SLR(1). *)
let () = let check () =
Error.logG 1 (fun f -> Error.logG 1 (fun f ->
let count = count_slr_violations() in let count = count_slr_violations() in
if count = 0 then if count = 0 then
...@@ -168,4 +168,3 @@ let () = ...@@ -168,4 +168,3 @@ let () =
else else
Printf.fprintf f "The grammar is not SLR(1) -- %d states have a conflict.\n" count Printf.fprintf f "The grammar is not SLR(1) -- %d states have a conflict.\n" count
) )
...@@ -19,3 +19,4 @@ ...@@ -19,3 +19,4 @@
the grammar is in the class SLR(1). This check is performed when the log the grammar is in the class SLR(1). This check is performed when the log
level [lg] is at least 1. *) level [lg] is at least 1. *)
val check: unit -> unit
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