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

Add two variants of existing positive tests.

parent 6e4b8abf
Pipeline #93633 passed with stages
in 26 seconds
Grammar has 3 nonterminal symbols, among which 1 start symbols.
Grammar has 4 terminal symbols.
Grammar has 7 productions.
nullable(inst) = false
nullable(expr) = false
nullable(debut) = false
first(inst) = SEP LIDENT
first(expr) = SEP LIDENT
first(debut) = SEP LIDENT
minimal(inst) = (* 2 *) LIDENT LIDENT
minimal(expr) = (* 1 *) LIDENT
minimal(debut) = (* 2 *) LIDENT EOF
follow(inst) = SEP LIDENT DOT
follow(expr) = SEP LIDENT EOF DOT
follow(debut) = #
Built an LR(0) automaton with 14 states.
The grammar is not SLR(1) -- 5 states have a conflict.
Built an LR(1) automaton with 15 states.
Warning: 4 states have shift/reduce conflicts.
Warning: 2 states have reduce/reduce conflicts.
Warning: 5 shift/reduce conflicts were arbitrarily resolved.
Warning: 2 reduce/reduce conflicts were arbitrarily resolved.
3 out of 15 states have a default reduction.
7 out of 15 states are represented.
0 out of 10 symbols keep track of their start position.
0 out of 10 symbols keep track of their end position.
2 out of 8 productions exploit shiftreduce optimization.
0 out of 15 states can peek at an error.
47 functions before inlining, 11 functions after inlining.
%{
open Ast
%}
%token SEP
%token DOT
%token <string> LIDENT
%token EOF
%start <unit> debut
%%
inst :
| i = LIDENT e = expr
{ () }
| SEP i1 = inst i2 = inst
{ () }
| e = expr DOT
{ () }
expr:
| i = LIDENT
{ () }
| e = expr DOT
{ () }
| i = inst DOT e = expr
{ () }
debut:
| expr EOF
{ () }
%{
open Ast
%}
%start debut
%token DOT
%token EOF
%token <string> LIDENT
%token SEP
%type <unit> debut
%%
inst:
i = LIDENT e = expr
{ ( () )}
| _1 = SEP i1 = inst i2 = inst
{ ( () )}
| e = expr _2 = DOT
{ ( () )}
expr:
i = LIDENT
{ ( () )}
| e = expr _2 = DOT
{ ( () )}
| i = inst _2 = DOT e = expr
{ ( () )}
debut:
_1 = expr _2 = EOF
{ ( () )}
%%
Grammar has 2 nonterminal symbols, among which 1 start symbols.
Grammar has 6 terminal symbols.
Grammar has 5 productions.
nullable(phrase) = false
nullable(expression) = false
first(phrase) = TRUE IF FALSE
first(expression) = TRUE IF FALSE
minimal(phrase) = (* 2 *) TRUE EOF
minimal(expression) = (* 1 *) TRUE
follow(phrase) = #
follow(expression) = THEN EOF ELSE
Built an LR(0) automaton with 12 states.
The grammar is not SLR(1) -- 1 states have a conflict.
Built an LR(1) automaton with 12 states.
Warning: one state has shift/reduce conflicts.
Warning: one shift/reduce conflict was arbitrarily resolved.
5 out of 12 states have a default reduction.
4 out of 12 states are represented.
0 out of 11 symbols keep track of their start position.
0 out of 11 symbols keep track of their end position.
4 out of 6 productions exploit shiftreduce optimization.
0 out of 12 states can peek at an error.
38 functions before inlining, 7 functions after inlining.
%token TRUE FALSE
%token IF THEN ELSE
%token EOF
%start <bool> phrase
%%
phrase:
b = expression EOF
{ b }
;
expression:
| TRUE
{ true }
| FALSE
{ false }
| IF b = expression THEN e = expression
{ if b then e else false }
| IF b = expression THEN e1 = expression ELSE e2 = expression
{ if b then e1 else e2 }
%start phrase
%token ELSE
%token EOF
%token FALSE
%token IF
%token THEN
%token TRUE
%type <bool> phrase
%%
phrase:
b = expression _2 = EOF
{ ( b )}
expression:
_1 = TRUE
{ ( true )}
| _1 = FALSE
{ ( false )}
| _1 = IF b = expression _3 = THEN e = expression
{ ( if b then e else false )}
| _1 = IF b = expression _3 = THEN e1 = expression _5 = ELSE e2 = expression
{ ( if b then e1 else e2 )}
%%
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