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

New example test/good/pager.mly.

parent 170862ef
Grammar has 6 nonterminal symbols, among which 1 start symbols.
Grammar has 7 terminal symbols.
Grammar has 12 productions.
nullable(z) = false
nullable(y) = false
nullable(x) = false
nullable(w) = false
nullable(v) = true
nullable(t) = false
first(z) = T
first(y) = U T
first(x) = B A
first(w) = U
first(v) =
first(t) = U
follow(z) = D C
follow(y) = E D
follow(x) = E D A #
follow(w) = E D
follow(v) = E D
follow(t) = E D A #
Built an LR(0) automaton with 21 states.
The grammar is not SLR(1) -- 1 states have a conflict.
Built an LR(1) automaton with 38 states.
17 out of 38 states have a default reduction.
7 out of 38 states are represented.
0 out of 16 symbols keep track of their start position.
0 out of 16 symbols keep track of their end position.
9 out of 13 productions exploit shiftreduce optimization.
0 out of 38 states can peek at an error.
101 functions before inlining, 22 functions after inlining.
/* Taken from Pager's paper. Sent by Laurence Tratt.
The LALR automaton has 21 states.
Pager writes that his construction leads to 23 states.
Yet, Menhir's version of Pager's algorithm leads to 38 states.
Not sure why. Deserves study. */
%start<unit> x
%token A B C D E T U
%%
x : A y D {} | A z C {} | A t {} | B y E {} | B z D {} | B t {}
y : T w {} | U x {}
z : T U {}
t : U x A {}
w : U v {}
v : {}
%start x
%token A
%token B
%token C
%token D
%token E
%token T
%token U
%type <unit> x
%%
x:
_1 = A _2 = y _3 = D
{ ()}
| _1 = A _2 = z _3 = C
{ ()}
| _1 = A _2 = t
{ ()}
| _1 = B _2 = y _3 = E
{ ()}
| _1 = B _2 = z _3 = D
{ ()}
| _1 = B _2 = t
{ ()}
y:
_1 = T _2 = w
{ ()}
| _1 = U _2 = x
{ ()}
z:
_1 = T _2 = U
{ ()}
t:
_1 = U _2 = x _3 = A
{ ()}
w:
_1 = U _2 = v
{ ()}
v:
{ ()}
%%
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