From bb88b0fc9e1f8ff9f2f5e672078a81d13288e0d5 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Mon, 8 Apr 2002 11:45:29 +0000 Subject: [PATCH 1/1] * src/reduce.c (reduce_grammar): First reduce the nonterminals, and then the grammar. --- ChangeLog | 6 ++++++ src/reduce.c | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index efb71953..3d45d5d8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2002-04-08 Akim Demaille + + * src/reduce.c (reduce_grammar): First reduce the nonterminals, + and then the grammar. + + 2002-04-08 Akim Demaille * src/system.h: No longer using strndup. diff --git a/src/reduce.c b/src/reduce.c index 25681750..565cd572 100644 --- a/src/reduce.c +++ b/src/reduce.c @@ -487,10 +487,13 @@ reduce_grammar (void) fatal (_("Start symbol %s does not derive any sentence"), quotearg_style (escape_quoting_style, symbols[start_symbol]->tag)); - if (nuseless_productions > 0) - reduce_grammar_tables (); + /* First reduce the nonterminals, as they renumber themselves in the + whole grammar. If you change the order, nonterms would be + renumbered only in the reduced grammar. */ if (nuseless_nonterminals > 0) nonterminals_reduce (); + if (nuseless_productions > 0) + reduce_grammar_tables (); if (trace_flag) { -- 2.45.2