4 * $Id: fset2.c,v 1.7 95/10/05 11:57:01 parrt Exp $
7 * Compute FIRST sets for full LL(k)
11 * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
12 * Set (PCCTS) -- PCCTS is in the public domain. An individual or
13 * company may do whatever they wish with source code distributed with
14 * PCCTS or the code generated by PCCTS, including the incorporation of
15 * PCCTS, or its output, into commerical software.
17 * We encourage users to develop software with PCCTS. However, we do ask
18 * that credit is given to us for developing PCCTS. By "credit",
19 * we mean that if you incorporate our source code into one of your
20 * programs (commercial product, research project, or otherwise) that you
21 * acknowledge this fact somewhere in the documentation, research report,
22 * etc... If you like PCCTS and have developed a nice tool with the
23 * output, please mention that you developed it using PCCTS. In
24 * addition, we ask that this header remain intact in our source code.
25 * As long as these guidelines are kept, we expect to continue enhancing
26 * this system and expect to make other tools available as they are
31 * Parr Research Corporation
32 * with Purdue University and AHPCRC, University of Minnesota
54 extern char *PRED_AND_LIST;
55 extern char *PRED_OR_LIST;
57 /* ick! globals. Used by permute() to track which elements of a set have been used */
60 static unsigned **ftbl;
61 static set *constrain; /* pts into fset. constrains tToken() to 'constrain' */
63 static int maxk; /* set to initial k upon tree construction request */
64 static Tree *FreeList = NULL;
67 static int tmember_of_context(Tree *, Predicate *);
69 static int tmember_of_context();
77 preorder( Tree *tree )
83 if ( tree == NULL ) return;
84 if ( tree->down != NULL ) fprintf(stderr, " (");
85 if ( tree->token == ALT ) fprintf(stderr, " J");
86 else fprintf(stderr, " %s", TerminalString(tree->token));
87 if ( tree->token==EpToken ) fprintf(stderr, "(%d)", tree->v.rk);
89 if ( tree->down != NULL ) fprintf(stderr, " )");
90 preorder(tree->right);
93 /* check the depth of each primary sibling to see that it is exactly
102 * Remove all branches <= k deep.
104 * Added by TJP 9-23-92 to make the LL(k) constraint mechanism to work.
108 prune( Tree *t, int k )
115 if ( t == NULL ) return NULL;
116 if ( t->token == ALT ) fatal_internal("prune: ALT node in FIRST tree");
117 if ( t->right!=NULL ) t->right = prune(t->right, k);
120 if ( t->down!=NULL ) t->down = prune(t->down, k-1);
121 if ( t->down == NULL )
132 /* build a tree (root child1 child2 ... NULL) */
134 Tree *tmake(Tree *root, ...)
136 Tree *tmake(va_alist)
142 Tree *child, *sibling=NULL, *tail;
151 root = va_arg(ap, Tree *);
153 child = va_arg(ap, Tree *);
154 while ( child != NULL )
157 /* added "find end of child" thing TJP March 1994 */
158 for (w=child; w->right!=NULL; w=w->right) {;} /* find end of child */
163 if ( sibling == NULL ) {sibling = child; tail = w;}
164 else {tail->right = child; tail = w;}
165 child = va_arg(ap, Tree *);
168 /* was "root->down = sibling;" */
169 if ( root==NULL ) root = sibling;
170 else root->down = sibling;
187 if ( FreeList == NULL )
189 /*fprintf(stderr, "tnode: %d more nodes\n", TreeBlockAllocSize);*/
190 if ( TreeResourceLimit > 0 )
192 if ( (n+TreeBlockAllocSize) >= TreeResourceLimit )
194 fprintf(stderr, ErrHdr, FileStr[CurAmbigfile], CurAmbigline);
195 fprintf(stderr, " hit analysis resource limit while analyzing alts %d and %d %s\n",
199 exit(PCCTS_EXIT_FAILURE);
202 newblk = (Tree *)calloc(TreeBlockAllocSize, sizeof(Tree));
203 if ( newblk == NULL )
205 fprintf(stderr, ErrHdr, FileStr[CurAmbigfile], CurAmbigline);
206 fprintf(stderr, " out of memory while analyzing alts %d and %d %s\n",
210 exit(PCCTS_EXIT_FAILURE);
212 n += TreeBlockAllocSize;
213 for (p=newblk; p<&(newblk[TreeBlockAllocSize]); p++)
215 p->right = FreeList; /* add all new Tree nodes to Free List */
220 FreeList = FreeList->right; /* remove a tree node */
221 p->right = NULL; /* zero out ptrs */
225 require(!p->in_use, "tnode: node in use!");
244 t = tmake(tnode((TokenInd!=NULL?TokenInd[EofToken]:EofToken)), t, NULL);
262 require(t->in_use, "_Tfree: node not in use!");
281 if ( t == NULL ) return NULL;
284 u->right = tdup(t->right);
285 u->down = tdup(t->down);
289 /* tree duplicate (assume tree is a chain downwards) */
292 tdup_chain( Tree *t )
300 if ( t == NULL ) return NULL;
303 u->down = tdup(t->down);
309 tappend( Tree *t, Tree *u )
318 /*fprintf(stderr, "tappend(");
319 preorder(t); fprintf(stderr, ",");
320 preorder(u); fprintf(stderr, " )\n");*/
321 if ( t == NULL ) return u;
322 if ( t->token == ALT && t->right == NULL ) return tappend(t->down, u);
323 for (w=t; w->right!=NULL; w=w->right) {;}
328 /* dealloc all nodes in a tree */
337 if ( t == NULL ) return;
343 /* find all children (alts) of t that require remaining_k nodes to be LL_k
348 * a1--a2--...--an <-- LL(1) tokens
350 * b1 b2 ... bn <-- LL(2) tokens
354 * z1 z2 ... zn <-- LL(LL_k) tokens
356 * We look for all [Ep] needing remaining_k nodes and replace with u.
357 * u is not destroyed or actually used by the tree (a copy is made).
361 tlink( Tree *t, Tree *u, int remaining_k )
363 tlink( t, u, remaining_k )
370 require(remaining_k!=0, "tlink: bad tree");
372 if ( t==NULL ) return NULL;
373 /*fprintf(stderr, "tlink: u is:"); preorder(u); fprintf(stderr, "\n");*/
374 if ( t->token == EpToken && t->v.rk == remaining_k )
376 require(t->down==NULL, "tlink: invalid tree");
377 if ( u == NULL ) return t->right;
383 t->down = tlink(t->down, u, remaining_k);
384 t->right = tlink(t->right, u, remaining_k);
388 /* remove as many ALT nodes as possible while still maintaining semantics */
397 if ( t == NULL ) return NULL;
398 t->down = tshrink( t->down );
399 t->right = tshrink( t->right );
400 if ( t->down == NULL )
402 if ( t->token == ALT )
406 return u; /* remove useless alts */
411 /* (? (ALT (? ...)) s) ==> (? (? ...) s) where s = sibling, ? = match any */
412 if ( t->token == ALT && t->down->right == NULL)
419 /* (? (A (ALT t)) s) ==> (? (A t) s) where A is a token; s,t siblings */
420 if ( t->token != ALT && t->down->token == ALT && t->down->right == NULL )
422 Tree *u = t->down->down;
438 if ( t == NULL ) return NULL;
439 t->down = tflatten( t->down );
440 t->right = tflatten( t->right );
441 if ( t->down == NULL ) return t;
443 if ( t->token == ALT )
446 /* find tail of children */
447 for (u=t->down; u->right!=NULL; u=u->right) {;}
458 tJunc( Junction *p, int k, set *rk )
466 Tree *t=NULL, *u=NULL;
471 fprintf(stderr, "tJunc(%d): %s in rule %s\n", k,
472 decodeJType[p->jtype], ((Junction *)p)->rname);
474 if ( p->jtype==aLoopBlk || p->jtype==RuleBlk ||
475 p->jtype==aPlusBlk || p->jtype==aSubBlk || p->jtype==aOptBlk )
477 if ( p->jtype!=aSubBlk && p->jtype!=aOptBlk ) {
478 require(p->lock!=NULL, "rJunc: lock array is NULL");
479 if ( p->lock[k] ) return NULL;
482 TRAV(p->p1, k, rk, tail);
483 if ( p->jtype==RuleBlk ) {p->lock[k] = FALSE; return tail;}
484 r = tmake(tnode(ALT), tail, NULL);
485 for (alt=(Junction *)p->p2; alt!=NULL; alt = (Junction *)alt->p2)
487 /* if this is one of the added optional alts for (...)+ then break */
488 if ( alt->ignore ) break;
490 if ( tail==NULL ) {TRAV(alt->p1, k, rk, tail); r->down = tail;}
493 TRAV(alt->p1, k, rk, tail->right);
494 if ( tail->right != NULL ) tail = tail->right;
497 if ( p->jtype!=aSubBlk && p->jtype!=aOptBlk ) p->lock[k] = FALSE;
499 fprintf(stderr, "blk(%s) returns:",((Junction *)p)->rname); preorder(r); fprintf(stderr, "\n");
501 if ( r->down == NULL ) {_Tfree(r); return NULL;}
505 if ( p->jtype==EndRule )
507 if ( p->halt ) /* don't want FOLLOW here? */
509 /* if ( ContextGuardTRAV ) return NULL;*/
510 set_orel(k, rk); /* indicate this k value needed */
515 require(p->lock!=NULL, "rJunc: lock array is NULL");
516 if ( p->lock[k] ) return NULL;
517 /* if no FOLLOW assume k EOF's */
518 if ( p->p1 == NULL ) return eofnode(k);
524 TRAV(p->p1, k, rk,t);
525 if ( p->jtype==EndRule ) p->lock[k]=FALSE;
528 TRAV(p->p1, k, rk, t);
529 if ( p->jtype!=RuleBlk ) TRAV(p->p2, k, rk, u);
530 if ( p->jtype==EndRule ) p->lock[k] = FALSE;/* unlock node */
532 if ( t==NULL ) return tmake(tnode(ALT), u, NULL);
533 return tmake(tnode(ALT), t, u, NULL);
538 tRuleRef( RuleRefNode *p, int k, set *rk_out )
540 tRuleRef( p, k, rk_out )
551 RuleEntry *q = (RuleEntry *) hash_get(Rname, p->text);
554 fprintf(stderr, "tRuleRef: %s\n", p->text);
558 TRAV(p->next, k, rk_out, t);/* ignore undefined rules */
562 r = RulePtr[q->rulenum];
563 if ( r->lock[k] ) return NULL;
564 save_halt = r->end->halt;
565 r->end->halt = TRUE; /* don't let reach fall off end of rule here */
567 r->end->halt = save_halt;
569 fprintf(stderr, "after ruleref, t is:"); preorder(t); fprintf(stderr, "\n");
572 while ( !set_nil(rk) ) { /* any k left to do? if so, link onto tree */
575 TRAV(p->next, k2, &rk2, u);
576 t = tlink(t, u, k2); /* any alts missing k2 toks, add u onto end */
578 set_free(rk); /* rk is empty, but free it's memory */
579 set_orin(rk_out, rk2); /* remember what we couldn't do */
586 tToken( TokNode *p, int k, set *rk )
594 Tree *t, *tset=NULL, *u;
596 if ( ConstrainSearch )
598 require(constrain>=fset&&constrain<=&(fset[LL_k]),"tToken: constrain is not a valid set");
599 constrain = &fset[maxk-k+1];
603 fprintf(stderr, "tToken(%d): %s\n", k, TerminalString(p->token));
604 if ( ConstrainSearch ) {
605 fprintf(stderr, "constrain is:"); s_fprT(stderr, *constrain); fprintf(stderr, "\n");
608 /* is it a meta token (set of tokens)? */
609 if ( !set_nil(p->tset) )
613 Tree *n, *tail = NULL;
615 if ( ConstrainSearch ) a = set_and(p->tset, *constrain);
616 else a = set_dup(p->tset);
618 if ( ConstrainSearch ) a = set_dif(p->tset, *constrain);
619 else a = set_dup(p->tset);
621 for (; !set_nil(a); set_rm(e, a))
625 if ( tset==NULL ) { tset = n; tail = n; }
626 else { tail->right = n; tail = n; }
630 else if ( ConstrainSearch && !set_el(p->token, *constrain) )
632 /* fprintf(stderr, "ignoring token %s(%d)\n", TerminalString(p->token),
636 else tset = tnode( p->token );
638 if ( k == 1 ) return tset;
640 TRAV(p->next, k-1, rk, t);
641 /* here, we are positive that, at least, this tree will not contribute
642 * to the LL(2) tree since it will be too shallow, IF t==NULL.
643 * If doing a context guard walk, then don't prune.
645 if ( t == NULL && !ContextGuardTRAV ) /* tree will be too shallow */
647 if ( tset!=NULL ) Tfree( tset );
651 fprintf(stderr, "tToken(%d)->next:",k); preorder(t); fprintf(stderr, "\n");
654 /* if single token root, then just make new tree and return */
655 if ( set_nil(p->tset) ) return tmake(tnode(p->token), t, NULL);
657 /* here we must make a copy of t as a child of each element of the tset;
658 * e.g., "T1..T3 A" would yield ( nil ( T1 A ) ( T2 A ) ( T3 A ) )
660 for (u=tset; u!=NULL; u=u->right)
662 /* make a copy of t and hook it onto bottom of u */
667 fprintf(stderr, "range is:"); preorder(tset); fprintf(stderr, "\n");
674 tAction( ActionNode *p, int k, set *rk )
684 /*fprintf(stderr, "tAction\n");*/
685 TRAV(p->next, k, rk, t);
689 /* see if e exists in s as a possible input permutation (e is always a chain) */
692 tmember( Tree *e, Tree *s )
699 if ( e==NULL||s==NULL ) return 0;
700 /*fprintf(stderr, "tmember(");
701 preorder(e); fprintf(stderr, ",");
702 preorder(s); fprintf(stderr, " )\n");*/
703 if ( s->token == ALT && s->right == NULL ) return tmember(e, s->down);
704 if ( e->token!=s->token )
706 if ( s->right==NULL ) return 0;
707 return tmember(e, s->right);
709 if ( e->down==NULL && s->down == NULL ) return 1;
710 if ( tmember(e->down, s->down) ) return 1;
711 if ( s->right==NULL ) return 0;
712 return tmember(e, s->right);
715 /* see if e exists in s as a possible input permutation (e is always a chain);
716 * Only check s to the depth of e. In other words, 'e' can be a shorter
721 tmember_constrained( Tree *e, Tree *s)
723 tmember_constrained( e, s )
728 if ( e==NULL||s==NULL ) return 0;
729 /* fprintf(stderr, "tmember_constrained(");
730 preorder(e); fprintf(stderr, ",");
731 preorder(s); fprintf(stderr, " )\n");*/
732 if ( s->token == ALT && s->right == NULL )
733 return tmember_constrained(e, s->down);
734 if ( e->token!=s->token )
736 if ( s->right==NULL ) return 0;
737 return tmember_constrained(e, s->right);
739 if ( e->down == NULL ) return 1; /* if s is matched to depth of e return */
740 if ( tmember_constrained(e->down, s->down) ) return 1;
741 if ( s->right==NULL ) return 0;
742 return tmember_constrained(e, s->right);
745 /* combine (? (A t) ... (A u) ...) into (? (A t u)) */
748 tleft_factor( Tree *t )
754 Tree *u, *v, *trail, *w;
756 /* left-factor what is at this level */
757 if ( t == NULL ) return NULL;
758 for (u=t; u!=NULL; u=u->right)
764 if ( u->token == v->token )
768 for (w=u->down; w->right!=NULL; w=w->right) {;}
769 w->right = v->down; /* link children together */
771 else u->down = v->down;
772 trail->right = v->right; /* unlink factored node */
776 else {trail = v; v=v->right;}
779 /* left-factor what is below */
780 for (u=t; u!=NULL; u=u->right) u->down = tleft_factor( u->down );
784 /* remove the permutation p from t if present */
787 trm_perm( Tree *t, Tree *p )
795 fprintf(stderr, "trm_perm(");
796 preorder(t); fprintf(stderr, ",");
797 preorder(p); fprintf(stderr, " )\n");
799 if ( t == NULL || p == NULL ) return NULL;
800 if ( t->token == ALT )
802 t->down = trm_perm(t->down, p);
803 if ( t->down == NULL ) /* nothing left below, rm cur node */
807 return trm_perm(u, p);
809 t->right = trm_perm(t->right, p); /* look for more instances of p */
812 if ( p->token != t->token ) /* not found, try a sibling */
814 t->right = trm_perm(t->right, p);
817 t->down = trm_perm(t->down, p->down);
818 if ( t->down == NULL ) /* nothing left below, rm cur node */
822 return trm_perm(u, p);
824 t->right = trm_perm(t->right, p); /* look for more instances of p */
828 /* add the permutation 'perm' to the LL_k sets in 'fset' */
831 tcvt( set *fset, Tree *perm )
838 if ( perm==NULL ) return;
839 set_orel(perm->token, fset);
840 tcvt(fset+1, perm->down);
843 /* for each element of ftbl[k], make it the root of a tree with permute(ftbl[k+1])
848 permute( int k, int max_k )
856 if ( k>max_k ) return NULL;
857 if ( ftbl[k][findex[k]] == nil ) return NULL;
858 t = permute(k+1, max_k);
859 if ( t==NULL&&k<max_k ) /* no permutation left below for k+1 tokens? */
862 (findex[k])++; /* try next token at this k */
863 return permute(k, max_k);
866 u = tmake(tnode(ftbl[k][findex[k]]), t, NULL);
867 if ( k == max_k ) (findex[k])++;
871 /* Compute LL(k) trees for alts alt1 and alt2 of p.
872 * function result is tree of ambiguous input permutations
874 * ALGORITHM may change to look for something other than LL_k size
875 * trees ==> maxk will have to change.
879 VerifyAmbig( Junction *alt1, Junction *alt2, unsigned **ft, set *fs, Tree **t, Tree **u, int *numAmbig )
881 VerifyAmbig( alt1, alt2, ft, fs, t, u, numAmbig )
892 Tree *perm, *ambig=NULL;
896 maxk = LL_k; /* NOTE: for now, we look for LL_k */
899 constrain = &(fset[1]);
900 findex = (int *) calloc(LL_k+1, sizeof(int));
901 if ( findex == NULL )
903 fprintf(stderr, ErrHdr, FileStr[CurAmbigfile], CurAmbigline);
904 fprintf(stderr, " out of memory while analyzing alts %d and %d of %s\n",
908 exit(PCCTS_EXIT_FAILURE);
910 for (k=1; k<=LL_k; k++) findex[k] = 0;
913 ConstrainSearch = 1; /* consider only tokens in ambig sets */
915 p = analysis_point((Junction *)alt1->p1);
916 TRAV(p, LL_k, &rk, *t);
919 *t = prune(*t, LL_k);
920 *t = tleft_factor( *t );
921 /* fprintf(stderr, "after shrink&flatten&prune&left_factor:"); preorder(*t); fprintf(stderr, "\n");*/
924 /* fprintf(stderr, "TreeIncomplete --> no LL(%d) ambiguity\n", LL_k);*/
925 Tfree( *t ); /* kill if impossible to have ambig */
929 p = analysis_point((Junction *)alt2->p1);
930 TRAV(p, LL_k, &rk, *u);
933 *u = prune(*u, LL_k);
934 *u = tleft_factor( *u );
935 /* fprintf(stderr, "after shrink&flatten&prune&lfactor:"); preorder(*u); fprintf(stderr, "\n");*/
938 /* fprintf(stderr, "TreeIncomplete --> no LL(%d) ambiguity\n", LL_k);*/
943 for (k=1; k<=LL_k; k++) set_clr( fs[k] );
947 if ( *t!=NULL && *u!=NULL )
949 while ( (perm=permute(1,LL_k))!=NULL )
951 /* fprintf(stderr, "chk perm:"); preorder(perm); fprintf(stderr, "\n");*/
952 if ( tmember(perm, *t) && tmember(perm, *u) )
954 /* fprintf(stderr, "ambig upon"); preorder(perm); fprintf(stderr, "\n");*/
956 perm->right = ambig->down;
958 tcvt(&(fs[1]), perm);
965 if ( ambig->down == NULL ) {_Tfree(ambig); ambig = NULL;}
966 free( (char *)findex );
967 /* fprintf(stderr, "final ambig:"); preorder(ambig); fprintf(stderr, "\n");*/
973 bottom_of_chain( Tree *t )
979 if ( t==NULL ) return NULL;
980 for (; t->down != NULL; t=t->down) {;}
985 * Make a tree from k sets where the degree of the first k-1 sets is 1.
989 make_tree_from_sets( set *fset1, set *fset2 )
991 make_tree_from_sets( fset1, fset2 )
998 Tree *t=NULL, *n, *u;
1000 require(LL_k>1, "make_tree_from_sets: LL_k must be > 1");
1002 /* do the degree 1 sets first */
1003 for (i=1; i<=LL_k-1; i++)
1005 inter = set_and(fset1[i], fset2[i]);
1006 require(set_deg(inter)==1, "invalid set to tree conversion");
1007 n = tnode(set_int(inter));
1008 if (t==NULL) t=n; else tmake(t, n, NULL);
1012 /* now add the chain of tokens at depth k */
1013 u = bottom_of_chain(t);
1014 inter = set_and(fset1[LL_k], fset2[LL_k]);
1015 if ( (q=p=set_pdq(inter)) == NULL ) fatal_internal("Can't alloc space for set_pdq");
1016 /* first one is linked to bottom, then others are sibling linked */
1032 /* create and return the tree of lookahead k-sequences that are in t, but not
1033 * in the context of predicates in predicate list p.
1037 tdif( Tree *ambig_tuples, Predicate *p, set *fset1, set *fset2 )
1039 tdif( ambig_tuples, p, fset1, fset2 )
1052 if ( p == NULL ) return tdup(ambig_tuples);
1054 ft = (unsigned **) calloc(CLL_k+1, sizeof(unsigned *));
1055 require(ft!=NULL, "cannot allocate ft");
1056 for (i=1; i<=CLL_k; i++)
1058 b = set_and(fset1[i], fset2[i]);
1062 findex = (int *) calloc(LL_k+1, sizeof(int));
1063 if ( findex == NULL )
1065 fatal_internal("out of memory in tdif while checking predicates");
1067 for (k=1; k<=LL_k; k++) findex[k] = 0;
1070 fprintf(stderr, "tdif_%d[", p->k);
1071 preorder(ambig_tuples);
1072 fprintf(stderr, ",");
1073 preorder(p->tcontext);
1074 fprintf(stderr, "] =");
1078 while ( (perm=permute(1,p->k))!=NULL )
1081 fprintf(stderr, "test perm:"); preorder(perm); fprintf(stderr, "\n");
1083 if ( tmember_constrained(perm, ambig_tuples) &&
1084 !tmember_of_context(perm, p) )
1087 fprintf(stderr, "satisfied upon"); preorder(perm); fprintf(stderr, "\n");
1090 if ( dif==NULL ) dif = perm;
1102 fprintf(stderr, "\n");
1105 for (i=1; i<=CLL_k; i++) free( (char *)ft[i] );
1107 free((char *)findex);
1112 /* is lookahead sequence t a member of any context tree for any
1117 tmember_of_context( Tree *t, Predicate *p )
1119 tmember_of_context( t, p )
1124 for (; p!=NULL; p=p->right)
1126 if ( p->expr==PRED_AND_LIST || p->expr==PRED_OR_LIST )
1127 return tmember_of_context(t, p->down);
1128 if ( tmember_constrained(t, p->tcontext) ) return 1;
1129 if ( tmember_of_context(t, p->down) ) return 1;
1136 is_single_tuple( Tree *t )
1138 is_single_tuple( t )
1142 if ( t == NULL ) return 0;
1143 if ( t->right != NULL ) return 0;
1144 if ( t->down == NULL ) return 1;
1145 return is_single_tuple(t->down);
1149 * Look at a (...)? generalized-predicate context-guard and compute
1150 * either a lookahead set (k==1) or a lookahead tree for k>1. The
1151 * k level is determined by the guard itself rather than the LL_k
1152 * variable. For example, ( A B )? is an LL(2) guard and ( ID )?
1153 * is an LL(1) guard. For the moment, you can only have a single
1154 * tuple in the guard. Physically, the block must look like this
1155 * --o-->TOKEN-->o-->o-->TOKEN-->o-- ... -->o-->TOKEN-->o--
1156 * An error is printed for any other type.
1160 computePredicateFromContextGuard(Graph blk)
1162 computePredicateFromContextGuard(blk)
1166 Junction *junc = (Junction *)blk.left, *p;
1168 Predicate *pred = NULL;
1170 require(junc!=NULL && junc->ntype == nJunction, "bad context guard");
1178 ConstrainSearch = 0;
1179 ContextGuardTRAV = 1;
1180 TRAV(p, LL_k, &rk, t);
1181 ContextGuardTRAV = 0;
1185 t = tleft_factor( t );
1187 fprintf(stderr, "ctx guard:");
1189 fprintf(stderr, "\n");
1195 REACH(p, 1, &rk, scontext);
1196 require(set_nil(rk), "rk != nil");
1199 fprintf(stderr, "LL(1) ctx guard is:");
1200 s_fprT(stderr, scontext);
1201 fprintf(stderr, "\n");
1203 pred->scontext[1] = scontext;