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

Diff of /bison/src/LR0.c

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

revision 1.79 by akim, Mon Jul 29 17:30:33 2002 UTC revision 1.80 by akim, Mon Jul 29 17:31:46 2002 UTC
# Line 83  state_list_append (symbol_number_t symbo Line 83  state_list_append (symbol_number_t symbo
83  static int nshifts;  static int nshifts;
84  static symbol_number_t *shift_symbol = NULL;  static symbol_number_t *shift_symbol = NULL;
85    
86  static short *redset = NULL;  static rule_t **redset = NULL;
87  static state_number_t *shiftset = NULL;  static state_t **shiftset = NULL;
88    
89  static item_number_t **kernel_base = NULL;  static item_number_t **kernel_base = NULL;
90  static int *kernel_size = NULL;  static int *kernel_size = NULL;
# Line 139  allocate_storage (void) Line 139  allocate_storage (void)
139  {  {
140    allocate_itemsets ();    allocate_itemsets ();
141    
142    shiftset = XCALLOC (state_number_t, nsyms);    shiftset = XCALLOC (state_t *, nsyms);
143    redset = XCALLOC (short, nrules);    redset = XCALLOC (rule_t *, nrules);
144    state_hash_new ();    state_hash_new ();
145    shift_symbol = XCALLOC (symbol_number_t, nsyms);    shift_symbol = XCALLOC (symbol_number_t, nsyms);
146  }  }
# Line 204  new_itemsets (state_t *state) Line 204  new_itemsets (state_t *state)
204    
205    
206    
207  /*--------------------------------------------------------------.  /*-----------------------------------------------------------------.
208  | Find the state number for the state we would get to (from the |  | Find the state we would get to (from the current state) by       |
209  | current state) by shifting symbol.  Create a new state if no  |  | shifting SYMBOL.  Create a new state if no equivalent one exists |
210  | equivalent one exists already.  Used by append_states.        |  | already.  Used by append_states.                                 |
211  `--------------------------------------------------------------*/  `-----------------------------------------------------------------*/
212    
213  static state_number_t  static state_t *
214  get_state (symbol_number_t symbol, size_t core_size, item_number_t *core)  get_state (symbol_number_t symbol, size_t core_size, item_number_t *core)
215  {  {
216    state_t *sp;    state_t *sp;
# Line 226  get_state (symbol_number_t symbol, size_ Line 226  get_state (symbol_number_t symbol, size_
226    if (trace_flag)    if (trace_flag)
227      fprintf (stderr, "Exiting get_state => %d\n", sp->number);      fprintf (stderr, "Exiting get_state => %d\n", sp->number);
228    
229    return sp->number;    return sp;
230  }  }
231    
232  /*------------------------------------------------------------------.  /*---------------------------------------------------------------.
233  | Use the information computed by new_itemsets to find the state    |  | Use the information computed by new_itemsets to find the state |
234  | numbers reached by each shift transition from STATE.              |  | numbers reached by each shift transition from STATE.           |
235  |                                                                   |  |                                                                |
236  | SHIFTSET is set up as a vector of state numbers of those states.  |  | SHIFTSET is set up as a vector of those states.                |
237  `------------------------------------------------------------------*/  `---------------------------------------------------------------*/
238    
239  static void  static void
240  append_states (state_t *state)  append_states (state_t *state)
# Line 292  save_reductions (state_t *state) Line 292  save_reductions (state_t *state)
292      {      {
293        int item = ritem[itemset[i]];        int item = ritem[itemset[i]];
294        if (item < 0)        if (item < 0)
295          redset[count++] = item_number_as_rule_number (item);          redset[count++] = &rules[item_number_as_rule_number (item)];
296      }      }
297    
298    /* Make a reductions structure and copy the data into it.  */    /* Make a reductions structure and copy the data into it.  */

Legend:
Removed from v.1.79  
changed lines
  Added in v.1.80

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