AT_SETUP([Unresolved SR Conflicts])
+AT_KEYWORDS([report])
+
AT_DATA([input.y],
[[%token NUM OP
%%
exp: exp OP exp | NUM;
]])
-AT_CHECK([bison input.y -o input.c -v], 0, [],
+AT_CHECK([bison input.y -o input.c --report=all], 0, [],
[input.y contains 1 shift/reduce conflict.
])
Grammar
- Number, Line, Rule
- 0 3 $axiom -> exp $
- 1 3 exp -> exp OP exp
- 2 3 exp -> NUM
+ 0 $axiom: exp $
+
+ 1 exp: exp OP exp
+ 2 | NUM
Terminals, with rules where they appear
state 0
$axiom -> . exp $ (rule 0)
+ exp -> . exp OP exp (rule 1)
+ exp -> . NUM (rule 2)
NUM shift, and go to state 1
state 4
+ exp -> . exp OP exp (rule 1)
exp -> exp OP . exp (rule 1)
+ exp -> . NUM (rule 2)
NUM shift, and go to state 1
state 5
- exp -> exp . OP exp (rule 1)
- exp -> exp OP exp . (rule 1)
+ exp -> exp . OP exp [$, OP] (rule 1)
+ exp -> exp OP exp . [$, OP] (rule 1)
OP shift, and go to state 4
AT_SETUP([Solved SR Conflicts])
+AT_KEYWORDS([report])
+
AT_DATA([input.y],
[[%token NUM OP
%right OP
exp: exp OP exp | NUM;
]])
-AT_CHECK([bison input.y -o input.c -v], 0, [], [])
+AT_CHECK([bison input.y -o input.c --report=all], 0, [], [])
# Check the contents of the report.
AT_CHECK([cat input.output], [],
-[[Conflict in state 5 between rule 2 and token OP resolved as shift.
+[[Grammar
+ 0 $axiom: exp $
-Grammar
-
- Number, Line, Rule
- 0 4 $axiom -> exp $
- 1 4 exp -> exp OP exp
- 2 4 exp -> NUM
+ 1 exp: exp OP exp
+ 2 | NUM
Terminals, with rules where they appear
state 0
$axiom -> . exp $ (rule 0)
+ exp -> . exp OP exp (rule 1)
+ exp -> . NUM (rule 2)
NUM shift, and go to state 1
state 4
+ exp -> . exp OP exp (rule 1)
exp -> exp OP . exp (rule 1)
+ exp -> . NUM (rule 2)
NUM shift, and go to state 1
state 5
- exp -> exp . OP exp (rule 1)
- exp -> exp OP exp . (rule 1)
+ exp -> exp . OP exp [$] (rule 1)
+ exp -> exp OP exp . [$] (rule 1)
OP shift, and go to state 4
$default reduce using rule 1 (exp)
+ Conflict between rule 2 and token OP resolved as reduce (%right OP).
]])