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

Diff of /bison/src/nullable.c

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

revision 1.31 by akim, Sun Jun 30 17:31:19 2002 UTC revision 1.32 by akim, Wed Jul 3 10:54:33 2002 UTC
# Line 1  Line 1 
1  /* Part of the bison parser generator,  /* Part of the bison parser generator,
2     Copyright 1984, 1989, 2000, 2001 Free Software Foundation, Inc.     Copyright (C) 1984, 1989, 2000, 2001, 2002 Free Software Foundation, Inc.
3    
4     This file is part of Bison, the GNU Compiler Compiler.     This file is part of Bison, the GNU Compiler Compiler.
5    
# Line 26  Line 26 
26  #include "system.h"  #include "system.h"
27  #include "getargs.h"  #include "getargs.h"
28  #include "symtab.h"  #include "symtab.h"
 #include "types.h"  
29  #include "gram.h"  #include "gram.h"
30  #include "reduce.h"  #include "reduce.h"
31  #include "nullable.h"  #include "nullable.h"
32    
33    /* Linked list of rule numbers.  */
34    typedef struct rule_list_s
35    {
36      struct rule_list_s *next;
37      rule_number_t value;
38    } rule_list_t;
39    
40  char *nullable = NULL;  char *nullable = NULL;
41    
42  static void  static void
# Line 49  set_nullable (void) Line 55  set_nullable (void)
55    rule_number_t ruleno;    rule_number_t ruleno;
56    symbol_number_t *s1;    symbol_number_t *s1;
57    symbol_number_t *s2;    symbol_number_t *s2;
58    shorts *p;    rule_list_t *p;
59    
60    symbol_number_t *squeue = XCALLOC (symbol_number_t, nvars);    symbol_number_t *squeue = XCALLOC (symbol_number_t, nvars);
61    short *rcount = XCALLOC (short, nrules + 1);    short *rcount = XCALLOC (short, nrules + 1);
62    /* RITEM contains all the rules, including useless productions.    /* RITEM contains all the rules, including useless productions.
63       Hence we must allocate room for useless nonterminals too.  */       Hence we must allocate room for useless nonterminals too.  */
64    shorts **rsets = XCALLOC (shorts *, nvars) - ntokens;    rule_list_t **rsets = XCALLOC (rule_list_t *, nvars) - ntokens;
65    /* This is said to be more elements than we actually use.    /* This is said to be more elements than we actually use.
66       Supposedly NRITEMS - NRULES is enough.  But why take the risk?  */       Supposedly NRITEMS - NRULES is enough.  But why take the risk?  */
67    shorts *relts = XCALLOC (shorts, nritems + nvars + 1);    rule_list_t *relts = XCALLOC (rule_list_t, nritems + nvars + 1);
68    
69    if (trace_flag)    if (trace_flag)
70      fprintf (stderr, "Entering set_nullable\n");      fprintf (stderr, "Entering set_nullable\n");

Legend:
Removed from v.1.31  
changed lines
  Added in v.1.32

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