Akim Demaille 588db0a892 Remove the useless rules from the parser.
* src/gram.h, src/gram.c (rules_swap, rule_rhs_length): New.
(ritem_longest_rhs): Use the latter.
* 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.
Changes in version 1.49a:
* False `Token not used' report fixed.
On a grammar such as
/* Allocate input grammar variables for bison,
This file is part of Bison, the GNU Compiler Compiler.
int error_token_number;
/*------------------------.
| Dump RITEM for traces.  |
`------------------------*/
size_t
ritem_longest_rhs (void)
{
int i;
return max;
}
typedef struct rule_s
{
short lhs;
short *rhs;
short prec;
extern int error_token_number;
/* Dump RITEM for traces. */
void ritem_print PARAMS ((FILE *out));
fprintf (out, "%snn", _("Grammar"));
fprintf (out, "  %sn", _("Number, Line, Rule"));
for (i = 1; i < nrules + 1; i++)
fputs ("nn", out);
while (p)
{
bucket *ruleprec = p->ruleprec;
rules[ruleno].lhs = p->sym->number;
rules[ruleno].rhs = ritem + itemno;
rules[ruleno].line = p->line;
bitset_set (V1, rules[i].precsym);
}
static void
reduce_grammar_tables (void)
{
if (nuseless_productions > 0)
{
int pn;
for (pn = 1; pn < nrules + 1; pn++)
rules[pn].useful = bitset_test (P, pn);
}
}
{
int i;
fprintf (out, "%snn", _("Useless rules:"));
fputs ("nn", out);
}
}
fprintf (out, "nn");
fprintf (out, "Rulesn-----nn");
fprintf (out, "Num (Prec, Assoc, Useful, Ritem Range) Lhs -> Rhs (Ritem range) [Num]n");
{
int rhs_count = 0;
/* Find the last RHS index in ritems. */
}
fprintf (out, "nn");
fprintf (out, "Rules interpretedn-----------------nn");
{
fprintf (out, "%-5d  %s :", i, symbols[rules[i].lhs]->tag);
for (r = rules[i].rhs; *r >= 0; r++)
## ------------------- ##
## Underivable Rules.  ##
## ------------------- ##
2002-04-07 16:28:39 +00:00
2002-03-14 18:31:14 +00:00
2001-08-25 13:13:14 +00:00
2002-03-14 18:31:14 +00:00
2002-03-14 18:31:14 +00:00
2002-04-07 16:13:46 +00:00
2002-03-19 08:16:25 +00:00
2001-10-10 15:29:08 +00:00
1998-11-25 22:13:23 +00:00
1992-09-25 22:06:24 +00:00
2002-03-20 22:46:59 +00:00
2002-03-20 07:01:15 +00:00
2001-10-04 14:55:21 +00:00
2000-10-02 20:00:35 +00:00
2001-01-17 11:11:01 +00:00
1987-12-16 06:53:07 +00:00
1998-11-25 21:36:05 +00:00
2002-03-06 16:08:18 +00:00
2002-04-07 15:30:07 +00:00

This directory contains the Bison parser generator.

See the file INSTALL for compilation and installation instructions.
See the file doc/FAQ for frequently asked questions.

It was once true that, when installing Bison on Sequent (or Pyramid?)
systems, you had to be in the Berkeley universe.  This may no longer
be true; we have no way to tell.

On VMS, you will probably have to create Makefile from Makefile.in by
hand.  Remember to do `SET COMMAND BISON' to install the data in
`BISON.CLD'.

VMS and MS-DOS builds are probably broken right now.  If you are able
to build Bison on either platform and you need to make changes to do
so, please submit those changes as a bug report.

Send bug reports to bug-bison@gnu.org.  Please include the version
number from `bison --version', and a complete, self-contained test
case in each bug report.

If you have questions about using Bison which the documentation does
not answer, send mail to help-bison@gnu.org.

Description
No description provided
Readme 18 MiB
Languages
C 61%
M4 11.7%
C++ 11.3%
Shell 4.1%
XSLT 3.1%
Other 8.8%