Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
menhir
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
12
Issues
12
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
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
Show 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 string of symbols found at
offset [i] in the array [rhs
]. It returns its NULLABLE flag as well
(* [nullable_first_
prod prod i] considers the suffix 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