Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
POTTIER Francois
menhir
Commits
6d4c8892
Commit
6d4c8892
authored
Jul 02, 2015
by
POTTIER Francois
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed [nullable_first_rhs] to [nullable_first_prod] for external
users.
parent
c017deea
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
9 deletions
+11
-9
src/conflict.ml
src/conflict.ml
+3
-3
src/grammar.ml
src/grammar.ml
+3
-1
src/grammar.mli
src/grammar.mli
+4
-4
src/item.ml
src/item.ml
+1
-1
No files found.
src/conflict.ml
View file @
6d4c8892
...
...
@@ -187,14 +187,14 @@ let rec follow1 tok derivation offset' = function
at the moment, so let's skip it. *)
derivation
|
(
item
,
_
,
offset
)
::
configs
->
let
_
,
_
,
rhs
,
pos
,
length
=
Item
.
def
item
in
let
prod
,
_
,
rhs
,
pos
,
length
=
Item
.
def
item
in
if
offset
=
offset'
then
(* This is an epsilon transition. Attack a new line and add
a comment that explains why the lookahead symbol is
produced or inherited. *)
let
nullable
,
first
=
Analysis
.
nullable_first_
rhs
rhs
(
pos
+
1
)
in
let
nullable
,
first
=
Analysis
.
nullable_first_
prod
prod
(
pos
+
1
)
in
if
TerminalSet
.
mem
tok
first
then
...
...
@@ -304,7 +304,7 @@ let explain_reduce_item
if
pos
<
length
then
match
rhs
.
(
pos
)
with
|
Symbol
.
N
nt
->
let
nullable
,
first
=
Analysis
.
nullable_first_
rhs
rhs
(
pos
+
1
)
in
let
nullable
,
first
=
Analysis
.
nullable_first_
prod
prod
(
pos
+
1
)
in
let
first
:
bool
=
TerminalSet
.
mem
tok
first
in
let
lookahead'
=
if
nullable
then
first
||
lookahead
else
first
...
...
src/grammar.ml
View file @
6d4c8892
...
...
@@ -1270,7 +1270,9 @@ module Analysis = struct
let
first
=
Array
.
get
first
let
nullable_first_rhs
=
nullable_first_rhs
let
nullable_first_prod
prod
i
=
let
rhs
=
Production
.
rhs
prod
in
nullable_first_rhs
rhs
i
let
explain_first_rhs
(
tok
:
Terminal
.
t
)
(
rhs
:
Symbol
.
t
array
)
(
i
:
int
)
=
convert
(
explain
tok
rhs
i
)
...
...
src/grammar.mli
View file @
6d4c8892
...
...
@@ -373,12 +373,12 @@ module Analysis : sig
val
first
:
Nonterminal
.
t
->
TerminalSet
.
t
(* [nullable_first_
rhs rhs
i] considers the s
tring of symbols found at
offset [i] in the array [rhs
]. It returns its NULLABLE flag as well
(* [nullable_first_
prod prod
i] considers the s
uffix of the the production
[prod] defined by offset [i
]. It returns its NULLABLE flag as well
as its FIRST set. The offset [i] must be contained between [0] and
[n], where [n] is the length of
[rhs], inclusive
. *)
[n],
inclusive,
where [n] is the length of
production [prod]
. *)
val
nullable_first_
rhs
:
Symbol
.
t
array
->
int
->
bool
*
TerminalSet
.
t
val
nullable_first_
prod
:
Production
.
index
->
int
->
bool
*
TerminalSet
.
t
(* [explain_first_rhs tok rhs i] explains why the token [tok] appears
in the FIRST set for the string of symbols found at offset [i] in
...
...
src/item.ml
View file @
6d4c8892
...
...
@@ -171,7 +171,7 @@ module Closure (L : Lookahead.S) = struct
let
constant
,
transmits
=
if
pos
<
length
then
let
nullable
,
first
=
Analysis
.
nullable_first_
rhs
rhs
(
pos
+
1
)
in
let
nullable
,
first
=
Analysis
.
nullable_first_
prod
prod
(
pos
+
1
)
in
L
.
constant
first
,
nullable
else
(* No epsilon transitions leave this item. *)
...
...
Write
Preview
Markdown
is supported
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