- derives = NEW2(nvars, short *) - ntokens;
- q = NEW2(nvars + nrules, short);
+ fputs ("\n\n", stderr);
+}
+
+
+void
+set_derives (void)
+{
+ int i;
+ shorts *p;
+ short *q;
+ shorts **dset;
+ shorts *delts;
+
+ dset = XCALLOC (shorts *, nvars) - ntokens;
+ delts = XCALLOC (shorts, nrules + 1);
+
+ p = delts;
+ for (i = nrules; i > 0; i--)
+ if (rule_table[i].useful)
+ {
+ int lhs = rule_table[i].lhs;
+ p->next = dset[lhs];
+ p->value = i;
+ dset[lhs] = p;
+ p++;
+ }
+
+ derives = XCALLOC (short *, nvars) - ntokens;
+ q = XCALLOC (short, nvars + nrules);