mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-18 08:43:03 +00:00
cex: always show ε/%empty in counterexamples
On a case such as
%%
exp
: empty "a"
| "a" empty
empty
: %empty
we used to display
warning: shift/reduce conflict on token "a" [-Wcounterexamples]
Example: • "a"
Shift derivation
exp
↳ 2: • "a" empty
↳ 2: ε
Example: • "a"
Reduce derivation
exp
↳ 1: empty "a"
↳ 3: •
where the shift derivation shows an item "2: empty → ε", with an
explicit "ε", but the reduce derivation shows "3: empty → •", without
"ε".
For consistency, let's always show ε/%empty in rules with an empty
rhs:
Reduce derivation
exp
↳ 1: empty "a"
↳ 3: ε •
* src/derivation.c (derivation_width, derivation_print_tree_impl):
Always show ε/%empty in counterexamples.
* tests/diagnostics.at: Check that case.
* tests/conflicts.at, tests/counterexample.at: Adjust.
This commit is contained in:
11
NEWS
11
NEWS
@@ -19,17 +19,18 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
*** Counterexamples
|
*** Counterexamples
|
||||||
|
|
||||||
Counterexamples now show the rule numbers:
|
Counterexamples now show the rule numbers, and always show ε for rules
|
||||||
|
with an empty right-hand side. For instance
|
||||||
|
|
||||||
exp
|
exp
|
||||||
↳ 1: "if" exp "then" exp
|
↳ 1: e1 e2 "a"
|
||||||
↳ 2: "if" exp "then" exp • "else" exp
|
↳ 3: ε • ↳ 1: ε
|
||||||
|
|
||||||
instead of
|
instead of
|
||||||
|
|
||||||
exp
|
exp
|
||||||
↳ "if" exp "then" exp
|
↳ e1 e2 "a"
|
||||||
↳ "if" exp "then" exp • "else" exp
|
↳ • ↳ ε
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 3.7.1 (2020-08-02) [stable]
|
* Noteworthy changes in release 3.7.1 (2020-08-02) [stable]
|
||||||
|
|||||||
@@ -10605,8 +10605,8 @@ This shows two separate derivations in the grammar for the same @code{exp}:
|
|||||||
given example. Here, the first derivation completes a reduction when seeing
|
given example. Here, the first derivation completes a reduction when seeing
|
||||||
@samp{/}, causing @samp{e1 + e2} to be grouped as an @code{exp}. The second
|
@samp{/}, causing @samp{e1 + e2} to be grouped as an @code{exp}. The second
|
||||||
derivation shifts on @samp{/}, resulting in @samp{e2 / e3} being grouped as
|
derivation shifts on @samp{/}, resulting in @samp{e2 / e3} being grouped as
|
||||||
an @code{exp}. Therefore, it is easy to see that adding @code{%precedence}
|
an @code{exp}. Therefore, it is easy to see that adding
|
||||||
directives would fix this conflict.
|
precedence/associativity directives would fix this conflict.
|
||||||
|
|
||||||
The remaining states are similar:
|
The remaining states are similar:
|
||||||
|
|
||||||
|
|||||||
@@ -245,6 +245,13 @@ derivation_width (const derivation *deriv)
|
|||||||
children_width += empty_width;
|
children_width += empty_width;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (gl_list_size (deriv->children) == 1
|
||||||
|
&& gl_list_get_first (deriv->children) == &d_dot)
|
||||||
|
{
|
||||||
|
children_width += empty_width;
|
||||||
|
children_width += derivation_separator_width;
|
||||||
|
}
|
||||||
|
|
||||||
derivation *child;
|
derivation *child;
|
||||||
for (gl_list_iterator_t it = gl_list_iterator (deriv->children);
|
for (gl_list_iterator_t it = gl_list_iterator (deriv->children);
|
||||||
derivation_list_next (&it, &child);
|
derivation_list_next (&it, &child);
|
||||||
@@ -310,6 +317,13 @@ derivation_print_tree_impl (const derivation *deriv, FILE *out,
|
|||||||
res += fputs_if (depth == 1, out, padding, empty);
|
res += fputs_if (depth == 1, out, padding, empty);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (gl_list_size (deriv->children) == 1
|
||||||
|
&& gl_list_get_first (deriv->children) == &d_dot)
|
||||||
|
{
|
||||||
|
res += fputs_if (depth == 1, out, padding, empty);
|
||||||
|
res += fputs_if (depth == 1, out, padding, derivation_separator);
|
||||||
|
}
|
||||||
|
|
||||||
bool first = true;
|
bool first = true;
|
||||||
derivation *child;
|
derivation *child;
|
||||||
for (gl_list_iterator_t it = gl_list_iterator (deriv->children);
|
for (gl_list_iterator_t it = gl_list_iterator (deriv->children);
|
||||||
|
|||||||
@@ -1776,7 +1776,7 @@ State 4
|
|||||||
Reduce derivation
|
Reduce derivation
|
||||||
start
|
start
|
||||||
`-> 1: resolved_conflict reported_conflicts 'a'
|
`-> 1: resolved_conflict reported_conflicts 'a'
|
||||||
`-> 10: .
|
`-> 10: %empty .
|
||||||
|
|
||||||
shift/reduce conflict on token 'a':
|
shift/reduce conflict on token 'a':
|
||||||
10 reported_conflicts: . %empty
|
10 reported_conflicts: . %empty
|
||||||
@@ -1790,7 +1790,7 @@ State 4
|
|||||||
Reduce derivation
|
Reduce derivation
|
||||||
start
|
start
|
||||||
`-> 1: resolved_conflict reported_conflicts 'a'
|
`-> 1: resolved_conflict reported_conflicts 'a'
|
||||||
`-> 10: .
|
`-> 10: %empty .
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1999,12 +1999,12 @@ AT_CHECK([[cat input.output | sed -n '/^State 0$/,/^State 1$/p']], 0,
|
|||||||
Example: . 'c'
|
Example: . 'c'
|
||||||
First reduce derivation
|
First reduce derivation
|
||||||
start
|
start
|
||||||
`-> 7: empty_c2 'c'
|
`-> 7: empty_c2 'c'
|
||||||
`-> 12: .
|
`-> 12: %empty .
|
||||||
Second reduce derivation
|
Second reduce derivation
|
||||||
start
|
start
|
||||||
`-> 8: empty_c3 'c'
|
`-> 8: empty_c3 'c'
|
||||||
`-> 13: .
|
`-> 13: %empty .
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -164,9 +164,9 @@ input.y: warning: shift/reduce conflict on token B [-Wcounterexamples]
|
|||||||
`-> 9: . B
|
`-> 9: . B
|
||||||
Reduce derivation
|
Reduce derivation
|
||||||
s
|
s
|
||||||
`-> 1: ax by
|
`-> 1: ax by
|
||||||
`-> 3: A x `-> 6: B y
|
`-> 3: A x `-> 6: B y
|
||||||
`-> 4: . `-> 6: %empty
|
`-> 4: %empty . `-> 6: %empty
|
||||||
input.y: warning: shift/reduce conflict on token B [-Wcounterexamples]
|
input.y: warning: shift/reduce conflict on token B [-Wcounterexamples]
|
||||||
First example: A X . B Y $end
|
First example: A X . B Y $end
|
||||||
Shift derivation
|
Shift derivation
|
||||||
@@ -178,11 +178,11 @@ input.y: warning: shift/reduce conflict on token B [-Wcounterexamples]
|
|||||||
Second example: A X . B y $end
|
Second example: A X . B y $end
|
||||||
Reduce derivation
|
Reduce derivation
|
||||||
$accept
|
$accept
|
||||||
`-> 0: s $end
|
`-> 0: s $end
|
||||||
`-> 1: ax by
|
`-> 1: ax by
|
||||||
`-> 3: A x `-> 6: B y
|
`-> 3: A x `-> 6: B y
|
||||||
`-> 5: X x
|
`-> 5: X x
|
||||||
`-> 4: .
|
`-> 4: %empty .
|
||||||
input.y:5.4-9: warning: rule useless in parser due to conflicts [-Wother]
|
input.y:5.4-9: warning: rule useless in parser due to conflicts [-Wother]
|
||||||
]],
|
]],
|
||||||
[[input.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
|
[[input.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
|
||||||
@@ -571,10 +571,10 @@ input.y: warning: reduce/reduce conflict on tokens b, c [-Wcounterexamples]
|
|||||||
Second reduce derivation
|
Second reduce derivation
|
||||||
S
|
S
|
||||||
`-> 1: B C
|
`-> 1: B C
|
||||||
`-> 7: A c A
|
`-> 7: A c A
|
||||||
`-> 3: B `-> 7: %empty
|
`-> 3: B `-> 7: %empty
|
||||||
`-> 6: A b A
|
`-> 6: A b A
|
||||||
`-> 5: . `-> 6: %empty
|
`-> 5: %empty . `-> 6: %empty
|
||||||
input.y: warning: reduce/reduce conflict on tokens b, c [-Wcounterexamples]
|
input.y: warning: reduce/reduce conflict on tokens b, c [-Wcounterexamples]
|
||||||
Example: C . c b
|
Example: C . c b
|
||||||
First reduce derivation
|
First reduce derivation
|
||||||
@@ -585,10 +585,10 @@ input.y: warning: reduce/reduce conflict on tokens b, c [-Wcounterexamples]
|
|||||||
Second reduce derivation
|
Second reduce derivation
|
||||||
S
|
S
|
||||||
`-> 2: C B
|
`-> 2: C B
|
||||||
`-> 6: A b A
|
`-> 6: A b A
|
||||||
`-> 4: C `-> 6: %empty
|
`-> 4: C `-> 6: %empty
|
||||||
`-> 7: A c A
|
`-> 7: A c A
|
||||||
`-> 5: . `-> 7: %empty
|
`-> 5: %empty . `-> 7: %empty
|
||||||
]],
|
]],
|
||||||
[[input.y: warning: 4 reduce/reduce conflicts [-Wconflicts-rr]
|
[[input.y: warning: 4 reduce/reduce conflicts [-Wconflicts-rr]
|
||||||
input.y: warning: reduce/reduce conflict on tokens b, c [-Wcounterexamples]
|
input.y: warning: reduce/reduce conflict on tokens b, c [-Wcounterexamples]
|
||||||
@@ -625,49 +625,49 @@ input.y: warning: reduce/reduce conflict on token A [-Wcounterexamples]
|
|||||||
First example: . c A A $end
|
First example: . c A A $end
|
||||||
First reduce derivation
|
First reduce derivation
|
||||||
$accept
|
$accept
|
||||||
`-> 0: a $end
|
`-> 0: a $end
|
||||||
`-> 1: b d
|
`-> 1: b d
|
||||||
`-> 3: . `-> 6: c A A
|
`-> 3: %empty . `-> 6: c A A
|
||||||
Second example: . c A A $end
|
Second example: . c A A $end
|
||||||
Second reduce derivation
|
Second reduce derivation
|
||||||
$accept
|
$accept
|
||||||
`-> 0: a $end
|
`-> 0: a $end
|
||||||
`-> 2: c d
|
`-> 2: c d
|
||||||
`-> 4: . `-> 6: c A A
|
`-> 4: %empty . `-> 6: c A A
|
||||||
input.y: warning: reduce/reduce conflict on token A [-Wcounterexamples]
|
input.y: warning: reduce/reduce conflict on token A [-Wcounterexamples]
|
||||||
time limit exceeded: XXX
|
time limit exceeded: XXX
|
||||||
First example: b . c A A $end
|
First example: b . c A A $end
|
||||||
First reduce derivation
|
First reduce derivation
|
||||||
$accept
|
$accept
|
||||||
`-> 0: a $end
|
`-> 0: a $end
|
||||||
`-> 1: b d
|
`-> 1: b d
|
||||||
`-> 5: a
|
`-> 5: a
|
||||||
`-> 1: b d
|
`-> 1: b d
|
||||||
`-> 3: . `-> 6: c A A
|
`-> 3: %empty . `-> 6: c A A
|
||||||
Second example: b . A $end
|
Second example: b . A $end
|
||||||
Second reduce derivation
|
Second reduce derivation
|
||||||
$accept
|
$accept
|
||||||
`-> 0: a $end
|
`-> 0: a $end
|
||||||
`-> 1: b d
|
`-> 1: b d
|
||||||
`-> 6: c A
|
`-> 6: c A
|
||||||
`-> 4: .
|
`-> 4: %empty .
|
||||||
input.y: warning: reduce/reduce conflict on token A [-Wcounterexamples]
|
input.y: warning: reduce/reduce conflict on token A [-Wcounterexamples]
|
||||||
time limit exceeded: XXX
|
time limit exceeded: XXX
|
||||||
First example: c . c A A $end
|
First example: c . c A A $end
|
||||||
First reduce derivation
|
First reduce derivation
|
||||||
$accept
|
$accept
|
||||||
`-> 0: a $end
|
`-> 0: a $end
|
||||||
`-> 2: c d
|
`-> 2: c d
|
||||||
`-> 5: a
|
`-> 5: a
|
||||||
`-> 1: b d
|
`-> 1: b d
|
||||||
`-> 3: . `-> 6: c A A
|
`-> 3: %empty . `-> 6: c A A
|
||||||
Second example: c . A $end
|
Second example: c . A $end
|
||||||
Second reduce derivation
|
Second reduce derivation
|
||||||
$accept
|
$accept
|
||||||
`-> 0: a $end
|
`-> 0: a $end
|
||||||
`-> 2: c d
|
`-> 2: c d
|
||||||
`-> 6: c A
|
`-> 6: c A
|
||||||
`-> 4: .
|
`-> 4: %empty .
|
||||||
input.y: warning: shift/reduce conflict on token A [-Wcounterexamples]
|
input.y: warning: shift/reduce conflict on token A [-Wcounterexamples]
|
||||||
time limit exceeded: XXX
|
time limit exceeded: XXX
|
||||||
First example: b c . A
|
First example: b c . A
|
||||||
@@ -678,33 +678,33 @@ time limit exceeded: XXX
|
|||||||
Second example: b c . c A A $end
|
Second example: b c . c A A $end
|
||||||
Reduce derivation
|
Reduce derivation
|
||||||
$accept
|
$accept
|
||||||
`-> 0: a $end
|
`-> 0: a $end
|
||||||
`-> 1: b d
|
`-> 1: b d
|
||||||
`-> 5: a
|
`-> 5: a
|
||||||
`-> 2: c d
|
`-> 2: c d
|
||||||
`-> 5: a
|
`-> 5: a
|
||||||
`-> 1: b d
|
`-> 1: b d
|
||||||
`-> 3: . `-> 6: c A A
|
`-> 3: %empty . `-> 6: c A A
|
||||||
input.y: warning: reduce/reduce conflict on token A [-Wcounterexamples]
|
input.y: warning: reduce/reduce conflict on token A [-Wcounterexamples]
|
||||||
First example: b c . c A A $end
|
First example: b c . c A A $end
|
||||||
First reduce derivation
|
First reduce derivation
|
||||||
$accept
|
$accept
|
||||||
`-> 0: a $end
|
`-> 0: a $end
|
||||||
`-> 1: b d
|
`-> 1: b d
|
||||||
`-> 5: a
|
`-> 5: a
|
||||||
`-> 2: c d
|
`-> 2: c d
|
||||||
`-> 5: a
|
`-> 5: a
|
||||||
`-> 1: b d
|
`-> 1: b d
|
||||||
`-> 3: . `-> 6: c A A
|
`-> 3: %empty . `-> 6: c A A
|
||||||
Second example: b c . A $end
|
Second example: b c . A $end
|
||||||
Second reduce derivation
|
Second reduce derivation
|
||||||
$accept
|
$accept
|
||||||
`-> 0: a $end
|
`-> 0: a $end
|
||||||
`-> 1: b d
|
`-> 1: b d
|
||||||
`-> 5: a
|
`-> 5: a
|
||||||
`-> 2: c d
|
`-> 2: c d
|
||||||
`-> 6: c A
|
`-> 6: c A
|
||||||
`-> 4: .
|
`-> 4: %empty .
|
||||||
input.y: warning: shift/reduce conflict on token A [-Wcounterexamples]
|
input.y: warning: shift/reduce conflict on token A [-Wcounterexamples]
|
||||||
First example: b c . A
|
First example: b c . A
|
||||||
Shift derivation
|
Shift derivation
|
||||||
@@ -714,12 +714,12 @@ input.y: warning: shift/reduce conflict on token A [-Wcounterexamples]
|
|||||||
Second example: b c . A $end
|
Second example: b c . A $end
|
||||||
Reduce derivation
|
Reduce derivation
|
||||||
$accept
|
$accept
|
||||||
`-> 0: a $end
|
`-> 0: a $end
|
||||||
`-> 1: b d
|
`-> 1: b d
|
||||||
`-> 5: a
|
`-> 5: a
|
||||||
`-> 2: c d
|
`-> 2: c d
|
||||||
`-> 6: c A
|
`-> 6: c A
|
||||||
`-> 4: .
|
`-> 4: %empty .
|
||||||
input.y: warning: reduce/reduce conflict on token $end [-Wcounterexamples]
|
input.y: warning: reduce/reduce conflict on token $end [-Wcounterexamples]
|
||||||
Example: b d .
|
Example: b d .
|
||||||
First reduce derivation
|
First reduce derivation
|
||||||
@@ -861,10 +861,10 @@ input.y: warning: shift/reduce conflict on token D [-Wcounterexamples]
|
|||||||
`-> 6: . D
|
`-> 6: . D
|
||||||
Reduce derivation
|
Reduce derivation
|
||||||
s
|
s
|
||||||
`-> 2: A a a d
|
`-> 2: A a a d
|
||||||
`-> 3: b `-> 6: D
|
`-> 3: b `-> 6: D
|
||||||
`-> 4: c
|
`-> 4: c
|
||||||
`-> 5: .
|
`-> 5: %empty .
|
||||||
]],
|
]],
|
||||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||||
input.y: warning: shift/reduce conflict on token D [-Wcounterexamples]
|
input.y: warning: shift/reduce conflict on token D [-Wcounterexamples]
|
||||||
@@ -905,11 +905,11 @@ input.y: warning: shift/reduce conflict on token D [-Wcounterexamples]
|
|||||||
Second example: A a . D E $end
|
Second example: A a . D E $end
|
||||||
Reduce derivation
|
Reduce derivation
|
||||||
$accept
|
$accept
|
||||||
`-> 0: s $end
|
`-> 0: s $end
|
||||||
`-> 2: A a a d E
|
`-> 2: A a a d E
|
||||||
`-> 3: b `-> 6: D
|
`-> 3: b `-> 6: D
|
||||||
`-> 4: c
|
`-> 4: c
|
||||||
`-> 5: .
|
`-> 5: %empty .
|
||||||
]],
|
]],
|
||||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||||
input.y: warning: shift/reduce conflict on token D [-Wcounterexamples]
|
input.y: warning: shift/reduce conflict on token D [-Wcounterexamples]
|
||||||
|
|||||||
@@ -532,9 +532,58 @@ exp
|
|||||||
exp
|
exp
|
||||||
: "if" exp "then" exp
|
: "if" exp "then" exp
|
||||||
| "if" exp "then" exp "else" exp
|
| "if" exp "then" exp "else" exp
|
||||||
|
| exp "+" exp
|
||||||
|
| "num"
|
||||||
|
| empty "a"
|
||||||
|
| "a" empty
|
||||||
|
|
||||||
empty
|
empty
|
||||||
: %empty
|
: %empty
|
||||||
]],
|
]],
|
||||||
|
[1],
|
||||||
|
[[input.y: <error>error:</error> shift/reduce conflicts: 9 found, 0 expected
|
||||||
|
input.y: <warning>warning:</warning> shift/reduce conflict on token "a" [<warning>-Wcounterexamples</warning>]
|
||||||
|
Example: <cex-0><cex-dot>•</cex-dot> <cex-leaf>"a"</cex-leaf><cex-1></cex-1></cex-0>
|
||||||
|
Shift derivation
|
||||||
|
<cex-0><cex-step>exp</cex-step></cex-0>
|
||||||
|
<cex-0><cex-step>↳ 6: <cex-dot>•</cex-dot><cex-leaf> "a"</cex-leaf><cex-1><cex-step> empty</cex-step></cex-1></cex-step></cex-0>
|
||||||
|
<cex-1><cex-step> ↳ 6: ε</cex-step></cex-1>
|
||||||
|
Example: <cex-0><cex-1><cex-dot>•</cex-dot></cex-1> <cex-leaf>"a"</cex-leaf></cex-0>
|
||||||
|
Reduce derivation
|
||||||
|
<cex-0><cex-step>exp</cex-step></cex-0>
|
||||||
|
<cex-0><cex-step>↳ 5: <cex-1><cex-step>empty</cex-step></cex-1><cex-leaf> "a"</cex-leaf></cex-step></cex-0>
|
||||||
|
<cex-1><cex-step> ↳ 7: ε<cex-dot> •</cex-dot></cex-step></cex-1>
|
||||||
|
input.y: <warning>warning:</warning> shift/reduce conflict on token "a" [<warning>-Wcounterexamples</warning>]
|
||||||
|
Example: <cex-0><cex-dot>•</cex-dot> <cex-leaf>"a"</cex-leaf><cex-1></cex-1></cex-0>
|
||||||
|
Shift derivation
|
||||||
|
<cex-0><cex-step>exp</cex-step></cex-0>
|
||||||
|
<cex-0><cex-step>↳ 6: <cex-dot>•</cex-dot><cex-leaf> "a"</cex-leaf><cex-1><cex-step> empty</cex-step></cex-1></cex-step></cex-0>
|
||||||
|
<cex-1><cex-step> ↳ 6: ε</cex-step></cex-1>
|
||||||
|
Example: <cex-0><cex-1><cex-dot>•</cex-dot></cex-1> <cex-leaf>"a"</cex-leaf></cex-0>
|
||||||
|
Reduce derivation
|
||||||
|
<cex-0><cex-step>exp</cex-step></cex-0>
|
||||||
|
<cex-0><cex-step>↳ 5: <cex-1><cex-step>empty</cex-step></cex-1><cex-leaf> "a"</cex-leaf></cex-step></cex-0>
|
||||||
|
<cex-1><cex-step> ↳ 7: ε<cex-dot> •</cex-dot></cex-step></cex-1>
|
||||||
|
input.y: <warning>warning:</warning> shift/reduce conflict on token "a" [<warning>-Wcounterexamples</warning>]
|
||||||
|
Example: <cex-0><cex-dot>•</cex-dot> <cex-leaf>"a"</cex-leaf><cex-1></cex-1></cex-0>
|
||||||
|
Shift derivation
|
||||||
|
<cex-0><cex-step>exp</cex-step></cex-0>
|
||||||
|
<cex-0><cex-step>↳ 6: <cex-dot>•</cex-dot><cex-leaf> "a"</cex-leaf><cex-1><cex-step> empty</cex-step></cex-1></cex-step></cex-0>
|
||||||
|
<cex-1><cex-step> ↳ 6: ε</cex-step></cex-1>
|
||||||
|
Example: <cex-0><cex-1><cex-dot>•</cex-dot></cex-1> <cex-leaf>"a"</cex-leaf></cex-0>
|
||||||
|
Reduce derivation
|
||||||
|
<cex-0><cex-step>exp</cex-step></cex-0>
|
||||||
|
<cex-0><cex-step>↳ 5: <cex-1><cex-step>empty</cex-step></cex-1><cex-leaf> "a"</cex-leaf></cex-step></cex-0>
|
||||||
|
<cex-1><cex-step> ↳ 7: ε<cex-dot> •</cex-dot></cex-step></cex-1>
|
||||||
|
input.y: <warning>warning:</warning> shift/reduce conflict on token "a" [<warning>-Wcounterexamples</warning>]
|
||||||
|
Example: <cex-0><cex-dot>•</cex-dot> <cex-leaf>"a"</cex-leaf><cex-1></cex-1></cex-0>
|
||||||
|
Shift derivation
|
||||||
|
<cex-0><cex-step>exp</cex-step></cex-0>
|
||||||
|
<cex-0><cex-step>↳ 6: <cex-dot>•</cex-dot><cex-leaf> "a"</cex-leaf><cex-1><cex-step> empty</cex-step></cex-1></cex-step></cex-0>
|
||||||
|
<cex-1><cex-step> ↳ 6: ε</cex-step></cex-1>
|
||||||
|
Example: <cex-0><cex-1><cex-dot>•</cex-dot></cex-1> <cex-leaf>"a"</cex-leaf></cex-0>
|
||||||
|
Reduce derivation
|
||||||
|
<cex-0><cex-step>exp</cex-step></cex-0>
|
||||||
<cex-0><cex-step>↳ 5: <cex-1><cex-step>empty</cex-step></cex-1><cex-leaf> "a"</cex-leaf></cex-step></cex-0>
|
<cex-0><cex-step>↳ 5: <cex-1><cex-step>empty</cex-step></cex-1><cex-leaf> "a"</cex-leaf></cex-step></cex-0>
|
||||||
<cex-1><cex-step> ↳ 7: ε<cex-dot> •</cex-dot></cex-step></cex-1>
|
<cex-1><cex-step> ↳ 7: ε<cex-dot> •</cex-dot></cex-step></cex-1>
|
||||||
input.y: <warning>warning:</warning> shift/reduce conflict on token "+" [<warning>-Wcounterexamples</warning>]
|
input.y: <warning>warning:</warning> shift/reduce conflict on token "+" [<warning>-Wcounterexamples</warning>]
|
||||||
@@ -568,6 +617,17 @@ input.y: <warning>warning:</warning> shift/reduce conflict on token "+" [<warnin
|
|||||||
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>
|
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
|
Reduce derivation
|
||||||
<cex-0><cex-step>exp</cex-step></cex-0>
|
<cex-0><cex-step>exp</cex-step></cex-0>
|
||||||
|
<cex-0><cex-step>↳ 3: <cex-1><cex-step>exp</cex-step></cex-1><cex-leaf> "+"</cex-leaf><cex-leaf> exp</cex-leaf></cex-step></cex-0>
|
||||||
|
<cex-1><cex-step> ↳ 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-step></cex-1>
|
||||||
|
input.y: <warning>warning:</warning> shift/reduce conflict on token "a" [<warning>-Wcounterexamples</warning>]
|
||||||
|
Example: <cex-0><cex-dot>•</cex-dot> <cex-leaf>"a"</cex-leaf><cex-1></cex-1></cex-0>
|
||||||
|
Shift derivation
|
||||||
|
<cex-0><cex-step>exp</cex-step></cex-0>
|
||||||
|
<cex-0><cex-step>↳ 6: <cex-dot>•</cex-dot><cex-leaf> "a"</cex-leaf><cex-1><cex-step> empty</cex-step></cex-1></cex-step></cex-0>
|
||||||
|
<cex-1><cex-step> ↳ 6: ε</cex-step></cex-1>
|
||||||
|
Example: <cex-0><cex-1><cex-dot>•</cex-dot></cex-1> <cex-leaf>"a"</cex-leaf></cex-0>
|
||||||
|
Reduce derivation
|
||||||
|
<cex-0><cex-step>exp</cex-step></cex-0>
|
||||||
<cex-0><cex-step>↳ 5: <cex-1><cex-step>empty</cex-step></cex-1><cex-leaf> "a"</cex-leaf></cex-step></cex-0>
|
<cex-0><cex-step>↳ 5: <cex-1><cex-step>empty</cex-step></cex-1><cex-leaf> "a"</cex-leaf></cex-step></cex-0>
|
||||||
<cex-1><cex-step> ↳ 7: ε<cex-dot> •</cex-dot></cex-step></cex-1>
|
<cex-1><cex-step> ↳ 7: ε<cex-dot> •</cex-dot></cex-step></cex-1>
|
||||||
input.y: <warning>warning:</warning> shift/reduce conflict on token "+" [<warning>-Wcounterexamples</warning>]
|
input.y: <warning>warning:</warning> shift/reduce conflict on token "+" [<warning>-Wcounterexamples</warning>]
|
||||||
|
|||||||
Reference in New Issue
Block a user