mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
cex: also include the counterexamples in the report
The report is the best place to show the details about
counterexamples, since we have the state right under the nose.
For instance:
State 7
1 exp: exp . "⊕" exp
2 | exp . "+" exp
2 | exp "+" exp . [$end, "+", "⊕"]
3 | exp . "+" exp
3 | exp "+" exp . [$end, "+", "⊕"]
"⊕" shift, and go to state 6
$end reduce using rule 2 (exp)
$end [reduce using rule 3 (exp)]
"+" reduce using rule 2 (exp)
"+" [reduce using rule 3 (exp)]
"⊕" [reduce using rule 2 (exp)]
"⊕" [reduce using rule 3 (exp)]
$default reduce using rule 2 (exp)
Conflict between rule 2 and token "+" resolved as reduce (%left "+").
Shift/reduce conflict on token "⊕":
2 exp: exp "+" exp .
1 exp: exp . "⊕" exp
Example exp "+" exp • "⊕" exp
First derivation exp ::=[ exp ::=[ exp "+" exp • ] "⊕" exp ]
Example exp "+" exp • "⊕" exp
Second derivation exp ::=[ exp "+" exp ::=[ exp • "⊕" exp ] ]
Reduce/reduce conflict on tokens $end, "+", "⊕":
2 exp: exp "+" exp .
3 exp: exp "+" exp .
Example exp "+" exp •
First derivation exp ::=[ exp "+" exp • ]
Example exp "+" exp •
Second derivation exp ::=[ exp "+" exp • ]
Shift/reduce conflict on token "⊕":
3 exp: exp "+" exp .
1 exp: exp . "⊕" exp
Example exp "+" exp • "⊕" exp
First derivation exp ::=[ exp ::=[ exp "+" exp • ] "⊕" exp ]
Example exp "+" exp • "⊕" exp
Second derivation exp ::=[ exp "+" exp ::=[ exp • "⊕" exp ] ]
* src/conflicts.h, src/conflicts.c (has_conflicts): New.
* src/counterexample.h, src/counterexample.c (print_counterexample):
Add a `prefix` argument.
(counterexample_report_shift_reduce)
(counterexample_report_reduce_reduce): Show the items when there's a
prefix.
* src/state-item.h, src/state-item.c (print_state_item):
Add a `prefix` argument.
* src/derivation.h, src/derivation.c (derivation_print)
(derivation_print_leaves): Add a prefix argument.
* src/print.c (print_state): When -Wcex is enabled, show the
conflicts.
* tests/report.at: Adjust.
This commit is contained in:
20
TODO
20
TODO
@@ -1,5 +1,6 @@
|
||||
* Bison 3.7
|
||||
** Cex
|
||||
*** Improve gnulib
|
||||
Don't do this (counterexample.c):
|
||||
|
||||
// This is the fastest way to get the tail node from the gl_list API.
|
||||
@@ -12,6 +13,25 @@ list_get_end (gl_list_t list)
|
||||
return res;
|
||||
}
|
||||
|
||||
*** Ambiguous rewriting
|
||||
If the user is stupid enough to have equal rules, then the derivations are
|
||||
harder to read:
|
||||
|
||||
Reduce/reduce conflict on tokens $end, "+", "⊕":
|
||||
2 exp: exp "+" exp .
|
||||
3 exp: exp "+" exp .
|
||||
Example exp "+" exp •
|
||||
First derivation exp ::=[ exp "+" exp • ]
|
||||
Example exp "+" exp •
|
||||
Second derivation exp ::=[ exp "+" exp • ]
|
||||
|
||||
Do we care about this? In color, we use twice the same color here, but we
|
||||
could try to use the same color for the same rule.
|
||||
|
||||
*** XML reports
|
||||
Show the counterexamples. This is going to be really hard and/or painful.
|
||||
Unless we play it dumb (little structure).
|
||||
|
||||
** glr.cc
|
||||
Get rid of global_tokens_and_yystype.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user