1 char rcsid_closure[] = "$Id$";
6 int prevent_divergence = 0;
17 for (pl = rules; pl; pl = pl->next) {
18 Rule p = (Rule) pl->x;
20 chainrules = newList(p, chainrules);
22 p->pat->op->table->rules = newList(p, p->pat->op->table->rules);
23 addRelevant(p->pat->op->table->relevant, p->lhs->num);
40 for (i = 0; i < max_nonterminal; i++) {
41 if (t->virgin[i].rule) {
43 if (LESSCOST(t->virgin[i].delta, base)) {
44 ASSIGNCOST(base, t->virgin[i].delta);
48 ASSIGNCOST(base, t->virgin[i].delta);
57 for (i = 0; i < max_nonterminal; i++) {
58 if (t->virgin[i].rule) {
59 MINUSCOST(t->virgin[i].delta, base);
61 NODIVERGE(t->virgin[i].delta, t, i, base_nt);
66 closure(t) Item_Set t;
72 t->closed = itemArrayCopy(t->virgin);
77 for (pl = chainrules; pl; pl = pl->next) {
78 Rule p = (Rule) pl->x;
79 register Item *rhs_item = &t->closed[p->pat->children[0]->num];
81 if (rhs_item->rule) { /* rhs is active */
83 register Item *lhs_item = &t->closed[p->lhs->num];
85 ASSIGNCOST(dc, rhs_item->delta);
86 ADDCOST(dc, p->delta);
87 if (LESSCOST(dc, lhs_item->delta) || !lhs_item->rule) {
88 ASSIGNCOST(lhs_item->delta, dc);