mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-14 14:53:03 +00:00
cex: display shifts before reductions
When reporting counterexamples for s/r conflicts, put the shift first. This is more natural, and displays the default resolution first, which is also what happens for r/r conflicts where the smallest rule number is displayed first, and "wins". * src/counterexample.c (counterexample): Add a shift_reduce member. (new_counterexample): Adjust. Swap the derivations when this is a s/r conflict. (print_counterexample): For s/r conflicts, prefer "Shift derivation" and "Reduce derivation" rather than "First/Second derivation". * tests/conflicts.at, tests/counterexample.at, tests/report.at: Adjust. * NEWS, doc/bison.texi: Ditto.
This commit is contained in:
@@ -865,8 +865,8 @@ State 5
|
||||
1 exp: exp OP exp .
|
||||
1 exp: exp . OP exp
|
||||
Example exp OP exp . OP exp
|
||||
First derivation exp -> [ exp -> [ exp OP exp . ] OP exp ]
|
||||
Second derivation exp -> [ exp OP exp -> [ exp . OP exp ] ]
|
||||
Shift derivation exp -> [ exp OP exp -> [ exp . OP exp ] ]
|
||||
Reduce derivation exp -> [ exp -> [ exp OP exp . ] OP exp ]
|
||||
|
||||
]])
|
||||
|
||||
@@ -1753,18 +1753,18 @@ State 4
|
||||
Shift/reduce conflict on token 'a':
|
||||
10 reported_conflicts: . %empty
|
||||
8 reported_conflicts: . 'a'
|
||||
First example resolved_conflict . 'a'
|
||||
First derivation start -> [ resolved_conflict reported_conflicts -> [ . ] 'a' ]
|
||||
Second example resolved_conflict . 'a' 'a'
|
||||
Second derivation start -> [ resolved_conflict reported_conflicts -> [ . 'a' ] 'a' ]
|
||||
First example resolved_conflict . 'a' 'a'
|
||||
Shift derivation start -> [ resolved_conflict reported_conflicts -> [ . 'a' ] 'a' ]
|
||||
Second example resolved_conflict . 'a'
|
||||
Reduce derivation start -> [ resolved_conflict reported_conflicts -> [ . ] 'a' ]
|
||||
|
||||
Shift/reduce conflict on token 'a':
|
||||
10 reported_conflicts: . %empty
|
||||
9 reported_conflicts: . 'a'
|
||||
First example resolved_conflict . 'a'
|
||||
First derivation start -> [ resolved_conflict reported_conflicts -> [ . ] 'a' ]
|
||||
Second example resolved_conflict . 'a' 'a'
|
||||
Second derivation start -> [ resolved_conflict reported_conflicts -> [ . 'a' ] 'a' ]
|
||||
First example resolved_conflict . 'a' 'a'
|
||||
Shift derivation start -> [ resolved_conflict reported_conflicts -> [ . 'a' ] 'a' ]
|
||||
Second example resolved_conflict . 'a'
|
||||
Reduce derivation start -> [ resolved_conflict reported_conflicts -> [ . ] 'a' ]
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -47,8 +47,8 @@ AT_BISON_CHECK_CEX([input.y], [], [],
|
||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
Shift/reduce conflict on token B:
|
||||
Example A . B C
|
||||
First derivation s -> [ a -> [ A . ] x -> [ B C ] ]
|
||||
Second derivation s -> [ y -> [ A . B ] c -> [ C ] ]
|
||||
Shift derivation s -> [ y -> [ A . B ] c -> [ C ] ]
|
||||
Reduce derivation s -> [ a -> [ A . ] x -> [ B C ] ]
|
||||
|
||||
input.y:4.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]])
|
||||
@@ -76,13 +76,13 @@ AT_BISON_CHECK_CEX([input.y], [], [],
|
||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
Shift/reduce conflict on token B:
|
||||
Example A . B C
|
||||
First derivation s -> [ a -> [ A . ] bc -> [ B C ] ]
|
||||
Second derivation s -> [ ac -> [ A ac -> [ b -> [ . B ] ] C ] ]
|
||||
Shift derivation s -> [ ac -> [ A ac -> [ b -> [ . B ] ] C ] ]
|
||||
Reduce derivation s -> [ a -> [ A . ] bc -> [ B C ] ]
|
||||
|
||||
Shift/reduce conflict on token B:
|
||||
Example A A . B B C C
|
||||
First derivation s -> [ a -> [ A a -> [ A . ] ] bc -> [ B bc -> [ B C ] C ] ]
|
||||
Second derivation s -> [ ac -> [ A ac -> [ A ac -> [ b -> [ . b -> [ B B ] ] ] C ] C ] ]
|
||||
Shift derivation s -> [ ac -> [ A ac -> [ A ac -> [ b -> [ . b -> [ B B ] ] ] C ] C ] ]
|
||||
Reduce derivation s -> [ a -> [ A a -> [ A . ] ] bc -> [ B bc -> [ B C ] C ] ]
|
||||
|
||||
input.y:6.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]])
|
||||
@@ -111,14 +111,14 @@ AT_BISON_CHECK_CEX([input.y], [], [],
|
||||
[[input.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
|
||||
Shift/reduce conflict on token B:
|
||||
Example A . B
|
||||
First derivation s -> [ ax -> [ A x -> [ . ] ] by -> [ B y -> [ ] ] ]
|
||||
Second derivation s -> [ A xby -> [ . B ] ]
|
||||
Shift derivation s -> [ A xby -> [ . B ] ]
|
||||
Reduce derivation s -> [ ax -> [ A x -> [ . ] ] by -> [ B y -> [ ] ] ]
|
||||
|
||||
Shift/reduce conflict on token B:
|
||||
First example A X . B y $end
|
||||
First derivation $accept -> [ s -> [ ax -> [ A x -> [ X x -> [ . ] ] ] by -> [ B y ] ] $end ]
|
||||
Second example A X . B Y $end
|
||||
Second derivation $accept -> [ s -> [ A xby -> [ X xby -> [ . B ] Y ] ] $end ]
|
||||
First example A X . B Y $end
|
||||
Shift derivation $accept -> [ s -> [ A xby -> [ X xby -> [ . B ] Y ] ] $end ]
|
||||
Second example A X . B y $end
|
||||
Reduce derivation $accept -> [ s -> [ ax -> [ A x -> [ X x -> [ . ] ] ] by -> [ B y ] ] $end ]
|
||||
|
||||
input.y:5.4-9: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]])
|
||||
@@ -146,10 +146,10 @@ bc: B C;
|
||||
AT_BISON_CHECK_CEX([input.y], [], [],
|
||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
Shift/reduce conflict on token C:
|
||||
First example B . C D $end
|
||||
First derivation $accept -> [ g -> [ x -> [ b -> [ B . ] cd -> [ C D ] ] ] $end ]
|
||||
Second example B . C $end
|
||||
Second derivation $accept -> [ g -> [ x -> [ bc -> [ B . C ] ] ] $end ]
|
||||
First example B . C $end
|
||||
Shift derivation $accept -> [ g -> [ x -> [ bc -> [ B . C ] ] ] $end ]
|
||||
Second example B . C D $end
|
||||
Reduce derivation $accept -> [ g -> [ x -> [ b -> [ B . ] cd -> [ C D ] ] ] $end ]
|
||||
|
||||
input.y:6.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]])
|
||||
@@ -175,10 +175,10 @@ y: A A B;
|
||||
AT_BISON_CHECK_CEX([input.y], [], [],
|
||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
Shift/reduce conflict on token A:
|
||||
First example A . A $end
|
||||
First derivation $accept -> [ s -> [ s -> [ t -> [ x -> [ A . ] ] ] t -> [ x -> [ A ] ] ] $end ]
|
||||
Second example A . A B $end
|
||||
Second derivation $accept -> [ s -> [ t -> [ y -> [ A . A B ] ] ] $end ]
|
||||
First example A . A B $end
|
||||
Shift derivation $accept -> [ s -> [ t -> [ y -> [ A . A B ] ] ] $end ]
|
||||
Second example A . A $end
|
||||
Reduce derivation $accept -> [ s -> [ s -> [ t -> [ x -> [ A . ] ] ] t -> [ x -> [ A ] ] ] $end ]
|
||||
|
||||
]])
|
||||
|
||||
@@ -209,14 +209,14 @@ AT_BISON_CHECK_CEX([input.y], [], [],
|
||||
[[input.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
|
||||
Shift/reduce conflict on token A:
|
||||
Example b . A X X Y
|
||||
First derivation a -> [ r -> [ b . ] t -> [ A x -> [ X ] xy -> [ X Y ] ] ]
|
||||
Second derivation a -> [ s -> [ b . xx -> [ A X X ] y -> [ Y ] ] ]
|
||||
Shift derivation a -> [ s -> [ b . xx -> [ A X X ] y -> [ Y ] ] ]
|
||||
Reduce derivation a -> [ r -> [ b . ] t -> [ A x -> [ X ] xy -> [ X Y ] ] ]
|
||||
|
||||
Shift/reduce conflict on token X:
|
||||
First example X . X xy
|
||||
First derivation a -> [ x -> [ X . ] t -> [ X xy ] ]
|
||||
Second example A X . X
|
||||
Second derivation a -> [ t -> [ A xx -> [ X . X ] ] ]
|
||||
First example A X . X
|
||||
Shift derivation a -> [ t -> [ A xx -> [ X . X ] ] ]
|
||||
Second example X . X xy
|
||||
Reduce derivation a -> [ x -> [ X . ] t -> [ X xy ] ]
|
||||
|
||||
input.y:4.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input.y:8.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||
@@ -297,10 +297,10 @@ AT_BISON_CHECK_CEX([input.y], [], [],
|
||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
Shift/reduce conflict on token J:
|
||||
time limit exceeded: XXX
|
||||
First example H i . J $end
|
||||
First derivation $accept -> [ s -> [ a -> [ H i . ] J ] $end ]
|
||||
Second example H i . J K $end
|
||||
Second derivation $accept -> [ a -> [ H i -> [ i . J K ] ] $end ]
|
||||
First example H i . J K $end
|
||||
Shift derivation $accept -> [ a -> [ H i -> [ i . J K ] ] $end ]
|
||||
Second example H i . J $end
|
||||
Reduce derivation $accept -> [ s -> [ a -> [ H i . ] J ] $end ]
|
||||
|
||||
input.y:4.4-6: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]])
|
||||
@@ -330,13 +330,13 @@ AT_BISON_CHECK_CEX([input.y], [], [],
|
||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
Shift/reduce conflict on token B:
|
||||
Example N A . B C
|
||||
First derivation s -> [ n -> [ N a -> [ A . ] B ] C ]
|
||||
Second derivation s -> [ n -> [ N b -> [ A . B C ] ] ]
|
||||
Shift derivation s -> [ n -> [ N b -> [ A . B C ] ] ]
|
||||
Reduce derivation s -> [ n -> [ N a -> [ A . ] B ] C ]
|
||||
|
||||
Shift/reduce conflict on token B:
|
||||
Example N N A . B D C
|
||||
First derivation s -> [ n -> [ N n -> [ N a -> [ A . ] B ] D ] C ]
|
||||
Second derivation s -> [ n -> [ N n -> [ N b -> [ A . B D ] ] C ] ]
|
||||
Shift derivation s -> [ n -> [ N n -> [ N b -> [ A . B D ] ] C ] ]
|
||||
Reduce derivation s -> [ n -> [ N n -> [ N a -> [ A . ] B ] D ] C ]
|
||||
|
||||
input.y:5.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]])
|
||||
@@ -420,10 +420,10 @@ time limit exceeded: XXX
|
||||
|
||||
Shift/reduce conflict on token A:
|
||||
time limit exceeded: XXX
|
||||
First example b c . c A A $end
|
||||
First derivation $accept -> [ a -> [ b d -> [ a -> [ c d -> [ a -> [ b -> [ . ] d -> [ c A A ] ] ] ] ] ] $end ]
|
||||
Second example b c . A
|
||||
Second derivation a -> [ b d -> [ c . A ] ]
|
||||
First example b c . A
|
||||
Shift derivation a -> [ b d -> [ c . A ] ]
|
||||
Second example b c . c A A $end
|
||||
Reduce derivation $accept -> [ a -> [ b d -> [ a -> [ c d -> [ a -> [ b -> [ . ] d -> [ c A A ] ] ] ] ] ] $end ]
|
||||
|
||||
Reduce/reduce conflict on token A:
|
||||
First example b c . c A A $end
|
||||
@@ -432,10 +432,10 @@ Reduce/reduce conflict on token A:
|
||||
Second derivation $accept -> [ a -> [ b d -> [ a -> [ c d -> [ c -> [ . ] A ] ] ] ] $end ]
|
||||
|
||||
Shift/reduce conflict on token A:
|
||||
First example b c . A $end
|
||||
First derivation $accept -> [ a -> [ b d -> [ a -> [ c d -> [ c -> [ . ] A ] ] ] ] $end ]
|
||||
Second example b c . A
|
||||
Second derivation a -> [ b d -> [ c . A ] ]
|
||||
First example b c . A
|
||||
Shift derivation a -> [ b d -> [ c . A ] ]
|
||||
Second example b c . A $end
|
||||
Reduce derivation $accept -> [ a -> [ b d -> [ a -> [ c d -> [ c -> [ . ] A ] ] ] ] $end ]
|
||||
|
||||
Reduce/reduce conflict on token $end:
|
||||
Example b d .
|
||||
@@ -475,8 +475,8 @@ AT_BISON_CHECK_CEX([input.y], [], [],
|
||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
Shift/reduce conflict on token J:
|
||||
Example H i J . J J
|
||||
First derivation s -> [ a -> [ H i -> [ i J . ] J J ] ]
|
||||
Second derivation s -> [ a -> [ H i J . J ] J ]
|
||||
Shift derivation s -> [ a -> [ H i J . J ] J ]
|
||||
Reduce derivation s -> [ a -> [ H i -> [ i J . ] J J ] ]
|
||||
|
||||
input.y:5.13-15: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]])
|
||||
@@ -507,8 +507,8 @@ AT_BISON_CHECK_CEX([input.y], [], [],
|
||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
Shift/reduce conflict on token D:
|
||||
Example A a . D
|
||||
First derivation s -> [ A a a -> [ b -> [ c -> [ . ] ] ] d -> [ D ] ]
|
||||
Second derivation s -> [ A a d -> [ . D ] ]
|
||||
Shift derivation s -> [ A a d -> [ . D ] ]
|
||||
Reduce derivation s -> [ A a a -> [ b -> [ c -> [ . ] ] ] d -> [ D ] ]
|
||||
|
||||
]])
|
||||
|
||||
@@ -536,10 +536,10 @@ d: D;
|
||||
AT_BISON_CHECK_CEX([input.y], [], [],
|
||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
Shift/reduce conflict on token D:
|
||||
First example A a . D E $end
|
||||
First derivation $accept -> [ s -> [ A a a -> [ b -> [ c -> [ . ] ] ] d -> [ D ] E ] $end ]
|
||||
Second example A a . D $end
|
||||
Second derivation $accept -> [ s -> [ A a d -> [ . D ] ] $end ]
|
||||
First example A a . D $end
|
||||
Shift derivation $accept -> [ s -> [ A a d -> [ . D ] ] $end ]
|
||||
Second example A a . D E $end
|
||||
Reduce derivation $accept -> [ s -> [ A a a -> [ b -> [ c -> [ . ] ] ] d -> [ D ] E ] $end ]
|
||||
|
||||
]])
|
||||
|
||||
|
||||
@@ -534,28 +534,28 @@ exp
|
||||
| "num"
|
||||
]],
|
||||
[1],
|
||||
[[input.y: <error>error:</error> shift/reduce conflicts: 4 found, 0 expected
|
||||
Shift/reduce conflict on token "+":
|
||||
[[input.y: <error>error:</error> shift/reduce conflicts: 4 found, 0 expected
|
||||
First derivation <cex-0><cex-step>exp → [ </cex-step><cex-1><cex-step>exp → [ </cex-step><cex-leaf>exp</cex-leaf> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot><cex-step> ]</cex-step></cex-1> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf><cex-step> ]</cex-step></cex-0>
|
||||
Shift/reduce conflict on token "+":
|
||||
Example <cex-0><cex-leaf>exp</cex-leaf> <cex-leaf>"+"</cex-leaf><cex-1> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-1></cex-0>
|
||||
Shift derivation <cex-0><cex-step>exp → [ </cex-step><cex-leaf>exp</cex-leaf> <cex-leaf>"+"</cex-leaf><cex-1> <cex-step>exp → [ </cex-step><cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf><cex-step> ]</cex-step></cex-1><cex-step> ]</cex-step></cex-0>
|
||||
Example <cex-0><cex-1><cex-leaf>exp</cex-leaf> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot></cex-1> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-0>
|
||||
Reduce derivation <cex-0><cex-step>exp → [ </cex-step><cex-1><cex-step>exp → [ </cex-step><cex-leaf>exp</cex-leaf> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot><cex-step> ]</cex-step></cex-1> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf><cex-step> ]</cex-step></cex-0>
|
||||
|
||||
Shift/reduce conflict on token "else":
|
||||
|
||||
First derivation <cex-0><cex-step>exp → [ </cex-step><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf><cex-1> <cex-step>exp → [ </cex-step><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot><cex-step> ]</cex-step></cex-1> <cex-leaf>"else"</cex-leaf> <cex-leaf>exp</cex-leaf><cex-step> ]</cex-step></cex-0>
|
||||
Shift/reduce conflict on token "else":
|
||||
Example <cex-0><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf><cex-1> <cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot> <cex-leaf>"else"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-1></cex-0>
|
||||
Shift derivation <cex-0><cex-step>exp → [ </cex-step><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf><cex-1> <cex-step>exp → [ </cex-step><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot> <cex-leaf>"else"</cex-leaf> <cex-leaf>exp</cex-leaf><cex-step> ]</cex-step></cex-1><cex-step> ]</cex-step></cex-0>
|
||||
Example <cex-0><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf><cex-1> <cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot></cex-1> <cex-leaf>"else"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-0>
|
||||
Reduce derivation <cex-0><cex-step>exp → [ </cex-step><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf><cex-1> <cex-step>exp → [ </cex-step><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot><cex-step> ]</cex-step></cex-1> <cex-leaf>"else"</cex-leaf> <cex-leaf>exp</cex-leaf><cex-step> ]</cex-step></cex-0>
|
||||
|
||||
Shift/reduce conflict on token "+":
|
||||
|
||||
First derivation <cex-0><cex-step>exp → [ </cex-step><cex-1><cex-step>exp → [ </cex-step><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot><cex-step> ]</cex-step></cex-1> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf><cex-step> ]</cex-step></cex-0>
|
||||
Shift/reduce conflict on token "+":
|
||||
Example <cex-0><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf><cex-1> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-1></cex-0>
|
||||
Shift derivation <cex-0><cex-step>exp → [ </cex-step><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf><cex-1> <cex-step>exp → [ </cex-step><cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf><cex-step> ]</cex-step></cex-1><cex-step> ]</cex-step></cex-0>
|
||||
Example <cex-0><cex-1><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot></cex-1> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-0>
|
||||
Reduce derivation <cex-0><cex-step>exp → [ </cex-step><cex-1><cex-step>exp → [ </cex-step><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot><cex-step> ]</cex-step></cex-1> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf><cex-step> ]</cex-step></cex-0>
|
||||
|
||||
Shift/reduce conflict on token "+":
|
||||
|
||||
First derivation <cex-0><cex-step>exp → [ </cex-step><cex-1><cex-step>exp → [ </cex-step><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"else"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot><cex-step> ]</cex-step></cex-1> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf><cex-step> ]</cex-step></cex-0>
|
||||
Shift/reduce conflict on token "+":
|
||||
Example <cex-0><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"else"</cex-leaf><cex-1> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-1></cex-0>
|
||||
Shift derivation <cex-0><cex-step>exp → [ </cex-step><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"else"</cex-leaf><cex-1> <cex-step>exp → [ </cex-step><cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf><cex-step> ]</cex-step></cex-1><cex-step> ]</cex-step></cex-0>
|
||||
Example <cex-0><cex-1><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"else"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot></cex-1> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-0>
|
||||
Reduce derivation <cex-0><cex-step>exp → [ </cex-step><cex-1><cex-step>exp → [ </cex-step><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"else"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot><cex-step> ]</cex-step></cex-1> <cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf><cex-step> ]</cex-step></cex-0>
|
||||
|
||||
|
||||
@@ -1539,8 +1539,8 @@ AT_CHECK([LC_ALL="$locale" bison -fno-caret -o input.cc -rall -Wcex --graph=inpu
|
||||
input.y: warning: 3 reduce/reduce conflicts [-Wconflicts-rr]
|
||||
Shift/reduce conflict on token "⊕":
|
||||
Example exp "+" exp • "⊕" exp
|
||||
First derivation exp → [ exp → [ exp "+" exp • ] "⊕" exp ]
|
||||
Second derivation exp → [ exp "+" exp → [ exp • "⊕" exp ] ]
|
||||
Shift derivation exp → [ exp "+" exp → [ exp • "⊕" exp ] ]
|
||||
Reduce derivation exp → [ exp → [ exp "+" exp • ] "⊕" exp ]
|
||||
|
||||
Reduce/reduce conflict on tokens $end, "+", "⊕":
|
||||
Example exp "+" exp •
|
||||
@@ -1549,23 +1549,23 @@ Reduce/reduce conflict on tokens $end, "+", "⊕":
|
||||
|
||||
Shift/reduce conflict on token "⊕":
|
||||
Example exp "+" exp • "⊕" exp
|
||||
First derivation exp → [ exp → [ exp "+" exp • ] "⊕" exp ]
|
||||
Second derivation exp → [ exp "+" exp → [ exp • "⊕" exp ] ]
|
||||
Shift derivation exp → [ exp "+" exp → [ exp • "⊕" exp ] ]
|
||||
Reduce derivation exp → [ exp → [ exp "+" exp • ] "⊕" exp ]
|
||||
|
||||
Shift/reduce conflict on token "⊕":
|
||||
Example exp "⊕" exp • "⊕" exp
|
||||
First derivation exp → [ exp → [ exp "⊕" exp • ] "⊕" exp ]
|
||||
Second derivation exp → [ exp "⊕" exp → [ exp • "⊕" exp ] ]
|
||||
Shift derivation exp → [ exp "⊕" exp → [ exp • "⊕" exp ] ]
|
||||
Reduce derivation exp → [ exp → [ exp "⊕" exp • ] "⊕" exp ]
|
||||
|
||||
Shift/reduce conflict on token "+":
|
||||
Example exp "⊕" exp • "+" exp
|
||||
First derivation exp → [ exp → [ exp "⊕" exp • ] "+" exp ]
|
||||
Second derivation exp → [ exp "⊕" exp → [ exp • "+" exp ] ]
|
||||
Shift derivation exp → [ exp "⊕" exp → [ exp • "+" exp ] ]
|
||||
Reduce derivation exp → [ exp → [ exp "⊕" exp • ] "+" exp ]
|
||||
|
||||
Shift/reduce conflict on token "+":
|
||||
Example exp "⊕" exp • "+" exp
|
||||
First derivation exp → [ exp → [ exp "⊕" exp • ] "+" exp ]
|
||||
Second derivation exp → [ exp "⊕" exp → [ exp • "+" exp ] ]
|
||||
Shift derivation exp → [ exp "⊕" exp → [ exp • "+" exp ] ]
|
||||
Reduce derivation exp → [ exp → [ exp "⊕" exp • ] "+" exp ]
|
||||
|
||||
input.y:6.3-13: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]])
|
||||
@@ -1714,8 +1714,8 @@ State 7
|
||||
2 exp: exp "+" exp •
|
||||
1 exp: exp • "⊕" exp
|
||||
Example exp "+" exp • "⊕" exp
|
||||
First derivation exp → [ exp → [ exp "+" exp • ] "⊕" exp ]
|
||||
Second derivation exp → [ exp "+" exp → [ exp • "⊕" exp ] ]
|
||||
Shift derivation exp → [ exp "+" exp → [ exp • "⊕" exp ] ]
|
||||
Reduce derivation exp → [ exp → [ exp "+" exp • ] "⊕" exp ]
|
||||
|
||||
Reduce/reduce conflict on tokens $end, "+", "⊕":
|
||||
2 exp: exp "+" exp •
|
||||
@@ -1728,8 +1728,8 @@ State 7
|
||||
3 exp: exp "+" exp •
|
||||
1 exp: exp • "⊕" exp
|
||||
Example exp "+" exp • "⊕" exp
|
||||
First derivation exp → [ exp → [ exp "+" exp • ] "⊕" exp ]
|
||||
Second derivation exp → [ exp "+" exp → [ exp • "⊕" exp ] ]
|
||||
Shift derivation exp → [ exp "+" exp → [ exp • "⊕" exp ] ]
|
||||
Reduce derivation exp → [ exp → [ exp "+" exp • ] "⊕" exp ]
|
||||
|
||||
|
||||
|
||||
@@ -1751,22 +1751,22 @@ State 8
|
||||
1 exp: exp "⊕" exp •
|
||||
1 exp: exp • "⊕" exp
|
||||
Example exp "⊕" exp • "⊕" exp
|
||||
First derivation exp → [ exp → [ exp "⊕" exp • ] "⊕" exp ]
|
||||
Second derivation exp → [ exp "⊕" exp → [ exp • "⊕" exp ] ]
|
||||
Shift derivation exp → [ exp "⊕" exp → [ exp • "⊕" exp ] ]
|
||||
Reduce derivation exp → [ exp → [ exp "⊕" exp • ] "⊕" exp ]
|
||||
|
||||
Shift/reduce conflict on token "+":
|
||||
1 exp: exp "⊕" exp •
|
||||
2 exp: exp • "+" exp
|
||||
Example exp "⊕" exp • "+" exp
|
||||
First derivation exp → [ exp → [ exp "⊕" exp • ] "+" exp ]
|
||||
Second derivation exp → [ exp "⊕" exp → [ exp • "+" exp ] ]
|
||||
Shift derivation exp → [ exp "⊕" exp → [ exp • "+" exp ] ]
|
||||
Reduce derivation exp → [ exp → [ exp "⊕" exp • ] "+" exp ]
|
||||
|
||||
Shift/reduce conflict on token "+":
|
||||
1 exp: exp "⊕" exp •
|
||||
3 exp: exp • "+" exp
|
||||
Example exp "⊕" exp • "+" exp
|
||||
First derivation exp → [ exp → [ exp "⊕" exp • ] "+" exp ]
|
||||
Second derivation exp → [ exp "⊕" exp → [ exp • "+" exp ] ]
|
||||
Shift derivation exp → [ exp "⊕" exp → [ exp • "+" exp ] ]
|
||||
Reduce derivation exp → [ exp → [ exp "⊕" exp • ] "+" exp ]
|
||||
|
||||
]])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user