Akim Demaille
c3b407f430
* src/gram.h, src/gram.c (rules_rhs_length): New.
...
(ritem_longest_rhs): Use it.
* src/gram.h (rule_t): `number' is a new member.
* src/reader.c (packgram): Set it.
* src/reduce.c (reduce_grammar_tables): Move the useless rules at
the end of `rules', and count them out of `nrules'.
(reduce_output, dump_grammar): Adjust.
* src/print.c (print_grammar): It is no longer needed to check for
the usefulness of a rule, as useless rules are beyond `nrules + 1'.
* tests/reduce.at (Reduced Automaton): New test.
2002-04-07 17:36:38 +00:00
Akim Demaille
7d13ff5f2f
* tests/reduce.at (Useless Nonterminals): Fix.
2001-11-30 11:15:02 +00:00
Akim Demaille
68f1e3edc3
Instead of mapping the LHS of unused rules to -1, keep the LHS
...
valid, but flag the rules as invalid.
* src/gram.h (rule_t): `useful' is a new member.
* src/print.c (print_grammar): Adjust.
* src/derives.c (set_derives): Likewise.
* src/reader.c (packgram, reduce_output): Likewise.
* src/reduce.c (reduce_grammar_tables): Likewise.
* tests/reduce.at (Underivable Rules, Useless Rules): New.
2001-11-30 10:49:24 +00:00
Akim Demaille
d2d1b42b07
* src/reduce.c (reduce_output): Formatting changes.
...
* src/print.c (print_results, print_grammar): Likewise.
* tests/regression.at (Rule Line Numbers)
(Solved SR Conflicts, Unresolved SR Conflicts): Adjust.
2001-11-30 10:49:01 +00:00
Akim Demaille
760b53a84b
* src/reduce.c (nonterminals_reduce): Instead of throwing away
...
useless nonterminals, move them at the end of the symbol arrays.
(reduce_output): Adjust.
* tests/reduce.at (Useless Nonterminals): Adjust.
2001-11-30 10:48:14 +00:00
Akim Demaille
cb4956ee99
* tests/reduce.at (Useless Terminals, Useless Nonterminals): New.
...
* src/reduce.c (reduce_grammar_tables): Do not free useless tags,
as all tags are free'ed afterwards.
From Enrico Scholz.
2001-11-28 11:43:24 +00:00