Commit e6b3de22 authored by POTTIER Francois's avatar POTTIER Francois

Defined [Lr1.entry_nt].

parent c552972d
...@@ -1086,3 +1086,10 @@ let fold_entry f accu = ...@@ -1086,3 +1086,10 @@ let fold_entry f accu =
f prod state nt t accu f prod state nt t accu
) entry accu ) entry accu
let entry_nt nt =
(* Find the entry state that corresponds to [nt]. *)
try
ProductionMap.find (Production.startsymbol2startprod nt) entry
with Not_found ->
assert false
...@@ -37,6 +37,11 @@ val fold_entry: ...@@ -37,6 +37,11 @@ val fold_entry:
(Production.index -> node -> Nonterminal.t -> Stretch.ocamltype -> 'a -> 'a) -> (Production.index -> node -> Nonterminal.t -> Stretch.ocamltype -> 'a -> 'a) ->
'a -> 'a 'a -> 'a
(* This maps a (user) non-terminal start symbol to the corresponding
start state. *)
val entry_nt: Nonterminal.t -> node
(* Nodes are numbered sequentially from [0] to [n-1]. *) (* Nodes are numbered sequentially from [0] to [n-1]. *)
val n: int val n: int
......
...@@ -232,12 +232,7 @@ let interpret log nt lexer lexbuf = ...@@ -232,12 +232,7 @@ let interpret log nt lexer lexbuf =
(* Find the start state that corresponds to [nt] in the automaton. *) (* Find the start state that corresponds to [nt] in the automaton. *)
let s : Lr1.node = let s = Lr1.entry_nt nt in
try
ProductionMap.find (Production.startsymbol2startprod nt) Lr1.entry
with Not_found ->
assert false
in
(* Run the engine. *) (* Run the engine. *)
......
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