Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
POTTIER Francois
menhir
Commits
e6b3de22
Commit
e6b3de22
authored
Jul 06, 2015
by
POTTIER Francois
Browse files
Defined [Lr1.entry_nt].
parent
c552972d
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/lr1.ml
View file @
e6b3de22
...
...
@@ -1086,3 +1086,10 @@ let fold_entry f accu =
f
prod
state
nt
t
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
src/lr1.mli
View file @
e6b3de22
...
...
@@ -37,6 +37,11 @@ val fold_entry:
(
Production
.
index
->
node
->
Nonterminal
.
t
->
Stretch
.
ocamltype
->
'
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]. *)
val
n
:
int
...
...
src/referenceInterpreter.ml
View file @
e6b3de22
...
...
@@ -232,12 +232,7 @@ let interpret log nt lexer lexbuf =
(* Find the start state that corresponds to [nt] in the automaton. *)
let
s
:
Lr1
.
node
=
try
ProductionMap
.
find
(
Production
.
startsymbol2startprod
nt
)
Lr1
.
entry
with
Not_found
->
assert
false
in
let
s
=
Lr1
.
entry_nt
nt
in
(* Run the engine. *)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment