Commit facbda32 authored by POTTIER Francois's avatar POTTIER Francois

Add a new test case.

parent 5b21db3e
State 0:
file' -> . file [ # ]
-- On STRUCT shift to state 1
-- On mkloc(decl_desc) shift to state 14
-- On file shift to state 15
-- On decl_desc shift to state 16
-- On decl shift to state 17
State 1:
decl_desc -> STRUCT . separated(SEMI,param) END [ EOF ]
-- On SEMI shift to state 2
-- On IDENT shift to state 3
-- On separated(SEMI,param) shift to state 12
-- On param shift to state 5
-- On mkloc(IDENT) shift to state 8
-- On END reduce production separated(SEMI,param) ->
State 2:
separated(SEMI,param) -> SEMI . separated(SEMI,param) [ END ]
-- On SEMI shift to state 2
-- On IDENT shift to state 3
-- On separated(SEMI,param) shift to state 4
-- On param shift to state 5
-- On mkloc(IDENT) shift to state 8
-- On END reduce production separated(SEMI,param) ->
State 3:
mkloc(IDENT) -> IDENT . [ T_PAAMAYIM_NEKUDOTAYIM SEMI END ]
-- On T_PAAMAYIM_NEKUDOTAYIM reduce production mkloc(IDENT) -> IDENT
-- On SEMI reduce production mkloc(IDENT) -> IDENT
-- On END reduce production mkloc(IDENT) -> IDENT
State 4:
separated(SEMI,param) -> SEMI separated(SEMI,param) . [ END ]
-- On END reduce production separated(SEMI,param) -> SEMI separated(SEMI,param)
State 5:
separated(SEMI,param) -> param . [ END ]
separated(SEMI,param) -> param . SEMI separated(SEMI,param) [ END ]
-- On SEMI shift to state 6
-- On END reduce production separated(SEMI,param) -> param
State 6:
separated(SEMI,param) -> param SEMI . separated(SEMI,param) [ END ]
-- On SEMI shift to state 2
-- On IDENT shift to state 3
-- On separated(SEMI,param) shift to state 7
-- On param shift to state 5
-- On mkloc(IDENT) shift to state 8
-- On END reduce production separated(SEMI,param) ->
State 7:
separated(SEMI,param) -> param SEMI separated(SEMI,param) . [ END ]
-- On END reduce production separated(SEMI,param) -> param SEMI separated(SEMI,param)
State 8:
param -> mkloc(IDENT) . option(__anonymous_0) [ SEMI END ]
-- On T_PAAMAYIM_NEKUDOTAYIM shift to state 9
-- On option(__anonymous_0) shift to state 11
-- On SEMI reduce production option(__anonymous_0) ->
-- On END reduce production option(__anonymous_0) ->
State 9:
option(__anonymous_0) -> T_PAAMAYIM_NEKUDOTAYIM . mkloc(IDENT) [ SEMI END ]
-- On IDENT shift to state 3
-- On mkloc(IDENT) shift to state 10
State 10:
option(__anonymous_0) -> T_PAAMAYIM_NEKUDOTAYIM mkloc(IDENT) . [ SEMI END ]
-- On SEMI reduce production option(__anonymous_0) -> T_PAAMAYIM_NEKUDOTAYIM mkloc(IDENT)
-- On END reduce production option(__anonymous_0) -> T_PAAMAYIM_NEKUDOTAYIM mkloc(IDENT)
State 11:
param -> mkloc(IDENT) option(__anonymous_0) . [ SEMI END ]
-- On SEMI reduce production param -> mkloc(IDENT) option(__anonymous_0)
-- On END reduce production param -> mkloc(IDENT) option(__anonymous_0)
State 12:
decl_desc -> STRUCT separated(SEMI,param) . END [ EOF ]
-- On END shift to state 13
State 13:
decl_desc -> STRUCT separated(SEMI,param) END . [ EOF ]
-- On EOF reduce production decl_desc -> STRUCT separated(SEMI,param) END
State 14:
decl -> mkloc(decl_desc) . [ EOF ]
-- On EOF reduce production decl -> mkloc(decl_desc)
State 15:
file' -> file . [ # ]
-- On # accept file
State 16:
mkloc(decl_desc) -> decl_desc . [ EOF ]
-- On EOF reduce production mkloc(decl_desc) -> decl_desc
State 17:
file -> decl . EOF [ # ]
-- On EOF shift to state 18
State 18:
file -> decl EOF . [ # ]
-- On # reduce production file -> decl EOF
State 0:
file' -> . file [ # ]
-- On STRUCT shift to state 1
-- On mkloc(decl_desc) shift to state 14
-- On file shift to state 15
-- On decl_desc shift to state 16
-- On decl shift to state 17
State 1:
decl_desc -> STRUCT . separated(SEMI,param) END [ EOF ]
-- On SEMI shift to state 2
-- On IDENT shift to state 3
-- On separated(SEMI,param) shift to state 12
-- On param shift to state 5
-- On mkloc(IDENT) shift to state 8
-- On END reduce production separated(SEMI,param) ->
State 2:
separated(SEMI,param) -> SEMI . separated(SEMI,param) [ END ]
-- On SEMI shift to state 2
-- On IDENT shift to state 3
-- On separated(SEMI,param) shift to state 4
-- On param shift to state 5
-- On mkloc(IDENT) shift to state 8
-- On END reduce production separated(SEMI,param) ->
State 3:
mkloc(IDENT) -> IDENT . [ T_PAAMAYIM_NEKUDOTAYIM SEMI END ]
-- On T_PAAMAYIM_NEKUDOTAYIM reduce production mkloc(IDENT) -> IDENT
-- On SEMI reduce production mkloc(IDENT) -> IDENT
-- On END reduce production mkloc(IDENT) -> IDENT
State 4:
separated(SEMI,param) -> SEMI separated(SEMI,param) . [ END ]
-- On END reduce production separated(SEMI,param) -> SEMI separated(SEMI,param)
State 5:
separated(SEMI,param) -> param . [ END ]
separated(SEMI,param) -> param . SEMI separated(SEMI,param) [ END ]
-- On SEMI shift to state 6
-- On END reduce production separated(SEMI,param) -> param
State 6:
separated(SEMI,param) -> param SEMI . separated(SEMI,param) [ END ]
-- On SEMI shift to state 2
-- On IDENT shift to state 3
-- On separated(SEMI,param) shift to state 7
-- On param shift to state 5
-- On mkloc(IDENT) shift to state 8
-- On END reduce production separated(SEMI,param) ->
State 7:
separated(SEMI,param) -> param SEMI separated(SEMI,param) . [ END ]
-- On END reduce production separated(SEMI,param) -> param SEMI separated(SEMI,param)
State 8:
param -> mkloc(IDENT) . option(__anonymous_0) [ SEMI END ]
-- On T_PAAMAYIM_NEKUDOTAYIM shift to state 9
-- On option(__anonymous_0) shift to state 11
-- On SEMI reduce production option(__anonymous_0) ->
-- On END reduce production option(__anonymous_0) ->
State 9:
option(__anonymous_0) -> T_PAAMAYIM_NEKUDOTAYIM . mkloc(IDENT) [ SEMI END ]
-- On IDENT shift to state 3
-- On mkloc(IDENT) shift to state 10
State 10:
option(__anonymous_0) -> T_PAAMAYIM_NEKUDOTAYIM mkloc(IDENT) . [ SEMI END ]
-- On SEMI reduce production option(__anonymous_0) -> T_PAAMAYIM_NEKUDOTAYIM mkloc(IDENT)
-- On END reduce production option(__anonymous_0) -> T_PAAMAYIM_NEKUDOTAYIM mkloc(IDENT)
State 11:
param -> mkloc(IDENT) option(__anonymous_0) . [ SEMI END ]
-- On SEMI reduce production param -> mkloc(IDENT) option(__anonymous_0)
-- On END reduce production param -> mkloc(IDENT) option(__anonymous_0)
State 12:
decl_desc -> STRUCT separated(SEMI,param) . END [ EOF ]
-- On END shift to state 13
State 13:
decl_desc -> STRUCT separated(SEMI,param) END . [ EOF ]
-- On EOF reduce production decl_desc -> STRUCT separated(SEMI,param) END
State 14:
decl -> mkloc(decl_desc) . [ EOF ]
-- On EOF reduce production decl -> mkloc(decl_desc)
State 15:
file' -> file . [ # ]
-- On # accept file
State 16:
mkloc(decl_desc) -> decl_desc . [ EOF ]
-- On EOF reduce production mkloc(decl_desc) -> decl_desc
State 17:
file -> decl . EOF [ # ]
-- On EOF shift to state 18
State 18:
file -> decl EOF . [ # ]
-- On # reduce production file -> decl EOF
Grammar has 8 nonterminal symbols, among which 1 start symbols.
Grammar has 6 terminal symbols.
Grammar has 12 productions.
nullable(separated(SEMI,param)) = true
nullable(param) = false
nullable(option(__anonymous_0)) = true
nullable(mkloc(decl_desc)) = false
nullable(mkloc(IDENT)) = false
nullable(file) = false
nullable(decl_desc) = false
nullable(decl) = false
first(separated(SEMI,param)) = SEMI IDENT
first(param) = IDENT
first(option(__anonymous_0)) = T_PAAMAYIM_NEKUDOTAYIM
first(mkloc(decl_desc)) = STRUCT
first(mkloc(IDENT)) = IDENT
first(file) = STRUCT
first(decl_desc) = STRUCT
first(decl) = STRUCT
minimal(separated(SEMI,param)) = (* 0 *)
minimal(param) = (* 1 *) IDENT
minimal(option(__anonymous_0)) = (* 0 *)
minimal(mkloc(decl_desc)) = (* 2 *) STRUCT END
minimal(mkloc(IDENT)) = (* 1 *) IDENT
minimal(file) = (* 3 *) STRUCT END EOF
minimal(decl_desc) = (* 2 *) STRUCT END
minimal(decl) = (* 2 *) STRUCT END
follow(separated(SEMI,param)) = END
follow(param) = SEMI END
follow(option(__anonymous_0)) = SEMI END
follow(mkloc(decl_desc)) = EOF
follow(mkloc(IDENT)) = T_PAAMAYIM_NEKUDOTAYIM SEMI END
follow(file) = #
follow(decl_desc) = EOF
follow(decl) = EOF
Built an LR(0) automaton with 19 states.
The grammar is SLR(1).
The construction mode is pager.
Built an LR(1) automaton with 19 states.
10 out of 19 states have a default reduction.
4 out of 19 states are represented.
3 out of 17 symbols keep track of their start position.
3 out of 17 symbols keep track of their end position.
7 out of 13 productions exploit shiftreduce optimization.
0 out of 19 states can peek at an error.
65 functions before inlining, 8 functions after inlining.
/* Analyseur syntaxique pour Arith */
%{
open Ast
%}
%token <string> IDENT
%token STRUCT END
%token EOF
%token T_PAAMAYIM_NEKUDOTAYIM "::" SEMI ";"
/* Définitions des priorités et associativités des tokens */
/* Point d'entrée de la grammaire */
%start file
/* Type des valeurs retournées par l'analyseur syntaxique */
%type <Ast.file> file
%type <Ast.pdecl_desc> decl_desc
%type <Ast.pdecl_desc Ast.loc> decl
%%
let file :=
| d = decl; EOF; { [d] }
decl_desc:
| STRUCT ps = separated(";", param) END
{ PDstruct ({txt="f";loc=(Lexing.dummy_pos, Lexing.dummy_pos)}, ps, false) }
;
let decl :=
| d = mkloc(decl_desc); { d }
let separated(SEP, prod) :=
| /* empty */ { [] }
| SEP; ps = separated(SEP, prod); { ps }
| p = prod; { [p] }
| hd = prod; SEP; tl = separated(SEP, prod); { hd :: tl }
let param :=
| p = mkloc(IDENT); t = option("::"; i = mkloc(IDENT); { i }); { (p, t) }
let mkloc(desc) :=
| txt = desc; { { txt; loc= $sloc } }
%{
open Ast
%}
%start file
%token END
%token EOF
%token <string> IDENT
%token SEMI
%token STRUCT
%token T_PAAMAYIM_NEKUDOTAYIM
%type <Ast.pdecl_desc Ast.loc> decl
%type <Ast.pdecl_desc> decl_desc
%type <Ast.file> file
%%
option___anonymous_0_:
{ ( None )}
| _1 = T_PAAMAYIM_NEKUDOTAYIM i = mkloc_IDENT_
{let x = ( i ) in
( Some x )}
file:
d = decl _2 = EOF
{ ( [d] )}
decl_desc:
_1 = STRUCT ps = separated_SEMI_param_ _3 = END
{ ( PDstruct ({txt="f";loc=(Lexing.dummy_pos, Lexing.dummy_pos)}, ps, false) )}
decl:
d = mkloc_decl_desc_
{ ( d )}
separated_SEMI_param_:
{ ( [] )}
| _1 = SEMI ps = separated_SEMI_param_
{ ( ps )}
| p = param
{ ( [p] )}
| hd = param _2 = SEMI tl = separated_SEMI_param_
{ ( hd :: tl )}
param:
p = mkloc_IDENT_ t = option___anonymous_0_
{ ( (p, t) )}
mkloc_IDENT_:
txt = IDENT
{let _endpos = _endpos_txt_ in
let _symbolstartpos = _startpos_txt_ in
let _sloc = (_symbolstartpos, _endpos) in
( { txt; loc= _sloc } )}
mkloc_decl_desc_:
txt = decl_desc
{let _endpos = _endpos_txt_ in
let _symbolstartpos = _startpos_txt_ in
let _sloc = (_symbolstartpos, _endpos) in
( { txt; loc= _sloc } )}
%%
......@@ -771,6 +771,30 @@
(rule (alias bare-bones)
(action (diff bare-bones.conflicts.exp bare-bones.conflicts)))
(rule (target basile.opp.out) (deps basile.mly)
(action
(with-outputs-to basile.opp.out (run menhir --only-preprocess %{deps}))))
(rule (alias basile) (action (diff basile.opp.exp basile.opp.out)))
(rule
(targets basile.out basile.automaton basile.automaton.resolved
basile.conflicts basile.timings)
(deps basile.mly)
(action
(with-outputs-to basile.out
(run menhir --dump --dump-resolved --explain -lg 2 -la 2 -lc 2
--timings-to basile.timings %{deps}))))
(rule (alias basile) (action (diff basile.exp basile.out)))
(rule (alias basile) (action (diff basile.automaton.exp basile.automaton)))
(rule (alias basile)
(action (diff basile.automaton.resolved.exp basile.automaton.resolved)))
(rule (alias basile) (action (diff basile.conflicts.exp basile.conflicts)))
(rule (target batsh.0.0.6-parser_yacc.opp.out)
(deps batsh.0.0.6-parser_yacc.mly)
(action
......@@ -11676,6 +11700,7 @@
(alias attributes-expansion)
(alias bamboo.0.0.03-parser)
(alias bare-bones)
(alias basile)
(alias batsh.0.0.6-parser_yacc)
(alias bauer)
(alias belloeil)
......
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