Commit 89ee563f authored by POTTIER Francois's avatar POTTIER Francois
Browse files

Plug in [LR1CanonicalAsTraversal] and [LR1Pager].

This means that the old implementation of Pager's algorithm
is replaced with the new one; as a result, the automata that
are produced can have either more states or fewer states.
The construction can be up to 2x slower.
In canonical mode, the automata that are produced should be
unchanged, up to the numbering of states; the construction
should be about 2x faster.
This closes issue #21.
parent c66cec07
......@@ -12,6 +12,7 @@
(******************************************************************************)
open Grammar
open LR1Sigs
(* This module first constructs an LR(1) automaton by using [Lr1construction].
Then, this automaton is further transformed (in place), in three steps:
......@@ -42,10 +43,32 @@ let () =
(* -------------------------------------------------------------------------- *)
(* Select a construction algorithm based on the command-line settings. *)
module type ALGORITHM = sig
module Run () : LR1_AUTOMATON
end
let algo : (module ALGORITHM) =
Settings.(match construction_mode with
| ModeCanonical ->
(module LR1CanonicalAsTraversal : ALGORITHM)
| ModeInclusionOnly
| ModePager ->
(module LR1Pager : ALGORITHM)
| ModeLALR ->
(module Lr1construction : ALGORITHM)
)
module Algorithm =
(val algo : ALGORITHM)
(* -------------------------------------------------------------------------- *)
(* Run the construction algorithm. *)
module Raw =
Lr1construction.Run()
Algorithm.Run()
let () =
Error.logA 1 (fun f ->
......
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