Skip to content
GitLab
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
a4689b8a
Commit
a4689b8a
authored
Apr 19, 2017
by
POTTIER Francois
Browse files
Added a new test, no_future.
parent
7a457321
Changes
3
Hide whitespace changes
Inline
Side-by-side
test/good/no_future.exp
0 → 100644
View file @
a4689b8a
Grammar has 2 nonterminal symbols, among which 1 start symbols.
Grammar has 2 terminal symbols.
Grammar has 3 productions.
nullable(main) = false
nullable(listA) = true
first(main) = A
first(listA) = A
follow(main) = #
follow(listA) = A
Built an LR(0) automaton with 7 states.
The grammar is not SLR(1) -- 2 states have a conflict.
Built an LR(1) automaton with 7 states.
2 shift/reduce conflicts were silently solved.
File "no_future.mly", line 24, characters 6-33:
Warning: production listA -> is never reduced.
Warning: in total, 1 productions are never reduced.
3 out of 7 states have a default reduction.
2 out of 7 states are represented.
0 out of 7 symbols keep track of their start position.
0 out of 7 symbols keep track of their end position.
2 out of 4 productions exploit shiftreduce optimization.
0 out of 7 states can peek at an error.
25 functions before inlining, 4 functions after inlining.
test/good/no_future.mly
0 → 100644
View file @
a4689b8a
/*
This
grammar
describes
a
nonempty
list
of
A's
,
followed
with
EOF
.
It
is
LR
(
2
)
,
not
LR
(
1
)
.
There
is
a
shift
/
reduce
conflict
,
which
we
resolve
in
favor
of
shifting
.
As
a
result
,
the
production
listA
->
can
never
be
reduced
(
Menhir
warns
about
this
)
,
and
the
resulting
automaton
rejects
every
sentence
of
the
form
A
+
EOF
:
it
reads
all
of
the
A's
,
then
,
upon
seeing
EOF
,
rejects
.
*/
/*
This
automaton
does
*
not
*
have
the
property
that
a
syntax
error
is
detected
as
soon
as
possible
,
or
(
stated
differently
)
that
,
as
long
as
the
automaton
continues
reading
,
a
viable
future
exists
.
Indeed
,
this
automaton
accepts
the
*
empty
*
language
,
so
,
for
the
property
to
be
satisfied
,
it
should
always
fail
immediately
,
without
reading
anything
.
Yet
,
it
will
read
an
arbitrarily
long
sequence
of
A's
and
fail
only
upon
encountering
EOF
.
*/
%
token
A
EOF
%
start
<
unit
>
main
%
nonassoc
empty_list
%
nonassoc
A
%%
listA
:
%
prec
empty_list
{}
|
A
listA
{}
main
:
listA
A
EOF
{}
test/good/no_future.opp.exp
0 → 100644
View file @
a4689b8a
%start main
%token A
%token EOF
%nonassoc empty_list
%nonassoc A
%type <unit> main
%%
listA:
%prec empty_list
{ ()}
| _1 = A _2 = listA
{ ()}
main:
_1 = listA _2 = A _3 = EOF
{ ()}
%%
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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