mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-14 06:43:03 +00:00
gram: detect and report (in debug traces) useless chain rules
A rule is a useless chain iff it's a chain (aka unit, or injection) rule (i.e., the RHS has length 1), and it's useless (it has no used defined semantic action). * src/gram.h, src/gram.c (rule_useless_chain_p): New. (grammar_dump): Report useless chain rules. * tests/sets.at: Check the traces.
This commit is contained in:
@@ -337,12 +337,12 @@ Rules
|
||||
-----
|
||||
|
||||
Num (Num, Prec, Assoc, Useful, UselessChain, Ritem Range) Lhs -> Rhs (Ritem range)
|
||||
0 ( 0, 0, 0, t, 0- 1) 6 -> 7 0
|
||||
1 ( 1, 0, 0, t, 3- 5) 7 -> 7 3 8
|
||||
2 ( 2, 0, 0, t, 7- 7) 7 -> 8
|
||||
3 ( 3, 0, 0, t, 9-11) 8 -> 8 4 9
|
||||
4 ( 4, 0, 0, t, 13-13) 8 -> 9
|
||||
5 ( 5, 0, 0, t, 15-15) 9 -> 5
|
||||
0 ( 0, 0, 0, t, f, 0- 1) 6 -> 7 0
|
||||
1 ( 1, 0, 0, t, f, 3- 5) 7 -> 7 3 8
|
||||
2 ( 2, 0, 0, t, t, 7- 7) 7 -> 8
|
||||
3 ( 3, 0, 0, t, f, 9-11) 8 -> 8 4 9
|
||||
4 ( 4, 0, 0, t, t, 13-13) 8 -> 9
|
||||
5 ( 5, 0, 0, t, t, 15-15) 9 -> 5
|
||||
|
||||
|
||||
Rules interpreted
|
||||
|
||||
Reference in New Issue
Block a user