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

Log the construction mode.

parent 69ba861d
......@@ -52,7 +52,7 @@ SED=$(shell if [[ "$$OSTYPE" == "darwin"* ]] ; then echo gsed ; else echo sed ;
.PHONY: data
data: test
@ echo "Collecting data (using $(SED))..." && \
echo "name,terminals,nonterminals,lr0states,lr1states,lr1time" > analysis/data.csv && \
echo "name,mode,terminals,nonterminals,lr0states,lr1states,lr1time" > analysis/data.csv && \
directory=_build/default/test/static/src && \
successful=0 && timedout=0 && \
for timings in $$directory/*.out.timings ; do \
......@@ -63,12 +63,13 @@ data: test
((timedout++)) ; \
else \
((successful++)) ; \
mode=`$(SED) -n -e "s/^The construction mode is \([a-z\-]\+\)./\1/p" $$out` ; \
terminals=`$(SED) -n -e "s/^Grammar has \([0-9]\+\) terminal symbols./\1/p" $$out` ; \
nonterminals=`$(SED) -n -e "s/^Grammar has \([0-9]\+\) nonterminal symbols, among which [0-9]\+ start symbols./\1/p" $$out` ; \
lr0states=`$(SED) -n -e "s/^Built an LR(0) automaton with \([0-9]\+\) states./\1/p" $$out` ; \
lr1states=`$(SED) -n -e "s/^Built an LR(1) automaton with \([0-9]\+\) states./\1/p" $$out` ; \
lr1time=`$(SED) -n -e "s/^Construction of the LR(1) automaton: \(.*\)s/\1/p" $$timings` ; \
echo "$$name,$$terminals,$$nonterminals,$$lr0states,$$lr1states,$$lr1time" >> analysis/data.csv ; \
echo "$$name,$$mode,$$terminals,$$nonterminals,$$lr0states,$$lr1states,$$lr1time" >> analysis/data.csv ; \
fi \
done && \
echo "$$successful successful tests; $$timedout timed out tests."
......
......@@ -50,20 +50,32 @@ module type ALGORITHM = sig
module Run () : LR1_AUTOMATON
end
let algo : (module ALGORITHM) =
let algo, mode =
Settings.(match construction_mode with
| ModeCanonical ->
(module LR1Canonical : ALGORITHM)
| ModeInclusionOnly
(module LR1Canonical : ALGORITHM),
"canonical"
| ModeInclusionOnly ->
(module LR1Pager : ALGORITHM),
"no-pager"
| ModePager ->
(module LR1Pager : ALGORITHM)
(module LR1Pager : ALGORITHM),
"pager"
| ModeLALR ->
(module LALR : ALGORITHM)
(module LALR : ALGORITHM),
"lalr"
)
module Algorithm =
(val algo : ALGORITHM)
let () =
Error.logA 1 (fun f ->
Printf.fprintf f
"The construction mode is %s.\n"
mode
)
(* -------------------------------------------------------------------------- *)
(* Run the construction algorithm. *)
......
......@@ -541,6 +541,7 @@ follow(additive_init_expression) = Lxor Lsemicolon Lsc_or Lsc_and Lrunsignedshif
follow(additive_expression) = Lxor Lsemicolon Lsc_or Lsc_and Lrunsignedshift Lrsignedshift Lrparen Lrbracket Lrbrace Lplus Lneq Lne Lminus Llshift Lless Lle Lhook Lgreater Lge Leqq Leq Lcomma Lcolon Lbit_or Lbit_and KWinstanceof KWin
Built an LR(0) automaton with 660 states.
The grammar is not SLR(1) -- 12 states have a conflict.
The construction mode is pager.
Built an LR(1) automaton with 660 states.
Warning: one state has shift/reduce conflicts.
Warning: one shift/reduce conflict was arbitrarily resolved.
......
......@@ -237,6 +237,7 @@ follow(address) = error UPSERT_WITH_BEFORE UPSERT_WITH UPDATE_SUFFIX UPDATE UNKN
follow(access) = error UPSERT_WITH_BEFORE UPSERT_WITH UPDATE_SUFFIX UPDATE UNKNOWN UNIT TRIGGER TIMES THEN STRING SOURCE SORT SIZE SINK SEND SEMICOLON RPAREN ROLE RBRACKETLT RBRACKETHASH RBRACKETCOLON RBRACKET RBRACELT RBRACECOLON RBRACEBAR RBRACE PLUS PERIOD PEEK_WITH_VID PEEK OR OF NOTHING NOT NETWORK NEQ NEG MODULO MIN_WITH MAP LT LPAREN LET LEQ LBRACKETLT LBRACKETHASH LBRACKETGEQ LBRACKETCOLON LBRACKETBAR LBRACKET LBRACELT LBRACECOLON LBRACEBAR LBRACE LARROW JUST ITERATE IP INTEGER INSERT INDIRECT IN IGNORE IF IDENTIFIER GT GROUPBYAGGREGATE GETS GEQ FOREIGN FLOAT FLATTEN FILTERGEQ FILTER EXPECTED EQ ELSE DO DIVIDE DELETE_PREFIX DELETE DEFAULT DECLARE CONSUME CONCAT COMMA COLON CASE BOOL BINDFLOW BIND BAR BACKSLASH AT_WITH AS ANNOTATE AND AGGREGATEV AGGREGATE #
Built an LR(0) automaton with 762 states.
The grammar is not SLR(1) -- 70 states have a conflict.
The construction mode is pager.
Built an LR(1) automaton with 1441 states.
565 shift/reduce conflicts were silently solved.
File "K3Parser.mly", line 177, characters 0-5:
......
......@@ -179,6 +179,7 @@ follow(agent_expression) = error UNTIL TRUE SEMICOLON REPEAT PIPE NEWLINE KAPPA_
follow(a_link_state) = KAPPA_WLD KAPPA_LNK DIV COMMA CL_PAR
Built an LR(0) automaton with 357 states.
The grammar is not SLR(1) -- 20 states have a conflict.
The construction mode is pager.
Built an LR(1) automaton with 400 states.
90 shift/reduce conflicts were silently solved.
156 out of 400 states have a default reduction.
......
......@@ -235,6 +235,7 @@ follow(agent_modif) = error TRUE TOKEN SIGNATURE SEMICOLON RAR PLOT PIPE PERT OB
follow(agent) = error TRUE TOKEN SIGNATURE SEMICOLON RAR PLOT PIPE PERT OBS LRAR LET LABEL INIT ID FALSE EOF DOT CONFIG COMMA CL_PAR AT
Built an LR(0) automaton with 519 states.
The grammar is not SLR(1) -- 4 states have a conflict.
The construction mode is pager.
Built an LR(1) automaton with 580 states.
193 out of 580 states have a default reduction.
304 out of 580 states are represented.
......
......@@ -403,6 +403,7 @@ follow(arrow_type) = UIDENTIFIER TIMES SEMICOL RPAREN RBRACKET RBRACE PLUS NUMBE
follow(actual_generics) = UIDENTIFIER TIMES SEMICOL RPAREN RBRACKET RBRACE QMARK PLUS NUMBER NOTIN NEWLINE NEQ MINUS LT LPAREN LIDENTIFIER LE LBRACKET KWtrue KWthen KWrequire KWrename KWproof KWor KWnote KWlocal KWin KWimmutable KWghost KWfalse KWensure KWend KWelseif KWelse KWdo KWdeferred KWclass KWcase KWas KWand KWall GT GE EQ DOT DIVIDE DCOLON DBAR DARROW COMMA COLON CARET BAR ASSIGN ARROW #
Built an LR(0) automaton with 428 states.
The grammar is not SLR(1) -- 52 states have a conflict.
The construction mode is pager.
Built an LR(1) automaton with 428 states.
788 shift/reduce conflicts were silently solved.
File "albatross.mly", line 166, characters 9-18:
......
......@@ -11,6 +11,7 @@ follow(expr) = PLUS EOF
follow(declarations) = #
Built an LR(0) automaton with 11 states.
The grammar is not SLR(1) -- 1 states have a conflict.
The construction mode is pager.
Built an LR(1) automaton with 11 states.
One shift/reduce conflict was silently solved.
6 out of 11 states have a default reduction.
......
......@@ -55,6 +55,7 @@ follow(binding) = IN AND
follow(atomic_expression) = VAL RPAREN RCURLY PLUS IN EOF END DOT AND
Built an LR(0) automaton with 68 states.
The grammar is SLR(1).
The construction mode is pager.
Built an LR(1) automaton with 68 states.
27 out of 68 states have a default reduction.
15 out of 68 states are represented.
......
......@@ -79,6 +79,7 @@ follow(AType) = SEMI RSQUARE RPAREN RCURLY EQ DOT COMMA ARROW
follow(ATerm) = SEMI RPAREN RCURLY LSQUARE LPAREN LCURLY LCID IN DOT COMMA
Built an LR(0) automaton with 97 states.
The grammar is SLR(1).
The construction mode is pager.
Built an LR(1) automaton with 97 states.
34 out of 97 states have a default reduction.
32 out of 97 states are represented.
......
......@@ -111,6 +111,7 @@ follow(declaration) = TYPE SORT IDENTIFIER EOF CONTAINER
follow(container) = error TYPE STAR SORT SEMICOLON RBRACE RANGLE IDENTIFIER EOF CONTAINER BAR
Built an LR(0) automaton with 139 states.
The grammar is SLR(1).
The construction mode is pager.
Built an LR(1) automaton with 143 states.
74 out of 143 states have a default reduction.
35 out of 143 states are represented.
......
......@@ -139,6 +139,7 @@ follow(app_or_qid) = SLASH SEMI DOT DCG_ARROW COMMA
follow(app) = UNDERSCORE TRUE SLASH SEMI RPAREN RBRACK RBRACE QUAL_ID LPAREN LITERAL LBRACK LARROW IS INT INFIXR9 INFIXR8 INFIXR7 INFIXR6 INFIXR5 INFIXR4 INFIXR3 INFIXR2 INFIXR1 INFIXN9 INFIXN8 INFIXN7 INFIXN6 INFIXN5 INFIXN4 INFIXN3 INFIXN2 INFIXN1 INFIXL9 INFIXL8 INFIXL7 INFIXL6 INFIXL5 INFIXL4 INFIXL3 INFIXL2 INFIXL1 ID HASH EQ DOT DCG_ARROW DARROW CUT CONS COMMA CHAR BAR ARROW
Built an LR(0) automaton with 259 states.
The grammar is not SLR(1) -- 54 states have a conflict.
The construction mode is pager.
Built an LR(1) automaton with 259 states.
1418 shift/reduce conflicts were silently solved.
79 out of 259 states have a default reduction.
......
......@@ -59,6 +59,7 @@ follow(decll) = Llambda Lident
follow(atom) = Lstring Lsemi Lrpar Lperiod Llpar Llambda Lint Lident Lend
Built an LR(0) automaton with 71 states.
The grammar is SLR(1).
The construction mode is pager.
Built an LR(1) automaton with 71 states.
29 out of 71 states have a default reduction.
24 out of 71 states are represented.
......
......@@ -543,6 +543,7 @@ follow(anon_name(tt_name)) = UNDERSCORE RBRACE NAME LPAREN COLON
follow(abstraction) = REF RAISE QUOTED_STRING QQMARK PREFIXOP OCCURS NATURAL NAME LPAREN LBRACK CONVERT CONTEXT CONGRUENCE BANG ABSTRACT
Built an LR(0) automaton with 701 states.
The grammar is not SLR(1) -- 47 states have a conflict.
The construction mode is pager.
Built an LR(1) automaton with 702 states.
136 shift/reduce conflicts were silently solved.
261 out of 702 states have a default reduction.
......
......@@ -15,6 +15,7 @@ follow(foo) = EOF C A
follow(bar) = EOF C A
Built an LR(0) automaton with 16 states.
The grammar is SLR(1).
The construction mode is pager.
Built an LR(1) automaton with 16 states.
7 out of 16 states have a default reduction.
3 out of 16 states are represented.
......
......@@ -23,6 +23,7 @@ follow(midrule(__anonymous_1)) = A
follow(list(__anonymous_0(A,B))) = EOF D
Built an LR(0) automaton with 20 states.
The grammar is SLR(1).
The construction mode is pager.
Built an LR(1) automaton with 20 states.
9 out of 20 states have a default reduction.
6 out of 20 states are represented.
......
......@@ -23,6 +23,7 @@ follow(list(__anonymous_0(C,D))) = EOF
follow(list(__anonymous_0(A,B))) = EOF D C
Built an LR(0) automaton with 15 states.
The grammar is SLR(1).
The construction mode is pager.
Built an LR(1) automaton with 15 states.
8 out of 15 states have a default reduction.
6 out of 15 states are represented.
......
......@@ -15,6 +15,7 @@ follow(list(__anonymous_1)) = EOF
follow(list(__anonymous_0)) = EOF D
Built an LR(0) automaton with 14 states.
The grammar is SLR(1).
The construction mode is pager.
Built an LR(1) automaton with 14 states.
6 out of 14 states have a default reduction.
6 out of 14 states are represented.
......
......@@ -75,6 +75,7 @@ follow(coeff0) = TK_VAR TK_SUPEG TK_SUP TK_SUB TK_RPAR TK_POW TK_MUL TK_MODULO T
follow(coeff) = TK_VAR TK_SUPEG TK_SUP TK_SUB TK_MUL TK_MOD TK_INFEG TK_INF TK_EOF TK_EG TK_DISEG TK_ADD
Built an LR(0) automaton with 121 states.
The grammar is SLR(1).
The construction mode is pager.
Built an LR(1) automaton with 121 states.
49 out of 121 states have a default reduction.
41 out of 121 states are represented.
......
......@@ -87,6 +87,7 @@ follow(afield_list) = error GT
follow(afield) = error LIDENT GT
Built an LR(0) automaton with 108 states.
The grammar is not SLR(1) -- 2 states have a conflict.
The construction mode is pager.
Built an LR(1) automaton with 146 states.
60 out of 146 states have a default reduction.
50 out of 146 states are represented.
......
Supports Markdown
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