new_itemsets (void)
{
int i;
- int shiftcount;
if (trace_flag)
fprintf (stderr, "Entering new_itemsets, state = %d\n",
kernel_size[i] = 0;
shift_symbol = XCALLOC (short, nsyms);
- shiftcount = 0;
+ nshifts = 0;
- for (i = 0; i < itemsetsize; ++i)
+ for (i = 0; i < nitemset; ++i)
{
int symbol = ritem[itemset[i]];
if (symbol > 0)
{
if (!kernel_size[symbol])
{
- shift_symbol[shiftcount] = symbol;
- shiftcount++;
+ shift_symbol[nshifts] = symbol;
+ nshifts++;
}
kernel_base[symbol][kernel_size[symbol]] = itemset[i] + 1;
kernel_size[symbol]++;
}
}
-
- nshifts = shiftcount;
}
}
-/*---------------------------------.
-| Create a new array of N shitfs. |
-`---------------------------------*/
-
-static shifts *
-shifts_new (int n)
-{
- shifts *res = SHIFTS_ALLOC (n);
- res->nshifts = n;
- return res;
-}
-
-
/*------------------------------------------------------------.
| Save the NSHIFTS of SHIFTSET into the current linked list. |
`------------------------------------------------------------*/
sp = first_shift;
- if (!sp)
+ if (!sp->nshifts)
{
/* There are no shifts for any state. Make one shift, from the
initial state to the next-to-final state. */
/* Find and count the active items that represent ends of rules. */
count = 0;
- for (i = 0; i < itemsetsize; ++i)
+ for (i = 0; i < nitemset; ++i)
{
int item = ritem[itemset[i]];
if (item < 0)
while (this_state)
{
+ if (trace_flag)
+ fprintf (stderr, "Processing state %d (reached by %s)\n",
+ this_state->number, tags[this_state->accessing_symbol]);
/* Set up ruleset and itemset for the transitions out of this
state. ruleset gets a 1 bit for each rule that could reduce
now. itemset gets a vector of all the items that could be
/* create the shifts structures for the shifts to those states,
now that the state numbers transitioning to are known */
- if (nshifts > 0)
- save_shifts ();
+ save_shifts ();
/* states are queued when they are created; process them all */
this_state = this_state->next;