1 /* original parser id follows */
2 /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
3 /* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
8 #define YYCHECK "yyyymmdd"
11 #define yyclearin (yychar = YYEMPTY)
12 #define yyerrok (yyerrflag = 0)
13 #define YYRECOVERING() (yyerrflag != 0)
18 #define yyparse expr.oxout_parse
22 #define yylex expr.oxout_lex
26 #define yyerror expr.oxout_error
30 #define yychar expr.oxout_char
34 #define yyval expr.oxout_val
38 #define yylval expr.oxout_lval
42 #define yydebug expr.oxout_debug
46 #define yynerrs expr.oxout_nerrs
50 #define yyerrflag expr.oxout_errflag
51 #endif /* yyerrflag */
54 #define yylhs expr.oxout_lhs
58 #define yylen expr.oxout_len
62 #define yydefred expr.oxout_defred
66 #define yydgoto expr.oxout_dgoto
70 #define yysindex expr.oxout_sindex
74 #define yyrindex expr.oxout_rindex
78 #define yygindex expr.oxout_gindex
82 #define yytable expr.oxout_table
86 #define yycheck expr.oxout_check
90 #define yyname expr.oxout_name
94 #define yyrule expr.oxout_rule
96 #define YYPREFIX "expr.oxout_"
100 #line 5 "expr.oxout.y"
105 #include "expr.oxout.h"
108 extern int yylex(void);
109 extern void yyerror(const char *);
110 #line 27 "expr.oxout.y"
112 #define yyyR USHRT_MAX
114 #undef YYSTYPE_IS_DECLARED
115 #define YYSTYPE_IS_DECLARED 1
117 #ifndef YYSTYPE_IS_DECLARED
118 #define YYSTYPE_IS_DECLARED 1
119 #line 31 "expr.oxout.y"
122 struct yyyStackItem *yyyOxStackItem;
125 #endif /* !YYSTYPE_IS_DECLARED */
126 #line 38 "expr.oxout.y"
130 static int yyyYok = 1;
132 extern yyyFT yyyRCIL[];
134 void yyyExecuteRRsection(yyyGNT *rootNode);
135 void yyyYoxInit(void);
136 void yyyDecorate(void);
137 struct yyyOxAttrbs; /* hack required to compensate for 'msta' behavior */
138 void yyyGenIntNode(long yyyProdNum, int yyyRHSlength, int yyyNattrbs, struct yyyOxAttrbs *yyval_OxAttrbs, ...);
139 void yyyAdjustINRC(long yyyProdNum, int yyyRHSlength, long startP, long stopP, struct yyyOxAttrbs *yyval_OxAttrbs, ...);
140 void yyyCheckUnsolvedInstTrav(yyyGNT *rootNode,long *nNZrc,long *cycleSum);
141 void yyyUnsolvedInstSearchTrav(yyyGNT *pNode);
142 void yyyUnsolvedInstSearchTravAux(yyyGNT *pNode);
145 #line 146 "expr.oxout.tab.c"
147 /* compatibility with bison */
149 /* compatibility with FreeBSD */
150 # ifdef YYPARSE_PARAM_TYPE
151 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
153 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
156 # define YYPARSE_DECL() yyparse(void)
159 /* Parameters sent to lex. */
161 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
162 # define YYLEX yylex(YYLEX_PARAM)
164 # define YYLEX_DECL() yylex(void)
165 # define YYLEX yylex()
168 /* Parameters sent to yyerror. */
170 #define YYERROR_DECL() yyerror(const char *s)
173 #define YYERROR_CALL(msg) yyerror(msg)
176 extern int YYPARSE_DECL();
180 #define YYERRCODE 256
182 static const YYINT expr.oxout_lhs[] = { -1,
183 2, 0, 1, 3, 3, 3, 3, 3, 3, 3,
185 static const YYINT expr.oxout_len[] = { 2,
186 0, 2, 1, 3, 3, 3, 3, 3, 1, 1,
188 static const YYINT expr.oxout_defred[] = { 1,
189 0, 0, 9, 10, 0, 2, 0, 0, 0, 0,
192 static const YYINT expr.oxout_dgoto[] = { 1,
195 static const YYINT expr.oxout_sindex[] = { 0,
196 0, -40, 0, 0, -40, 0, -18, -24, -40, -40,
197 -40, -40, 0, -37, -37, 0, -39,
199 static const YYINT expr.oxout_rindex[] = { 0,
200 0, 0, 0, 0, 0, 0, 6, 0, 0, 0,
203 static const YYINT expr.oxout_gindex[] = { 0,
206 #define YYTABLESIZE 218
207 static const YYINT expr.oxout_table[] = { 5,
208 6, 5, 11, 0, 11, 3, 0, 7, 8, 12,
209 0, 0, 14, 15, 16, 17, 13, 11, 9, 0,
210 10, 0, 12, 11, 9, 0, 10, 0, 12, 0,
211 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
212 0, 6, 5, 6, 5, 6, 5, 6, 7, 0,
213 7, 0, 7, 0, 0, 0, 0, 0, 0, 0,
214 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
215 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
216 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
217 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
218 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
219 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
220 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
221 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
222 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
223 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
224 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
225 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
226 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
227 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
228 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
229 0, 0, 0, 0, 0, 0, 3, 4,
231 static const YYINT expr.oxout_check[] = { 40,
232 0, 0, 42, -1, 42, 0, -1, 0, 5, 47,
233 -1, -1, 9, 10, 11, 12, 41, 42, 43, -1,
234 45, -1, 47, 42, 43, -1, 45, -1, 47, -1,
235 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
236 -1, 41, 41, 43, 43, 45, 45, 47, 41, -1,
237 43, -1, 45, -1, -1, -1, -1, -1, -1, -1,
238 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
239 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
240 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
241 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
242 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
243 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
244 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
245 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
246 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
247 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
248 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
249 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
250 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
251 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
252 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
253 -1, -1, -1, -1, -1, -1, 257, 258,
259 #define YYMAXTOKEN 258
260 #define YYUNDFTOKEN 264
261 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
263 static const char *const expr.oxout_name[] = {
265 "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
266 0,0,0,0,0,0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,
267 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
268 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
269 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
270 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
271 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"ID",
272 "CONST",0,0,0,0,0,"illegal-symbol",
274 static const char *const expr.oxout_rule[] = {
275 "$accept : yyyAugNonterm",
277 "yyyAugNonterm : $$1 s",
279 "expr : expr '*' expr",
280 "expr : expr '+' expr",
281 "expr : expr '/' expr",
282 "expr : expr '-' expr",
283 "expr : '(' expr ')'",
300 /* define the initial stack-sizes */
303 #define YYMAXDEPTH YYSTACKSIZE
306 #define YYSTACKSIZE YYMAXDEPTH
308 #define YYSTACKSIZE 10000
309 #define YYMAXDEPTH 10000
313 #define YYINITSTACKSIZE 200
323 /* variables for the parser stack */
324 static YYSTACKDATA yystack;
336 #line 138 "expr.oxout.y"
337 long yyySSALspaceSize = 20000;
338 long yyyRSmaxSize = 1000;
339 long yyyTravStackMaxSize = 2000;
341 struct yyySolvedSAlistCell {yyyWAT attrbNum;
345 #define yyyLambdaSSAL 0
346 long yyySSALCfreeList = yyyLambdaSSAL;
347 long yyyNewSSALC = 1;
349 struct yyySolvedSAlistCell *yyySSALspace;
351 long yyyNbytesStackStg;
357 short yyyIIIEL[] = {0,
358 0,2,6,10,14,18,22,24,
362 0,0,0,0,0,0,0,0,0,0,0,0,
363 0,0,0,0,0,0,0,0,0,0,0,0,
373 void yyyfatal(char *msg)
374 {fputs(msg,stderr);exit(-1);}
378 #define yyySSALof 'S'
384 void yyyHandleOverflow(char which)
386 long oldSize,newSize;
390 msg1 = "SSAL overflow: ";
391 oldSize = yyySSALspaceSize;
394 msg1 = "ready set overflow: ";
395 oldSize = yyyRSmaxSize;
398 msg1 = "traversal stack overflow: ";
399 oldSize = yyyTravStackMaxSize;
403 newSize = (3*oldSize)/2;
404 if (newSize < 100) newSize = 100;
406 fprintf(stderr,"size was %ld.\n",oldSize);
407 msg2 = " Have to modify evaluator: -Y%c%ld.\n";
408 fprintf(stderr,msg2,which,newSize);
414 void yyySignalEnts(yyyGNT *node,long startP,long stopP)
417 while (startP < stopP)
419 if (!yyyEntL[startP]) dumNode = node;
420 else dumNode = (node->cL)[yyyEntL[startP]-1];
421 if (!(--((dumNode->refCountList)[yyyEntL[startP+1]]
426 if (++yyyRSTop == yyyAfterRS)
427 {yyyHandleOverflow(yyyRSof);
430 yyyRSTop->node = dumNode;
431 yyyRSTop->whichSym = yyyEntL[startP];
432 yyyRSTop->wa = yyyEntL[startP+1];
443 void yyySolveAndSignal() {
446 yyyGNT *yyyRSTopN,*yyyRefN;
447 yyyParent yyyRSTopNp;
450 yyyRSTopNp = (yyyRSTopN = yyyRSTop->node)->parent;
451 yyyRefN= (yyyws = (yyyRSTop->whichSym))?yyyRSTopNp.noderef:yyyRSTopN;
452 yyywa = yyyRSTop->wa;
454 switch(yyyRefN->prodNum) {
455 case 1: /***yacc rule 1***/
459 case 2: /***yacc rule 2***/
463 case 3: /***yacc rule 3***/
467 case 4: /***yacc rule 4***/
471 case 5: /***yacc rule 5***/
475 case 6: /***yacc rule 6***/
479 case 7: /***yacc rule 7***/
487 case 8: /***yacc rule 8***/
497 if (yyyws) /* the just-solved instance was inherited. */
498 {if (yyyRSTopN->prodNum)
499 {yyyiDum = yyyIIEL[yyyIIIEL[yyyRSTopN->prodNum]] + yyywa;
500 yyySignalEnts(yyyRSTopN,yyyIEL[yyyiDum],
505 else /* the just-solved instance was synthesized. */
506 {if (!(yyyRSTopN->parentIsStack)) /* node has a parent. */
507 {yyyiDum = yyyIIEL[yyyIIIEL[yyyRSTopNp.noderef->prodNum] +
511 yyySignalEnts(yyyRSTopNp.noderef,
516 else /* node is still on the stack--it has no parent yet. */
517 {yyypL = &(yyyRSTopNp.stackref->solvedSAlist);
518 if (yyySSALCfreeList == yyyLambdaSSAL)
519 {yyySSALspace[yyyNewSSALC].next = *yyypL;
520 if ((*yyypL = yyyNewSSALC++) == yyySSALspaceSize)
521 yyyHandleOverflow(yyySSALof);
524 {yyyiDum = yyySSALCfreeList;
525 yyySSALCfreeList = yyySSALspace[yyySSALCfreeList].next;
526 yyySSALspace[yyyiDum].next = *yyypL;
529 yyySSALspace[*yyypL].attrbNum = yyywa;
533 } /* yyySolveAndSignal */
540 #define condStg unsigned int conds;
541 #define yyyClearConds {yyyTST->conds = 0;}
542 #define yyySetCond(n) {yyyTST->conds += (1<<(n));}
543 #define yyyCond(n) ((yyyTST->conds & (1<<(n)))?1:0)
547 struct yyyTravStackItem {yyyGNT *node;
554 void yyyDoTraversals(yyyGNT *rootNode)
555 {struct yyyTravStackItem *yyyTravStack,*yyyTST,*yyyAfterTravStack;
556 yyyGNT *yyyTSTn,**yyyCLptr2;
557 int yyyi,yyyRL,yyyPass;
562 ((struct yyyTravStackItem *)
563 calloc((size_t)yyyTravStackMaxSize,
564 (size_t)sizeof(struct yyyTravStackItem)
569 (struct yyyTravStackItem *)NULL
571 {fputs("malloc error in traversal stack allocation\n",stderr);
575 yyyAfterTravStack = yyyTravStack + yyyTravStackMaxSize;
579 for (yyyi=0; yyyi<2; yyyi++) {
580 yyyTST = yyyTravStack;
581 yyyTST->node = rootNode;
585 while(yyyTST >= yyyTravStack)
586 {yyyTSTn = yyyTST->node;
598 if (yyyTSTn->prodNum)
600 {yyyCLptr2 = yyyTSTn->cL;
603 {if (++yyyTST == yyyAfterTravStack)
604 yyyHandleOverflow(yyyTSof);
606 {yyyTST->node = *yyyCLptr2;
612 } /* right to left */
613 else /* left to right */
615 yyyCLptr2 = yyyTSTn->cL + i;
618 if (++yyyTST == yyyAfterTravStack)
619 yyyHandleOverflow(yyyTSof);
621 {yyyTST->node = *yyyCLptr2;
626 } /* left to right */
631 switch(yyyTSTn->prodNum) {
637 yyyRL = 0;yyySetCond(0)
642 #line 444 "expr.oxout.y"
648 if (yyyCond(0) != yyyPass) {
651 #line 453 "expr.oxout.y"
653 if (yyyCond(1) != yyyPass) {
657 #line 459 "expr.oxout.y"
659 if (yyyCond(2) != yyyPass) {
663 #line 465 "expr.oxout.y"
675 #line 477 "expr.oxout.y"
680 if (yyyCond(0) != yyyPass) {
684 #line 486 "expr.oxout.y"
686 if (yyyCond(1) != yyyPass) {
689 #line 491 "expr.oxout.y"
691 if (yyyCond(2) != yyyPass) {
693 printf("postfix: ")/* missing ; */
695 #line 497 "expr.oxout.y"
708 yyyRL = 0;yyySetCond(0)
712 if (yyyCond(0) != yyyPass) {
716 #line 518 "expr.oxout.y"
727 if (yyyCond(0) != yyyPass) {
731 #line 533 "expr.oxout.y"
744 yyyRL = 0;yyySetCond(0)
748 if (yyyCond(0) != yyyPass) {
752 #line 554 "expr.oxout.y"
763 if (yyyCond(0) != yyyPass) {
767 #line 569 "expr.oxout.y"
780 yyyRL = 0;yyySetCond(0)
784 if (yyyCond(0) != yyyPass) {
788 #line 590 "expr.oxout.y"
799 if (yyyCond(0) != yyyPass) {
803 #line 605 "expr.oxout.y"
816 yyyRL = 0;yyySetCond(0)
820 if (yyyCond(0) != yyyPass) {
824 #line 626 "expr.oxout.y"
835 if (yyyCond(0) != yyyPass) {
839 #line 641 "expr.oxout.y"
875 yyyRL = 0;yyySetCond(0)
879 if (yyyCond(0) != yyyPass) {
881 printf(" %s ",yyyTSTn->cL[0]->yyyAttrbs.yyyAttrb1.lexeme);
883 #line 685 "expr.oxout.y"
894 if (yyyCond(0) != yyyPass) {
896 printf(" %s ",yyyTSTn->cL[0]->yyyAttrbs.yyyAttrb1.lexeme);
898 #line 700 "expr.oxout.y"
911 yyyRL = 0;yyySetCond(0)
915 if (yyyCond(0) != yyyPass) {
917 printf(" %s ",yyyTSTn->cL[0]->yyyAttrbs.yyyAttrb1.lexeme);
919 #line 721 "expr.oxout.y"
930 if (yyyCond(0) != yyyPass) {
932 printf(" %s ",yyyTSTn->cL[0]->yyyAttrbs.yyyAttrb1.lexeme);
934 #line 736 "expr.oxout.y"
943 if (yyyPass) goto yyyTpop; else goto yyyTpush;
946 } /* yyyDoTraversals */
948 void yyyExecuteRRsection(yyyGNT *rootNode) {
954 yyyCheckUnsolvedInstTrav(rootNode,&nNZrc,&cycleSum);
957 fputs("\n\n\n**********\n",stderr);
958 fputs("cycle detected in completed parse tree",stderr);
959 fputs(" after decoration.\n",stderr);
962 "number of unsolved attribute instances == %ld.\n",
966 "total number of remaining dependencies == %ld.\n",
969 fputs("average number of remaining dependencies\n",stderr);
970 fprintf(stderr," per unsolved instance == %f.\n",
971 ((float)(cycleSum)/(float)(nNZrc))
975 "searching parse tree for %ld unsolved instances:\n",
978 yyyUnsolvedInstSearchTravAux(rootNode);
980 yyyDoTraversals(rootNode);
981 } /* yyyExecuteRRsection */
985 yyyWAT yyyLRCIL[2] = {0,0,
990 void yyyYoxInit(void)
992 static int yyyInitDone = 0;
993 if (yyyInitDone) return;
995 if ((yyyRS = (struct yyyRSitem *)
996 calloc((size_t)(yyyRSmaxSize+1), (size_t)sizeof(struct yyyRSitem))
999 ((struct yyyRSitem *) NULL)
1001 yyyfatal("malloc error in ox ready set space allocation\n");
1003 yyyAfterRS = yyyRS + yyyRSmaxSize;
1006 if ((yyySSALspace = (struct yyySolvedSAlistCell *)
1007 calloc((size_t)(yyySSALspaceSize+1), (size_t)sizeof(struct yyySolvedSAlistCell))
1010 ((struct yyySolvedSAlistCell *) NULL)
1012 yyyfatal("malloc error in stack solved list space allocation\n");
1015 yyyRSTop = yyyRS - 1;
1020 void yyyDecorate(void)
1022 while (yyyRSTop >= yyyRS)
1023 yyySolveAndSignal();
1028 void yyyGenIntNode(long yyyProdNum, int yyyRHSlength, int yyyNattrbs, struct yyyOxAttrbs *yyval_OxAttrbs, ...)
1030 yyySIT **yyyOxStackItem = &yyval_OxAttrbs->yyyOxStackItem;
1034 *yyyOxStackItem = (yyySIT *) malloc((size_t)sizeof(yyySIT));
1035 if (*yyyOxStackItem == (yyySIT *) NULL)
1036 yyyfatal("malloc error in ox yacc semantic stack space allocation\n");
1037 (*yyyOxStackItem)->node =
1038 (yyyGNT *) malloc((size_t)sizeof(yyyGNT));
1039 if ((*yyyOxStackItem)->node == (yyyGNT *) NULL)
1040 yyyfatal("malloc error in ox node space allocation\n");
1041 (*yyyOxStackItem)->solvedSAlist = yyyLambdaSSAL;
1042 (*yyyOxStackItem)->node->parent.stackref = *yyyOxStackItem;
1043 (*yyyOxStackItem)->node->parentIsStack = 1;
1044 (*yyyOxStackItem)->node->cLlen = yyyRHSlength;
1045 (*yyyOxStackItem)->node->cL =
1046 (yyyGNT **) calloc((size_t)yyyRHSlength, (size_t)sizeof(yyyGNT *));
1047 if ((*yyyOxStackItem)->node->cL == (yyyGNT **) NULL)
1048 yyyfatal("malloc error in ox child list space allocation\n");
1049 (*yyyOxStackItem)->node->refCountListLen = yyyNattrbs;
1050 (*yyyOxStackItem)->node->refCountList =
1051 (yyyRCT *) calloc((size_t)yyyNattrbs, (size_t)sizeof(yyyRCT));
1052 if ((*yyyOxStackItem)->node->refCountList == (yyyRCT *) NULL)
1053 yyyfatal("malloc error in ox reference count list space allocation\n");
1054 (*yyyOxStackItem)->node->prodNum = yyyProdNum;
1055 va_start(ap, yyval_OxAttrbs);
1056 for (i=1;i<=yyyRHSlength;i++)
1057 {yyySIT *yaccStDum = va_arg(ap,struct yyyOxAttrbs *)->yyyOxStackItem;
1058 gnpDum = (*yyyOxStackItem)->node->cL[i-1] = yaccStDum->node;
1059 gnpDum->whichSym = i;
1060 gnpDum->parent.noderef = (*yyyOxStackItem)->node;
1061 gnpDum->parentIsStack = 0;
1068 #define yyyDECORfREQ 50
1072 void yyyAdjustINRC(long yyyProdNum, int yyyRHSlength, long startP, long stopP, struct yyyOxAttrbs *yyval_OxAttrbs, ...)
1074 yyySIT *yyyOxStackItem = yyval_OxAttrbs->yyyOxStackItem;
1075 long SSALptr,SSALptrHead,*cPtrPtr;
1080 static unsigned short intNodeCount = yyyDECORfREQ;
1084 while (nextP < stopP)
1085 {if (yyyRCIL[nextP] == yyyR)
1086 {(yyyOxStackItem->node->refCountList)[yyyRCIL[nextP+1]] = yyyRCIL[nextP+2];
1089 {(((yyyOxStackItem->node->cL)[yyyRCIL[nextP]])->refCountList)[yyyRCIL[nextP+1]] = yyyRCIL[nextP+2];
1093 pL = yyyIIEL + yyyIIIEL[yyyProdNum];
1094 va_start(ap, yyval_OxAttrbs);
1095 for (i=1;i<=yyyRHSlength;i++)
1096 {yyySIT *yaccStDum = va_arg(ap,struct yyyOxAttrbs *)->yyyOxStackItem;
1098 SSALptrHead = SSALptr = *(cPtrPtr = &(yaccStDum->solvedSAlist));
1099 if (SSALptr != yyyLambdaSSAL)
1100 {*cPtrPtr = yyyLambdaSSAL;
1103 iTemp = (*pL+yyySSALspace[SSALptr].attrbNum);
1104 yyySignalEnts(yyyOxStackItem->node,
1108 SSALptr = *(cPtrPtr = &(yyySSALspace[SSALptr].next));
1110 while (SSALptr != yyyLambdaSSAL);
1111 *cPtrPtr = yyySSALCfreeList;
1112 yyySSALCfreeList = SSALptrHead;
1117 while (nextP < stopP)
1118 {if (!yyyRCIL[nextP])
1119 {if (yyyRCIL[nextP-2] == yyyR)
1120 {pL = &(yyyOxStackItem->solvedSAlist);
1121 if (yyySSALCfreeList == yyyLambdaSSAL)
1122 {yyySSALspace[yyyNewSSALC].next = *pL;
1123 if ((*pL = yyyNewSSALC++) == yyySSALspaceSize)
1124 yyyHandleOverflow(yyySSALof);
1127 {iTemp = yyySSALCfreeList;
1128 yyySSALCfreeList = yyySSALspace[yyySSALCfreeList].next;
1129 yyySSALspace[iTemp].next = *pL;
1132 yyySSALspace[*pL].attrbNum = yyyRCIL[nextP-1];
1135 {if ((gnpDum = (yyyOxStackItem->node->cL)[yyyRCIL[nextP-2]])->prodNum != 0)
1137 iTemp = yyyIIEL[yyyIIIEL[gnpDum->prodNum]] + yyyRCIL[nextP-1];
1138 yyySignalEnts(gnpDum,
1147 if (!--intNodeCount)
1148 {intNodeCount = yyyDECORfREQ;
1155 void yyyGenLeaf(int nAttrbs,int typeNum,long startP,long stopP,YYSTYPE *yylval)
1157 yyySIT **yyyOxStackItem = &yylval->yyyOxAttrbs.yyyOxStackItem;
1158 (*yyyOxStackItem) = (yyySIT *) malloc((size_t)sizeof(yyySIT));
1159 if ((*yyyOxStackItem) == (yyySIT *) NULL)
1160 yyyfatal("malloc error in ox yacc semantic stack space allocation\n");
1161 (*yyyOxStackItem)->node =
1162 (yyyGNT *) malloc((size_t)sizeof(yyyGNT))
1164 if ((*yyyOxStackItem)->node == (yyyGNT *) NULL)
1165 yyyfatal("malloc error in ox node space allocation\n");
1166 (*yyyOxStackItem)->solvedSAlist = yyyLambdaSSAL;
1167 (*yyyOxStackItem)->node->parent.stackref = *yyyOxStackItem;
1168 (*yyyOxStackItem)->node->parentIsStack = 1;
1169 (*yyyOxStackItem)->node->cLlen = 0;
1170 (*yyyOxStackItem)->node->cL = (yyyGNT **)NULL;
1171 (*yyyOxStackItem)->node->refCountListLen = nAttrbs;
1172 rcPdum = (*yyyOxStackItem)->node->refCountList =
1173 (yyyRCT *) calloc((size_t)nAttrbs, (size_t)sizeof(yyyRCT));
1174 if (rcPdum == (yyyRCT *) NULL)
1175 yyyfatal("malloc error in ox reference count list space allocation\n");
1176 while (startP < stopP) rcPdum[yyyLRCIL[startP++]] = 0;
1177 (*yyyOxStackItem)->node->prodNum = 0;
1178 (*yyyOxStackItem)->node->whichSym = 0;
1191 #define yyyLastProdNum 8
1197 int yyyProdsInd[] = {
1199 0, 2, 6, 10, 14, 18, 22, 24,
1204 int yyyProds[][2] = {
1205 { 116, 0},{ 462, 0},{ 462, 0},{ 462, 0},{ 412, 0},
1206 { 462, 0},{ 462, 0},{ 462, 0},{ 420, 0},{ 462, 0},
1207 { 462, 0},{ 462, 0},{ 452, 0},{ 462, 0},{ 462, 0},
1208 { 462, 0},{ 436, 0},{ 462, 0},{ 462, 0},{ 396, 0},
1209 { 462, 0},{ 404, 0},{ 462, 0},{ 619, 1},{ 462, 0},
1214 int yyySortsInd[] = {
1227 char *yyyStringTab[] = {
1310 0,0,"'*'","lexeme",0,
1341 0,0,"CONST","LRpost",0,
1479 #define yyySizeofProd(num) (yyyProdsInd[(num)+1] - yyyProdsInd[(num)])
1481 #define yyyGSoccurStr(prodNum,symPos) \
1482 (yyyStringTab[yyyProds[yyyProdsInd[(prodNum)] + (symPos)][0]])
1484 #define yyySizeofSort(num) (yyySortsInd[(num)+1] - yyySortsInd[(num)])
1486 #define yyySortOf(prodNum,symPos) \
1487 (yyyProds[yyyProdsInd[(prodNum)] + (symPos)][1])
1489 #define yyyAttrbStr(prodNum,symPos,attrbNum) \
1490 (yyyStringTab[yyySorts[yyySortsInd[yyySortOf(prodNum,symPos)] + \
1498 void yyyShowProd(int i)
1501 nSyms = yyySizeofProd(i);
1502 for (j=0; j<nSyms; j++)
1504 fprintf(stderr,"%s",yyyGSoccurStr(i,j));
1505 if (j == 0) fputs(" : ",stderr); else putc(' ',stderr);
1507 fputs(";\n",stderr);
1513 {int i; for (i=1; i<=yyyLastProdNum; i++) yyyShowProd(i);}
1517 void yyyShowSymsAndSorts()
1520 for (i=1; i<=yyyLastProdNum; i++)
1524 "\n\n\n---------------------------------- %3.1d\n",i);
1525 /* yyyShowProd(i); */
1526 nSyms = yyySizeofProd(i);
1527 for (j=0; j<nSyms; j++)
1530 fprintf(stderr,"%s\n",yyyGSoccurStr(i,j));
1531 sortSize = yyySizeofSort(yyySortOf(i,j));
1532 for (k=0; k<sortSize; k++)
1533 fprintf(stderr," %s\n",yyyAttrbStr(i,j,k));
1534 if (j == 0) fputs("->\n",stderr);
1543 void yyyCheckNodeInstancesSolved(yyyGNT *np)
1544 {int mysort,sortSize,i,prodNum,symPos,inTerminalNode;
1545 int nUnsolvedInsts = 0;
1547 if (np->prodNum != 0)
1548 {inTerminalNode = 0;
1549 prodNum = np->prodNum;
1553 {inTerminalNode = 1;
1554 prodNum = np->parent.noderef->prodNum;
1555 symPos = np->whichSym;
1557 mysort = yyySortOf(prodNum,symPos);
1558 sortSize = yyySizeofSort(mysort);
1559 for (i=0; i<sortSize; i++)
1560 if ((np->refCountList)[i] != 0) nUnsolvedInsts += 1;
1563 "\nFound node that has %d unsolved attribute instance(s).\n",
1566 fprintf(stderr,"Node is labeled \"%s\".\n",
1567 yyyGSoccurStr(prodNum,symPos));
1569 {fputs("Node is terminal. Its parent production is:\n ",stderr);
1570 yyyShowProd(prodNum);
1573 {fputs("Node is nonterminal. ",stderr);
1574 if (!(np->parentIsStack))
1576 "Node is %dth child in its parent production:\n ",
1579 yyyShowProd(np->parent.noderef->prodNum);
1581 fputs("Node is on left hand side of this production:\n ",stderr);
1582 yyyShowProd(np->prodNum);
1584 fputs("The following instances are unsolved:\n",stderr);
1585 for (i=0; i<sortSize; i++)
1586 if ((np->refCountList)[i] != 0)
1587 fprintf(stderr," %-16s still has %1d dependencies.\n",
1588 yyyAttrbStr(prodNum,symPos,i),(np->refCountList)[i]);
1594 void yyyCheckUnsolvedInstTrav(yyyGNT *pNode,long *nNZrc,long *cycleSum)
1595 {yyyGNT **yyyCLpdum;
1599 /* visit the refCountList of each node in the tree, and sum the non-zero refCounts */
1600 rcp = pNode->refCountList;
1601 i = pNode->refCountListLen;
1603 if (*rcp++) {*cycleSum += *(rcp - 1); (*nNZrc)++;}
1604 yyyCLpdum = pNode->cL;
1608 yyyCheckUnsolvedInstTrav(*yyyCLpdum,nNZrc,cycleSum);
1615 void yyyUnsolvedInstSearchTravAux(yyyGNT *pNode)
1616 {yyyGNT **yyyCLpdum;
1619 yyyCheckNodeInstancesSolved(pNode);
1620 yyyCLpdum = pNode->cL;
1624 yyyUnsolvedInstSearchTravAux(*yyyCLpdum);
1631 void yyyUnsolvedInstSearchTrav(yyyGNT *pNode)
1632 {yyyGNT **yyyCLpdum;
1635 yyyCLpdum = pNode->cL;
1639 yyyUnsolvedInstSearchTravAux(*yyyCLpdum);
1646 #line 1647 "expr.oxout.tab.c"
1649 #include <stdio.h> /* needed for printf */
1652 #include <stdlib.h> /* needed for malloc, etc */
1653 #include <string.h> /* needed for memset */
1655 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
1656 static int yygrowstack(YYSTACKDATA *data)
1663 if ((newsize = data->stacksize) == 0)
1664 newsize = YYINITSTACKSIZE;
1665 else if (newsize >= YYMAXDEPTH)
1667 else if ((newsize *= 2) > YYMAXDEPTH)
1668 newsize = YYMAXDEPTH;
1670 i = (int) (data->s_mark - data->s_base);
1671 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
1675 data->s_base = newss;
1676 data->s_mark = newss + i;
1678 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
1682 data->l_base = newvs;
1683 data->l_mark = newvs + i;
1685 data->stacksize = newsize;
1686 data->s_last = data->s_base + newsize - 1;
1690 #if YYPURE || defined(YY_NO_LEAKS)
1691 static void yyfreestack(YYSTACKDATA *data)
1695 memset(data, 0, sizeof(*data));
1698 #define yyfreestack(data) /* nothing */
1701 #define YYABORT goto yyabort
1702 #define YYREJECT goto yyabort
1703 #define YYACCEPT goto yyaccept
1704 #define YYERROR goto yyerrlab
1709 int yym, yyn, yystate;
1713 if ((yys = getenv("YYDEBUG")) != 0)
1716 if (yyn >= '0' && yyn <= '9')
1717 yydebug = yyn - '0';
1729 memset(&yystack, 0, sizeof(yystack));
1732 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1733 yystack.s_mark = yystack.s_base;
1734 yystack.l_mark = yystack.l_base;
1736 *yystack.s_mark = 0;
1739 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
1743 if (yychar < 0) yychar = YYEOF;
1747 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1748 printf("%sdebug: state %d, reading %d (%s)\n",
1749 YYPREFIX, yystate, yychar, yys);
1753 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
1754 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
1758 printf("%sdebug: state %d, shifting to state %d\n",
1759 YYPREFIX, yystate, yytable[yyn]);
1761 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1762 yystate = yytable[yyn];
1763 *++yystack.s_mark = yytable[yyn];
1764 *++yystack.l_mark = yylval;
1766 if (yyerrflag > 0) --yyerrflag;
1769 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
1770 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
1775 if (yyerrflag != 0) goto yyinrecovery;
1777 YYERROR_CALL("syntax error");
1779 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
1789 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
1790 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
1794 printf("%sdebug: state %d, error recovery shifting\
1795 to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
1797 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1798 yystate = yytable[yyn];
1799 *++yystack.s_mark = yytable[yyn];
1800 *++yystack.l_mark = yylval;
1807 printf("%sdebug: error recovery discarding state %d\n",
1808 YYPREFIX, *yystack.s_mark);
1810 if (yystack.s_mark <= yystack.s_base) goto yyabort;
1818 if (yychar == YYEOF) goto yyabort;
1822 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1823 printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
1824 YYPREFIX, yystate, yychar, yys);
1834 printf("%sdebug: state %d, reducing by rule %d (%s)\n",
1835 YYPREFIX, yystate, yyn, yyrule[yyn]);
1839 yyval = yystack.l_mark[1-yym];
1841 memset(&yyval, 0, sizeof yyval);
1846 #line 64 "expr.oxout.y"
1850 #line 66 "expr.oxout.y"
1852 yyyDecorate(); yyyExecuteRRsection(yystack.l_mark[0].yyyOxAttrbs.yyyOxStackItem->node);
1856 #line 73 "expr.oxout.y"
1858 yyyGenIntNode(1,1,0,&yyval.yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);
1859 yyyAdjustINRC(1,1,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}}
1862 #line 80 "expr.oxout.y"
1864 yyyGenIntNode(2,3,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);
1865 yyyAdjustINRC(2,3,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}}
1868 #line 87 "expr.oxout.y"
1870 yyyGenIntNode(3,3,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);
1871 yyyAdjustINRC(3,3,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}}
1874 #line 94 "expr.oxout.y"
1876 yyyGenIntNode(4,3,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);
1877 yyyAdjustINRC(4,3,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}}
1880 #line 101 "expr.oxout.y"
1882 yyyGenIntNode(5,3,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);
1883 yyyAdjustINRC(5,3,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}}
1886 #line 108 "expr.oxout.y"
1888 yyyGenIntNode(6,3,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);
1889 yyyAdjustINRC(6,3,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}}
1892 #line 114 "expr.oxout.y"
1894 yyyGenIntNode(7,1,0,&yyval.yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);
1895 yyyAdjustINRC(7,1,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}}
1898 #line 121 "expr.oxout.y"
1900 yyyGenIntNode(8,1,0,&yyval.yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);
1901 yyyAdjustINRC(8,1,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}}
1903 #line 1904 "expr.oxout.tab.c"
1905 yystack.s_mark -= yym;
1906 yystate = *yystack.s_mark;
1907 yystack.l_mark -= yym;
1909 if (yystate == 0 && yym == 0)
1913 printf("%sdebug: after reduction, shifting from state 0 to\
1914 state %d\n", YYPREFIX, YYFINAL);
1917 *++yystack.s_mark = YYFINAL;
1918 *++yystack.l_mark = yyval;
1922 if (yychar < 0) yychar = YYEOF;
1926 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1927 printf("%sdebug: state %d, reading %d (%s)\n",
1928 YYPREFIX, YYFINAL, yychar, yys);
1932 if (yychar == YYEOF) goto yyaccept;
1935 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1936 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1937 yystate = yytable[yyn];
1939 yystate = yydgoto[yym];
1942 printf("%sdebug: after reduction, shifting from state %d \
1943 to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
1945 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1946 *++yystack.s_mark = (YYINT) yystate;
1947 *++yystack.l_mark = yyval;
1951 YYERROR_CALL("yacc stack overflow");
1954 yyfreestack(&yystack);
1958 yyfreestack(&yystack);