Commit 6fb7b330 authored by POTTIER Francois's avatar POTTIER Francois Committed by POTTIER Francois
Browse files

Move LR1CanonicalAsFixedPoint to the attic. Rename LR1CanonicalAsTraversal to LR1Canonical.

parent dc3647cb
......@@ -14,14 +14,15 @@
(* This module formulates the construction of the canonical LR(1) automaton as
a least fixed point computation. *)
(* It is currently *not* used; the code in [LR1CanonicalAsTraversal] is used
instead when [--canonical] is passed on the command line, as it is about
twice faster. *)
(* It is currently *not* used; the code in [LR1Canonical] is used instead when
[--canonical] is passed on the command line. It is about twice faster. *)
(* This formulation may be deemed somewhat naive: because a "variable" is an
LR(0) state and a "property" is a set of LR(1) states, every time the
algorithm revisits an LR(0) state [s], it recomputes *all* of the LR(1)
states that correspond to [s]. *)
states that correspond to [s]. This could possibly be remedied by using
[Fix.DataFlow] instead of [Fix.Make], but the code in [LR1Canonical] is
more efficient still. *)
type lr0state =
Lr0.node
......
......@@ -20,13 +20,12 @@
could create artificial (unexplainable) conflicts; see issue #21 at
https://gitlab.inria.fr/fpottier/menhir/issues/21 . *)
(* This code can be viewed as a variant of [LR1CanonicalAsTraversal]. However,
there, the algorithm is just a traversal of a well-defined graph, whereas
here, the situation is more complex. Indeed, when the algorithm asks the
question:
(* This code can be viewed as a variant of [LR1Canonical]. However, there, the
algorithm is just a traversal of a well-defined graph, whereas here, the
situation is more complex. Indeed, when the algorithm asks the question:
* What state should be the target of the transition labeled [symbol] out of
the state [state]?
the state [state]?
the answer *depends on which states have been discovered so far*. In fact,
the answer to this question can involve an arbitrary choice, as there are
......@@ -79,7 +78,7 @@ module Run () = struct
(* Give an implicit definition of the graph that we wish to traverse. *)
(* This section is identical to the one found in [LR1CanonicalAsTraversal]. *)
(* This section is identical to the one found in [LR1Canonical]. *)
module G = struct
......@@ -366,8 +365,8 @@ end
(* Traversing the graph [G'] yields a numbering of its vertices, which are
the states of the final LR(1) automaton. *)
(* The remainder of this file is identical to [LR1CanonicalAsTraversal],
except for one use of [redirect] in the definition of [transition]. *)
(* The remainder of this file is identical to [LR1Canonical], except for one
use of [redirect] in the definition of [transition]. *)
type node =
int
......
......@@ -53,7 +53,7 @@ end
let algo : (module ALGORITHM) =
Settings.(match construction_mode with
| ModeCanonical ->
(module LR1CanonicalAsTraversal : ALGORITHM)
(module LR1Canonical : ALGORITHM)
| ModeInclusionOnly
| ModePager ->
(module LR1Pager : ALGORITHM)
......
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