Commit 42ee683d authored by POTTIER Francois's avatar POTTIER Francois
Browse files

Enrich a test case.

parent 2efd545a
Grammar has 6 nonterminal symbols, among which 1 start symbols.
Grammar has 7 nonterminal symbols, among which 1 start symbols.
Grammar has 3 terminal symbols.
Grammar has 7 productions.
Grammar has 8 productions.
nullable(sugar) = false
nullable(option(foo)) = true
nullable(nothing) = true
nullable(main) = false
nullable(hop) = false
nullable(foo) = false
nullable(bar) = false
first(sugar) = C
first(option(foo)) = C
first(nothing) =
first(main) = A
first(hop) = C B
first(foo) = C
first(bar) = C B
follow(sugar) = #
follow(option(foo)) = B
follow(nothing) = C B
follow(main) = #
follow(hop) = #
follow(hop) = C
follow(foo) = B
follow(bar) = A
Built an LR(0) automaton with 14 states.
Built an LR(0) automaton with 16 states.
The grammar is SLR(1).
Built an LR(1) automaton with 14 states.
8 out of 14 states have a default reduction.
2 out of 14 states are represented.
6 out of 12 symbols keep track of their start position.
5 out of 12 symbols keep track of their end position.
5 out of 8 productions exploit shiftreduce optimization.
0 out of 14 states can peek at an error.
48 functions before inlining, 5 functions after inlining.
Built an LR(1) automaton with 16 states.
9 out of 16 states have a default reduction.
2 out of 16 states are represented.
6 out of 13 symbols keep track of their start position.
5 out of 13 symbols keep track of their end position.
6 out of 9 productions exploit shiftreduce optimization.
0 out of 16 states can peek at an error.
54 functions before inlining, 5 functions after inlining.
......@@ -2,7 +2,7 @@
%start<unit> main
%%
(* Case: token in front. *)
main: A B hop { $symbolstartpos, $symbolstartofs }
main: A B hop sugar { $symbolstartpos, $symbolstartofs }
(* Case: epsilon symbol in front, followed with non-nullable symbol in front. *)
hop: nothing bar A B { $symbolstartpos }
(* Case: nullable symbol in front. *)
......@@ -10,3 +10,5 @@ bar: foo? B { $symbolstartpos }
foo: C nothing {}
(* Case: epsilon rule. *)
nothing: { $symbolstartpos }
(* Sugar. *)
sugar: c = C { $loc, $loc(c), $sloc }
......@@ -12,10 +12,10 @@ option_foo_:
{ ( Some x )}
main:
_1 = A _2 = B _3 = hop
_1 = A _2 = B _3 = hop _4 = sugar
{let _symbolstartpos = _startpos__1_ in
let _symbolstartofs = _symbolstartpos.Lexing.pos_cnum in
( _symbolstartpos, _symbolstartofs )}
( _symbolstartpos, _symbolstartofs )}
hop:
_1 = nothing _2 = bar _3 = A _4 = B
......@@ -40,6 +40,16 @@ nothing:
let _symbolstartpos = _endpos in
( _symbolstartpos )}
sugar:
c = C
{let _endpos = _endpos_c_ in
let _startpos = _startpos_c_ in
let _symbolstartpos = _startpos_c_ in
let _loc_c_ = (_startpos_c_, _endpos_c_) in
let _loc = (_startpos, _endpos) in
let _sloc = (_symbolstartpos, _endpos) in
( _loc, _loc_c_, _sloc )}
%%
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