Commit Graph

603 Commits

Author SHA1 Message Date
Akim Demaille
c307773eec Fix big patch application problems. 2002-04-07 16:42:32 +00:00
Akim Demaille
a31932aa0b * src/gram.h, src/gram.c (rules_swap): 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 16:39:49 +00:00
Akim Demaille
aa96fda183 * src/output.c (output_rule_data): Fix various range errors:
`rules' starts at 1, not 0.
2002-04-07 16:29:32 +00:00
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
Akim Demaille
11652ab3dc * src/reduce.c (inaccessable_symbols): Fix a buglet: because of a
lacking `+ 1' to nrules, Bison reported as useless a token if it
was used solely to set the precedence of the last rule...
2002-04-07 15:30:42 +00:00
Akim Demaille
26b23c1a49 * data/bison.c++, data/bison.simple: Don't output the current file
name in #line, to avoid useless diffs between two identical
outputs under different names.
2002-04-07 15:30:31 +00:00
Akim Demaille
18bcecb07d * src/closure.c, src/print.c, src/reader.c, src/reduce.c:
Normalize loops to using `< nrules + 1', not `<= nrules'.
2002-04-07 15:30:20 +00:00
Akim Demaille
fa770c8662 * TODO: Update. 2002-04-07 15:30:07 +00:00
Akim Demaille
d9b739c32f * src/output.c, src/reader.c, src/symtab.c, src/symtab.h: Rename
bucket.value as bucket.number.
2002-04-07 15:29:56 +00:00
Akim Demaille
9901390012 * src/closure.c, src/derives.c, src/gram.h, src/lalr.c,
* src/nullable.c, src/output.c, src/print.c, src/print_graph.c,
* src/reader.c, src/reduce.c: Let rule_t.rhs point directly to the
RHS, instead of being an index in RITEMS.
2002-04-07 15:29:36 +00:00
Paul Eggert
e966383bf4 * doc/bison.texinfo: Update copyright date.
(Rpcalc Lexer, Symbols, Token Decl): Don't assume ASCII.
(Symbols): Warn about running Bison in one character set,
but compiling and/or running in an incompatible one.
Warn about character code 256, too.
2002-04-04 21:34:34 +00:00
Paul Eggert
8d6c48b983 Merge fixes from Debian bison_1.34-1.diff.
* configure.in (AC_PREREQ): 2.53.
2002-03-20 22:47:21 +00:00
Akim Demaille
e53c632297 * src/conflicts.c (log_resolution): Argument `resolution' is const. 2002-03-20 09:35:27 +00:00
Paul Eggert
21db0b2a65 * src/bison.simple (YYCOPY): New macro.
(YYSTACK_RELOCATE): Use it.
Remove Type arg; no longer needed.  All callers changed.
(yymemcpy): Remove; no longer needed.
2002-03-20 07:30:00 +00:00
Paul Eggert
9ffbeca717 * Makefile.am (AUTOMAKE_OPTIONS): 1.6.
* doc/Makefile.am (AUTOMAKE_OPTIONS): Remove.
2002-03-20 07:03:00 +00:00
Akim Demaille
642cb8f829 Test and fix the #line outputs.
* tests/atlocal.at (GCC): New.
* tests/synclines.at (AT_TEST_SYNCLINE): New macro.
(Prologue synch line, ,%union synch line, Postprologue synch line)
(Action synch line, Epilogue synch line): New tests.
* src/reader.c (parse_union_decl): Define the muscle stype_line.
* data/bison.simple, data/bison.c++: Use it.
2002-03-19 08:16:25 +00:00
Akim Demaille
3c31a486e7 * tests/regression.at (%nonassoc and eof, Unresolved SR Conflicts)
(Solved SR Conflicts, %expect not enough, %expect right)
(%expect too much): Move to...
* tests/conflicts.at: this new file.
2002-03-19 08:10:21 +00:00
Akim Demaille
0d8bed5636 * data/m4sugar/m4sugar.m4: Update from CVS Autoconf.
* data/bison.simple, data/bison.c++: Handle the `#define' part, so
that we can move to enums for instance.
* src/output.c (token_definitions_output): Output a list of
`token-name, token-number' instead of the #define.
(output_skeleton): Name this list `b4_tokens', not `b4_tokendefs'.
2002-03-19 07:48:47 +00:00
Akim Demaille
9208d17fa9 Use Gettext 0.11.1. 2002-03-14 18:31:14 +00:00
Robert Anisko
af27eacb6a * data/bison.c++: Make the user able to add members to the generated
parser by subclassing.
2002-03-09 14:31:16 +00:00
Robert Anisko
9101a31079 * src/reader.c (read_additionnal_code): `c' should be an integer, not
a character.
Reported by Nicolas Tisserand and Nicolas Burrus.
2002-03-05 18:30:22 +00:00
Akim Demaille
c3937ec780 Remove Id line. 2002-03-04 17:05:26 +00:00
Robert Anisko
fff9bf0b8d * src/reader.c: Warn about lacking semi-colons, do not complain. 2002-03-04 17:03:49 +00:00
Robert Anisko
64dba31e7f * data/bison.c++: Remove a debug line. 2002-03-04 16:48:33 +00:00
Robert Anisko
374f5a14de * data/bison.c++: Unmerge value as yylval and value as yyval. Unmerge
location as yylloc and location as yyloc.  Use YYLLOC_DEFAULT, and
provide a default implementation.
2002-03-04 16:37:52 +00:00
Akim Demaille
bfcf1f3af0 * tests/input.at (Invalid $n, Invalid @n): Add the ending `;'.
* tests/output.at (AT_CHECK_OUTPUT): Likewise.
* tests/headers.at (AT_TEST_CPP_GUARD_H): Ditto.
* tests/semantic.at (Parsing Guards): Similarly.
* src/reader.at (readgram): Complain if the last rule is not ended
with a semi-colon.
2002-03-04 16:23:35 +00:00
Akim Demaille
65ccf9fc1d * src/warshall.h, src/warshall.c (bitmatrix_print): Move to...
* src/closure.c: here.
(set_firsts): Use bitsetv_reflexive_transitive_closure instead of
RTC.
* src/warshall.h, src/warshall.c: Remove.
* tests/sets.at (Broken Closure): Adjust.
2002-03-04 14:29:27 +00:00
Akim Demaille
d0039cbcf8 * src/output.c (output_skeleton): tempdir is const.
bytes_read is unused.
2002-03-04 14:17:30 +00:00
Akim Demaille
345cea780a * lib/bbitset.h, lib/bitset.c, lib/bitset.h, lib/bitsetv.c,
* lib/bitsetv.h, lib/ebitset.c, lib/lbitset.c, lib/sbitset.c:
Update.
From Michael Hayes.
2002-03-04 14:15:01 +00:00
Akim Demaille
564801f795 * src/closure.c (closure): `r' is unused. 2002-03-04 14:13:12 +00:00
Akim Demaille
b23e820381 Regen. 2002-03-04 14:04:09 +00:00
Akim Demaille
e5352bc7bf * tests/sets.at (Broken Closure): Add the ending `;'.
* src/reader.at (readgram): Complain if a rule is not ended with a
semi-colon.
2002-03-04 13:58:20 +00:00
Akim Demaille
914feea9d0 * src/conflicts.c (set_conflicts): Use bitset_disjoint_p.
(count_sr_conflicts): Use bitset_count.
* src/reduce.c (inaccessable_symbols): Ditto.
(bits_size): Remove.
* src/warshall.h, src/warshall.c: Convert to bitsetv.
2002-03-04 13:58:05 +00:00
Akim Demaille
f0250de62e * src/closure.c, src/conflicts.c, src/lalr.c, src/print.c,
* src/reduce.c: Remove the `bitset_zero's following the
`bitset_create's, as now it is performed by the latter.
2002-03-04 13:56:41 +00:00
Akim Demaille
ef01750240 * lib/bitset.c, lib/bitset.h, lib/bitsetv.c, lib/bitsetv.h,
* lib/ebitset.c, lib/ebitset.h, lib/lbitset.c, lib/lbitset.h,
* lib/sbitset.c, lib/sbitset.h, lib/bbitset.h: Update from the
latest sources from Michael.
2002-03-04 12:07:08 +00:00
Akim Demaille
7651439487 * src/output.c (output): Don't free the grammar.
* src/reader.c (grammar_free): New.
* src/main.c (main): Call it and don't free symtab here.
2002-03-04 12:06:42 +00:00
Akim Demaille
550245801e * src/lex.c (parse_percent_token): Be sure to 0-end token_buffer
before returning.
Reported by Benoit Perrot.
2002-03-04 12:06:07 +00:00
Akim Demaille
f9abaa2c4c Use bitset operations when possible, not loops over bits.
* src/conflicts.c (set_conflicts, count_sr_conflicts): Use
bitset_or.
* src/print.c (print_reductions): Use bitset_and, bitset_andn.
* src/reduce.c (useless_nonterminals): Formatting changes.
* src/warshall.c (TC): Use bitset_or.
2002-03-04 12:05:30 +00:00
Akim Demaille
0e721e7569 * src/lalr.h, src/lalr.c (tokensetsize): Remove, unused.
* src/system.h (BITS_PER_WORD, WORDSIZE, SETBIT, RESETBIT, BITISSET):
Ditto.
2002-03-04 12:05:15 +00:00
Akim Demaille
0fb1ffb1bf * src/lalr.c (F): Now a bitset*.
Adjust all dependencies.
2002-03-04 12:04:47 +00:00
Akim Demaille
b86796bf87 * src/conflicts.c (shiftset, lookaheadset): Now bitset.
Adjust all dependencies.
2002-03-04 12:04:33 +00:00
Akim Demaille
602bbf31c1 * src/L0.c, src/LR0.h (nstates): Be size_t.
Adjust comparisons (signed vs unsigned).
* src/conflics.c, src/lalr.c, src/lalr.h, src/output.c (LA): Now a
bitset*.
Adjust all dependencies.
2002-03-04 12:03:36 +00:00
Akim Demaille
d8a0245ce7 * src/closure.c (firsts): Now, also a bitset.
Adjust all dependencies.
(varsetsize): Remove, now unused.
* src/warshall.h, src/warshall.c: Now work on arrays of bitsets.
2002-03-04 12:03:01 +00:00
Akim Demaille
34ba97434f * src/print.c: Convert to use bitset.h, not hand coded iterations
over ints.
2002-03-04 12:02:16 +00:00
Akim Demaille
ed86e78c90 * src/reduce.c: Convert to use bitset.h, not hand coded BSet. 2002-03-04 12:01:44 +00:00
Akim Demaille
dfdb1797c3 * src/closure.c (ruleset): Be a bitset.
(rulesetsize): Remove.
2002-03-04 11:59:18 +00:00
Akim Demaille
7086e7071e * lib/bitset-int.h, lib/bitset.c, lib/bitset.h, lib/bitsetv.c,
* lib/bitsetv.h, lib/ebitset.c, lib/ebitset.h, lib/lbitset.c,
* lib/lbitset.h, lib/sbitset.c, lib/sbitset.h: New.
* src/closure.c (fderives): Be an array of bitsets.
2002-03-04 11:58:52 +00:00
Robert Anisko
98254360e3 * data/bison.c++: Merge the two generated headers. Insert a copyright
notice in each output file.
2002-02-28 14:56:33 +00:00
Akim Demaille
a75c057f10 * data/bison.c++: Copy the prologue of bison.simple to fetch
useful M4 definitions, such as b4_header_guard.
2002-02-28 11:41:00 +00:00
Akim Demaille
06b00abcdd * src/getargs.c (version): Give the name of the authors, and use a
translator friendly scheme for the copyright notice.
2002-02-25 14:26:28 +00:00