/[bison]/bison/src/reduce.c
ViewVC logotype

Diff of /bison/src/reduce.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.34 by akim, Wed Dec 5 09:27:23 2001 UTC revision 1.35 by akim, Wed Dec 5 09:43:53 2001 UTC
# Line 264  inaccessable_symbols (void) Line 264  inaccessable_symbols (void)
264  static void  static void
265  reduce_grammar_tables (void)  reduce_grammar_tables (void)
266  {  {
267  /* This is turned off because we would need to change the numbers    /* This is turned off because we would need to change the numbers in
268     in the case statements in the actions file.  */       the case statements in the actions file.
269  #if 0  
270    /* remove useless productions */       We don't disable it via CPP so that it is still checked with the
271    if (nuseless_productions > 0)       rest of the code, to avoid its becoming completely obsolete.
     {  
       short np, pn, ni, pi;  
272    
273        np = 0;       FIXME: I think the comment above demonstrates this code must be
274        ni = 0;       turned off for *semantic* parser, not in the general case.  Try
275        for (pn = 1; pn <= nrules; pn++)       to understand this better --akim.  */
276          {  
277      if (0)
278        /* remove useless productions */
279        if (nuseless_productions > 0)
280          {
281            short np, pn, ni, pi;
282    
283            np = 0;
284            ni = 0;
285            for (pn = 1; pn <= nrules; pn++)
286            if (BITISSET (P, pn))            if (BITISSET (P, pn))
287              {              {
288                np++;                np++;
289                if (pn != np)                if (pn != np)
290                  {                  {
291                    rule_table[np].lhs = rule_table[pn].lhs;                    rule_table[np].lhs   = rule_table[pn].lhs;
292                    rline[np] = rline[pn];                    rule_table[np].line  = rule_table[pn].line;
293                    rule_table[np].prec = rule_table[pn].prec;                    rule_table[np].prec  = rule_table[pn].prec;
294                    rule_table[np].assoc = rule_table[pn].assoc;                    rule_table[np].assoc = rule_table[pn].assoc;
295                    rule_table[np].rhs = rule_table[pn].rhs;                    rule_table[np].rhs   = rule_table[pn].rhs;
296                    if (rule_table[np].rhs != ni)                    if (rule_table[np].rhs != ni)
297                      {                      {
298                        pi = rule_table[np].rhs;                        pi = rule_table[np].rhs;
# Line 300  reduce_grammar_tables (void) Line 307  reduce_grammar_tables (void)
307                    while (ritem[ni++] >= 0);                    while (ritem[ni++] >= 0);
308                  }                  }
309              }              }
         }  
       ritem[ni] = 0;  
       nrules -= nuseless_productions;  
       nitems = ni;  
310    
311        /* Is it worth it to reduce the amount of memory for the          ritem[ni] = 0;
312           grammar? Probably not.  */          nrules -= nuseless_productions;
313            nitems = ni;
314    
315            /* Is it worth it to reduce the amount of memory for the
316               grammar? Probably not.  */
317          }
318    
     }  
 #endif /* 0 */  
319    /* Disable useless productions. */    /* Disable useless productions. */
320    if (nuseless_productions > 0)    if (nuseless_productions > 0)
321      {      {

Legend:
Removed from v.1.34  
changed lines
  Added in v.1.35

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26