firsts = bitsetv_create (nvars, nvars, BITSET_FIXED);
for (i = ntokens; i < nsyms; i++)
- for (j = 0; derives[i][j] >= 0; ++j)
+ for (j = 0; derives[i][j]; ++j)
{
- int symbol = rules[derives[i][j]].rhs[0];
+ int symbol = derives[i][j]->rhs[0];
if (ISVAR (symbol))
bitset_set (FIRSTS (i), symbol - ntokens);
}
- if (trace_flag)
+ if (trace_flag & trace_sets)
bitsetv_matrix_dump (stderr, "RTC: Firsts Input", firsts);
bitsetv_reflexive_transitive_closure (firsts);
- if (trace_flag)
+ if (trace_flag & trace_sets)
bitsetv_matrix_dump (stderr, "RTC: Firsts Output", firsts);
- if (trace_flag)
+ if (trace_flag & trace_sets)
print_firsts ();
}
for (i = ntokens; i < nsyms; ++i)
for (j = ntokens; j < nsyms; ++j)
if (bitset_test (FIRSTS (i), j - ntokens))
- for (k = 0; derives[j][k] >= 0; ++k)
- bitset_set (FDERIVES (i), derives[j][k]);
+ for (k = 0; derives[j][k]; ++k)
+ bitset_set (FDERIVES (i), derives[j][k]->number);
- if (trace_flag)
+ if (trace_flag & trace_sets)
print_fderives ();
bitsetv_free (firsts);
bitset_iterator iter;
- if (trace_flag)
+ if (trace_flag & trace_sets)
print_closure ("input", core, n);
bitset_zero (ruleset);
c++;
}
- if (trace_flag)
+ if (trace_flag & trace_sets)
print_closure ("output", itemset, nritemset);
}