mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-18 08:43:03 +00:00
* src/gram.h (item_number_t): New, the type of item numbers in
RITEM. Note that it must be able to code symbol numbers as positive number, and the negation of rule numbers as negative numbers. Adjust all dependencies (pretty many). * src/reduce.c (rule): Remove this `short *' pointer: use item_number_t. * src/system.h (MINSHORT, MAXSHORT): Remove. Include `limits.h'. Adjust dependencies to using SHRT_MAX and SHRT_MIN. (shortcpy): Remove. (MAXTABLE): Move to... * src/output.c (MAXTABLE): here. (prepare_rules): Use output_int_table to output rhs. * data/bison.simple, data/bison.c++: Adjust. * tests/torture.at (Big triangle): Move the limit from 254 to 500. * tests/regression.at (Web2c Actions): Ajust. Trying with bigger grammars shows various phenomena: at 3000 (28Mb of grammar file) bison is killed by my system, at 2000 (12Mb) bison passes, but produces negative #line number, once fixed, GCC is killed while compiling 14Mb, at 1500 (6.7 Mb of grammar, 8.2Mb of C), it passes. * src/state.h (state_h): Code input lines on ints, not shorts.
This commit is contained in:
13
src/reduce.c
13
src/reduce.c
@@ -37,9 +37,6 @@
|
||||
#include "getargs.h"
|
||||
#include "bitset.h"
|
||||
|
||||
typedef short *rule;
|
||||
|
||||
|
||||
/* Set of all nonterminals which are not useless. */
|
||||
static bitset N;
|
||||
|
||||
@@ -67,7 +64,7 @@ int nuseless_nonterminals;
|
||||
static bool
|
||||
useful_production (int i, bitset N0)
|
||||
{
|
||||
rule r;
|
||||
item_number_t *r;
|
||||
short n;
|
||||
|
||||
/* A production is useful if all of the nonterminals in its appear
|
||||
@@ -139,7 +136,7 @@ inaccessable_symbols (void)
|
||||
bitset Vp, Vs, Pp;
|
||||
int i;
|
||||
short t;
|
||||
rule r;
|
||||
item_number_t *r;
|
||||
|
||||
/* Find out which productions are reachable and which symbols are
|
||||
used. Starting with an empty set of productions and a set of
|
||||
@@ -252,7 +249,7 @@ reduce_grammar_tables (void)
|
||||
/* Renumber the rules markers in RITEMS. */
|
||||
for (i = 1; i < nrules + 1; ++i)
|
||||
{
|
||||
short *rhsp = rules[i].rhs;
|
||||
item_number_t *rhsp = rules[i].rhs;
|
||||
for (/* Nothing. */; *rhsp >= 0; ++rhsp)
|
||||
/* Nothing. */;
|
||||
*rhsp = -i;
|
||||
@@ -361,7 +358,7 @@ reduce_output (FILE *out)
|
||||
fprintf (out, "%s\n\n", _("Useless rules:"));
|
||||
for (i = nrules + 1; i < nuseless_productions + nrules + 1; i++)
|
||||
{
|
||||
rule r;
|
||||
item_number_t *r;
|
||||
fprintf (out, "#%-4d ", rules[i].user_number - 1);
|
||||
fprintf (out, "%s:", quotearg_style (escape_quoting_style,
|
||||
rules[i].lhs->tag));
|
||||
@@ -378,7 +375,7 @@ static void
|
||||
dump_grammar (FILE *out)
|
||||
{
|
||||
int i;
|
||||
rule r;
|
||||
item_number_t *r;
|
||||
|
||||
fprintf (out, "REDUCED GRAMMAR\n\n");
|
||||
fprintf (out,
|
||||
|
||||
Reference in New Issue
Block a user