summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Carbonneaux2015-03-04 19:10:21 -0500
committerQuentin Carbonneaux2015-03-04 19:10:21 -0500
commit58e9fc1df61074fa86c6cd985f52893138b840d4 (patch)
treee656717e2e8078929739d465bc36fb15b79e5902
parentd90dd7d7d862e842df03ea0f943422cdf0a48e3e (diff)
add quick and dirty dirty bit
-rw-r--r--miniyacc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/miniyacc.c b/miniyacc.c
index 0a878c9..57a85ce 100644
--- a/miniyacc.c
+++ b/miniyacc.c
@@ -69,6 +69,7 @@ struct Item {
int nt;
Term ts[MaxTm];
Item **gtbl;
+ int dirty;
};
struct Row {
@@ -354,6 +355,7 @@ stadd(Item **pi)
i1 = st[hi];
for (n=0; n<i->nt; n++)
chg |= tsunion(&i1->ts[n].lk, &i->ts[n].lk);
+ i1->dirty |= chg;
*pi = i1;
return chg;
} else {
@@ -362,6 +364,7 @@ stadd(Item **pi)
die("out of memory");
memmove(&st[hi+1], &st[hi], (nst-1 - hi) * sizeof st[0]);
i->gtbl = yalloc(nsy, sizeof i->gtbl[0]);
+ i->dirty = 1;
st[hi] = yalloc(1, sizeof *i1);
*st[hi] = *i;
return 1;
@@ -387,10 +390,14 @@ stgen()
i0.nt = 0;
i0.ts[i0.nt++] = tini;
stadd(&ini);
+ ini->dirty = 1;
do {
chg = 0;
for (n=0; n<nst; n++) {
i = st[n];
+ if (!i->dirty)
+ continue;
+ i->dirty = 0;
iclose(i);
for (s=0; s<nsy; s++) {
igoto(i, s);