Commit 0b790ed8 authored by POTTIER Francois's avatar POTTIER Francois
Browse files

Add a comment relating the test [cutdown] to issue #21, and add two new tests...

Add a comment relating the test [cutdown] to issue #21, and add two new tests related to this issue, [issue21_shorter] and [issue21_longer].
parent 9c293f61
Pipeline #117640 passed with stages
in 25 seconds
......@@ -7,6 +7,15 @@ Warning: one state has reduce/reduce conflicts.
** Tokens of interest: R_BRACKET
** Goal state: 14
*/
(* This problem, which remained ignored for many years, has been
re-discovered as issue #21. *)
(* This is an example where Menhir's implementation of Pager's
algorithm produces two distinct conflicts, but the canonical
automaton has only one conflict. So one of the two conflicts
cannot be explained. *)
%{ %}
%token EOF
......
Grammar has 6 nonterminal symbols, among which 1 start symbols.
Grammar has 9 terminal symbols.
Grammar has 11 productions.
nullable(term) = false
nullable(separated_nonempty_list(AND,recursive_clause)) = false
nullable(recursive_clause) = false
nullable(infix_term_) = false
nullable(infix_term) = false
nullable(commandline) = false
first(term) = NUMERAL LET
first(separated_nonempty_list(AND,recursive_clause)) = NAME
first(recursive_clause) = NAME
first(infix_term_) = NUMERAL
first(infix_term) = NUMERAL
first(commandline) = NUMERAL LET
minimal(term) = (* 1 *) NUMERAL
minimal(separated_nonempty_list(AND,recursive_clause)) = (* 3 *) NAME EQUAL NUMERAL
minimal(recursive_clause) = (* 3 *) NAME EQUAL NUMERAL
minimal(infix_term_) = (* 1 *) NUMERAL
minimal(infix_term) = (* 1 *) NUMERAL
minimal(commandline) = (* 2 *) NUMERAL EOF
follow(term) = IN EOF AND
follow(separated_nonempty_list(AND,recursive_clause)) = IN
follow(recursive_clause) = IN AND
follow(infix_term_) = IN EOF AND
follow(infix_term) = INFIXOP0 IN EOF AND
follow(commandline) = #
Built an LR(0) automaton with 32 states.
The grammar is not SLR(1) -- 1 states have a conflict.
Built an LR(1) automaton with 32 states.
Warning: one state has reduce/reduce conflicts.
Warning: one reduce/reduce conflict was arbitrarily resolved.
10 out of 32 states have a default reduction.
9 out of 32 states are represented.
0 out of 18 symbols keep track of their start position.
0 out of 18 symbols keep track of their end position.
4 out of 12 productions exploit shiftreduce optimization.
0 out of 32 states can peek at an error.
88 functions before inlining, 16 functions after inlining.
(* This file was provided by Andrej Bauer; see issue #21. *)
(* This is an example where Menhir's implementation of Pager's
algorithm produces a conflict, even though it should not: the
canonical automaton has no conflicts. *)
(* Infix operations a la OCaml *)
%token INFIXOP0 EQUAL
(* Names *)
%token NAME
(* Expressions and computations *)
%token NUMERAL
%token LET REC IN AND
(* End of input token *)
%token EOF
(* Precedence and fixity of infix operators *)
%start <unit> commandline
%%
(* Toplevel syntax *)
commandline:
| LET f=NAME EQUAL e=term EOF
{ () }
| term EOF
{ () }
(* Main syntax tree *)
term:
| e=infix_term_
{ e }
| LET f=NAME EQUAL c1=infix_term IN c2=term
{ () }
| LET REC fs=separated_nonempty_list(AND, recursive_clause) IN c2=term
{ () }
infix_term:
| n=NUMERAL
{ () }
infix_term_:
| n=NUMERAL
{ () }
| e2=infix_term INFIXOP0 e3=infix_term
{ () }
recursive_clause:
| f=NAME EQUAL c=term
{ () }
%start commandline
%token AND
%token EOF
%token EQUAL
%token IN
%token INFIXOP0
%token LET
%token NAME
%token NUMERAL
%token REC
%type <unit> commandline
%%
separated_nonempty_list_AND_recursive_clause_:
x = recursive_clause
{ ( [ x ] )}
| x = recursive_clause _2 = AND xs = separated_nonempty_list_AND_recursive_clause_
{ ( x :: xs )}
commandline:
_1 = LET f = NAME _3 = EQUAL e = term _5 = EOF
{ ( () )}
| _1 = term _2 = EOF
{ ( () )}
term:
e = infix_term_
{ ( e )}
| _1 = LET f = NAME _3 = EQUAL c1 = infix_term _5 = IN c2 = term
{ ( () )}
| _1 = LET _2 = REC fs = separated_nonempty_list_AND_recursive_clause_ _4 = IN c2 = term
{ ( () )}
infix_term:
n = NUMERAL
{ ( () )}
infix_term_:
n = NUMERAL
{ ( () )}
| e2 = infix_term _2 = INFIXOP0 e3 = infix_term
{ ( () )}
recursive_clause:
f = NAME _2 = EQUAL c = term
{ ( () )}
%%
Grammar has 3 nonterminal symbols, among which 1 start symbols.
Grammar has 6 terminal symbols.
Grammar has 7 productions.
nullable(term) = false
nullable(name) = false
nullable(commandline) = false
first(term) = REC NAME LET
first(name) = NAME
first(commandline) = REC NAME LET
minimal(term) = (* 1 *) NAME
minimal(name) = (* 1 *) NAME
minimal(commandline) = (* 2 *) NAME EOF
follow(term) = IN EOF
follow(name) = PLUS IN
follow(commandline) = #
Built an LR(0) automaton with 20 states.
The grammar is not SLR(1) -- 1 states have a conflict.
Built an LR(1) automaton with 21 states.
Warning: one state has reduce/reduce conflicts.
Warning: one reduce/reduce conflict was arbitrarily resolved.
7 out of 21 states have a default reduction.
6 out of 21 states are represented.
0 out of 12 symbols keep track of their start position.
0 out of 12 symbols keep track of their end position.
4 out of 8 productions exploit shiftreduce optimization.
0 out of 21 states can peek at an error.
59 functions before inlining, 12 functions after inlining.
(* This file was provided by Andrej Bauer; see issue #21. *)
(* This is an example where Menhir's implementation of Pager's
algorithm produces a conflict, even though it should not: the
canonical automaton has no conflicts. *)
(* Infix operations a la OCaml *)
%token PLUS
(* Names *)
%token NAME
(* Expressions and computations *)
%token LET REC IN
(* End of input token *)
%token EOF
(* Precedence and fixity of infix operators *)
%start <unit> commandline
%%
(* Toplevel syntax *)
commandline:
| LET term EOF
{ () }
| term EOF
{ () }
(* Main syntax tree *)
term:
| NAME
{ () }
| name PLUS
{ () }
| LET name IN term
{ () }
| REC term IN term
{ () }
name:
| NAME
{ () }
%start commandline
%token EOF
%token IN
%token LET
%token NAME
%token PLUS
%token REC
%type <unit> commandline
%%
commandline:
_1 = LET _2 = term _3 = EOF
{ ( () )}
| _1 = term _2 = EOF
{ ( () )}
term:
_1 = NAME
{ ( () )}
| _1 = name _2 = PLUS
{ ( () )}
| _1 = LET _2 = name _3 = IN _4 = term
{ ( () )}
| _1 = REC _2 = term _3 = IN _4 = term
{ ( () )}
name:
_1 = NAME
{ ( () )}
%%
......@@ -3509,6 +3509,48 @@
(action
(diff ../good/inliningWithSideEffects.exp inliningWithSideEffects.out)))
(rule (target issue21_longer.opp.out) (deps ../good/issue21_longer.mly)
(action
(with-outputs-to issue21_longer.opp.out
(chdir ../good
(system
"timeout 60 %{bin:menhir} --only-preprocess %{deps} || echo 'TIMEOUT after 60 seconds.'")))))
(rule (alias issue21_longer)
(action (diff ../good/issue21_longer.opp.exp issue21_longer.opp.out)))
(rule (targets issue21_longer.out issue21_longer.out.timings)
(deps ../good/issue21_longer.mly)
(action
(with-outputs-to issue21_longer.out
(chdir ../good
(system
"timeout 60 %{bin:menhir} --explain -lg 2 -la 2 -lc 2 --timings-to ../src/issue21_longer.out.timings %{deps} || echo 'TIMEOUT after 60 seconds.'")))))
(rule (alias issue21_longer)
(action (diff ../good/issue21_longer.exp issue21_longer.out)))
(rule (target issue21_shorter.opp.out) (deps ../good/issue21_shorter.mly)
(action
(with-outputs-to issue21_shorter.opp.out
(chdir ../good
(system
"timeout 60 %{bin:menhir} --only-preprocess %{deps} || echo 'TIMEOUT after 60 seconds.'")))))
(rule (alias issue21_shorter)
(action (diff ../good/issue21_shorter.opp.exp issue21_shorter.opp.out)))
(rule (targets issue21_shorter.out issue21_shorter.out.timings)
(deps ../good/issue21_shorter.mly)
(action
(with-outputs-to issue21_shorter.out
(chdir ../good
(system
"timeout 60 %{bin:menhir} --explain -lg 2 -la 2 -lc 2 --timings-to ../src/issue21_shorter.out.timings %{deps} || echo 'TIMEOUT after 60 seconds.'")))))
(rule (alias issue21_shorter)
(action (diff ../good/issue21_shorter.exp issue21_shorter.out)))
(rule (target jasmc.opp.out) (deps ../good/jasmc.mly)
(action
(with-outputs-to jasmc.opp.out
......@@ -9028,6 +9070,8 @@
(alias invalid-declarations-e)
(alias invalid-point-free-action)
(alias invalid-token-in-prec)
(alias issue21_longer)
(alias issue21_shorter)
(alias jasmc)
(alias java)
(alias jh)
......
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