# include "../lexgen1/ldefs.c"
purge()
{
int i,c, k, pass, change, *p;
for(i=0; i<=nstate; i++)
	used[i]= 0;
for(i=1; i<nstart; i++)
	used[i]=1;
pass = 1;
do{
change = 0;
for(i=1; i<=nstate; i++)
	if (used[i] == pass)
	{
	for(c=0; c<NCH; c++)
		if (p=move(i,c,1,0))
			{
			k = *++p;
			if (used[k]==0)
				used[k]=change=pass+1;
			}
	if (other[i] != 0)
		if (used[other[i]] == 0)
			used[other[i]] = change=pass+1;
	}
pass++;
} while (change);
for(i=k=1; i<=nstate; i++)
	if(used[i]) used[i] = k++;
stnum = k;
return(k);
}
