Commit a4689b8a authored by POTTIER Francois's avatar POTTIER Francois
Browse files

Added a new test, no_future.

parent 7a457321
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.
/* 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
%prec empty_list {}
| A listA {}
listA A EOF {}
%start main
%token A
%token EOF
%nonassoc empty_list
%nonassoc A
%type <unit> main
%prec empty_list
{ ()}
| _1 = A _2 = listA
{ ()}
_1 = listA _2 = A _3 = EOF
{ ()}
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