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 ')'",
298 /* define the initial stack-sizes */
301 #define YYMAXDEPTH YYSTACKSIZE
304 #define YYSTACKSIZE YYMAXDEPTH
306 #define YYSTACKSIZE 10000
307 #define YYMAXDEPTH 10000
311 #define YYINITSTACKSIZE 200
321 /* variables for the parser stack */
322 static YYSTACKDATA yystack;
334 #line 138 "expr.oxout.y"
335 long yyySSALspaceSize = 20000;
336 long yyyRSmaxSize = 1000;
337 long yyyTravStackMaxSize = 2000;
339 struct yyySolvedSAlistCell {yyyWAT attrbNum;
343 #define yyyLambdaSSAL 0
344 long yyySSALCfreeList = yyyLambdaSSAL;
345 long yyyNewSSALC = 1;
347 struct yyySolvedSAlistCell *yyySSALspace;
349 long yyyNbytesStackStg;
355 short yyyIIIEL[] = {0,
356 0,2,6,10,14,18,22,24,
360 0,0,0,0,0,0,0,0,0,0,0,0,
361 0,0,0,0,0,0,0,0,0,0,0,0,
371 void yyyfatal(char *msg)
372 {fputs(msg,stderr);exit(-1);}
376 #define yyySSALof 'S'
382 void yyyHandleOverflow(char which)
384 long oldSize,newSize;
388 msg1 = "SSAL overflow: ";
389 oldSize = yyySSALspaceSize;
392 msg1 = "ready set overflow: ";
393 oldSize = yyyRSmaxSize;
396 msg1 = "traversal stack overflow: ";
397 oldSize = yyyTravStackMaxSize;
401 newSize = (3*oldSize)/2;
402 if (newSize < 100) newSize = 100;
404 fprintf(stderr,"size was %ld.\n",oldSize);
405 msg2 = " Have to modify evaluator: -Y%c%ld.\n";
406 fprintf(stderr,msg2,which,newSize);
412 void yyySignalEnts(yyyGNT *node,long startP,long stopP)
415 while (startP < stopP)
417 if (!yyyEntL[startP]) dumNode = node;
418 else dumNode = (node->cL)[yyyEntL[startP]-1];
419 if (!(--((dumNode->refCountList)[yyyEntL[startP+1]]
424 if (++yyyRSTop == yyyAfterRS)
425 {yyyHandleOverflow(yyyRSof);
428 yyyRSTop->node = dumNode;
429 yyyRSTop->whichSym = yyyEntL[startP];
430 yyyRSTop->wa = yyyEntL[startP+1];
441 void yyySolveAndSignal() {
444 yyyGNT *yyyRSTopN,*yyyRefN;
445 yyyParent yyyRSTopNp;
448 yyyRSTopNp = (yyyRSTopN = yyyRSTop->node)->parent;
449 yyyRefN= (yyyws = (yyyRSTop->whichSym))?yyyRSTopNp.noderef:yyyRSTopN;
450 yyywa = yyyRSTop->wa;
452 switch(yyyRefN->prodNum) {
453 case 1: /***yacc rule 1***/
457 case 2: /***yacc rule 2***/
461 case 3: /***yacc rule 3***/
465 case 4: /***yacc rule 4***/
469 case 5: /***yacc rule 5***/
473 case 6: /***yacc rule 6***/
477 case 7: /***yacc rule 7***/
485 case 8: /***yacc rule 8***/
495 if (yyyws) /* the just-solved instance was inherited. */
496 {if (yyyRSTopN->prodNum)
497 {yyyiDum = yyyIIEL[yyyIIIEL[yyyRSTopN->prodNum]] + yyywa;
498 yyySignalEnts(yyyRSTopN,yyyIEL[yyyiDum],
503 else /* the just-solved instance was synthesized. */
504 {if (!(yyyRSTopN->parentIsStack)) /* node has a parent. */
505 {yyyiDum = yyyIIEL[yyyIIIEL[yyyRSTopNp.noderef->prodNum] +
509 yyySignalEnts(yyyRSTopNp.noderef,
514 else /* node is still on the stack--it has no parent yet. */
515 {yyypL = &(yyyRSTopNp.stackref->solvedSAlist);
516 if (yyySSALCfreeList == yyyLambdaSSAL)
517 {yyySSALspace[yyyNewSSALC].next = *yyypL;
518 if ((*yyypL = yyyNewSSALC++) == yyySSALspaceSize)
519 yyyHandleOverflow(yyySSALof);
522 {yyyiDum = yyySSALCfreeList;
523 yyySSALCfreeList = yyySSALspace[yyySSALCfreeList].next;
524 yyySSALspace[yyyiDum].next = *yyypL;
527 yyySSALspace[*yyypL].attrbNum = yyywa;
531 } /* yyySolveAndSignal */
538 #define condStg unsigned int conds;
539 #define yyyClearConds {yyyTST->conds = 0;}
540 #define yyySetCond(n) {yyyTST->conds += (1<<(n));}
541 #define yyyCond(n) ((yyyTST->conds & (1<<(n)))?1:0)
545 struct yyyTravStackItem {yyyGNT *node;
552 void yyyDoTraversals(yyyGNT *rootNode)
553 {struct yyyTravStackItem *yyyTravStack,*yyyTST,*yyyAfterTravStack;
554 yyyGNT *yyyTSTn,**yyyCLptr2;
555 int yyyi,yyyRL,yyyPass;
560 ((struct yyyTravStackItem *)
561 calloc((size_t)yyyTravStackMaxSize,
562 (size_t)sizeof(struct yyyTravStackItem)
567 (struct yyyTravStackItem *)NULL
569 {fputs("malloc error in traversal stack allocation\n",stderr);
573 yyyAfterTravStack = yyyTravStack + yyyTravStackMaxSize;
577 for (yyyi=0; yyyi<2; yyyi++) {
578 yyyTST = yyyTravStack;
579 yyyTST->node = rootNode;
583 while(yyyTST >= yyyTravStack)
584 {yyyTSTn = yyyTST->node;
596 if (yyyTSTn->prodNum)
598 {yyyCLptr2 = yyyTSTn->cL;
601 {if (++yyyTST == yyyAfterTravStack)
602 yyyHandleOverflow(yyyTSof);
604 {yyyTST->node = *yyyCLptr2;
610 } /* right to left */
611 else /* left to right */
613 yyyCLptr2 = yyyTSTn->cL + i;
616 if (++yyyTST == yyyAfterTravStack)
617 yyyHandleOverflow(yyyTSof);
619 {yyyTST->node = *yyyCLptr2;
624 } /* left to right */
629 switch(yyyTSTn->prodNum) {
635 yyyRL = 0;yyySetCond(0)
640 #line 444 "expr.oxout.y"
646 if (yyyCond(0) != yyyPass) {
649 #line 453 "expr.oxout.y"
651 if (yyyCond(1) != yyyPass) {
655 #line 459 "expr.oxout.y"
657 if (yyyCond(2) != yyyPass) {
661 #line 465 "expr.oxout.y"
673 #line 477 "expr.oxout.y"
678 if (yyyCond(0) != yyyPass) {
682 #line 486 "expr.oxout.y"
684 if (yyyCond(1) != yyyPass) {
687 #line 491 "expr.oxout.y"
689 if (yyyCond(2) != yyyPass) {
691 printf("postfix: ")/* missing ; */
693 #line 497 "expr.oxout.y"
706 yyyRL = 0;yyySetCond(0)
710 if (yyyCond(0) != yyyPass) {
714 #line 518 "expr.oxout.y"
725 if (yyyCond(0) != yyyPass) {
729 #line 533 "expr.oxout.y"
742 yyyRL = 0;yyySetCond(0)
746 if (yyyCond(0) != yyyPass) {
750 #line 554 "expr.oxout.y"
761 if (yyyCond(0) != yyyPass) {
765 #line 569 "expr.oxout.y"
778 yyyRL = 0;yyySetCond(0)
782 if (yyyCond(0) != yyyPass) {
786 #line 590 "expr.oxout.y"
797 if (yyyCond(0) != yyyPass) {
801 #line 605 "expr.oxout.y"
814 yyyRL = 0;yyySetCond(0)
818 if (yyyCond(0) != yyyPass) {
822 #line 626 "expr.oxout.y"
833 if (yyyCond(0) != yyyPass) {
837 #line 641 "expr.oxout.y"
873 yyyRL = 0;yyySetCond(0)
877 if (yyyCond(0) != yyyPass) {
879 printf(" %s ",yyyTSTn->cL[0]->yyyAttrbs.yyyAttrb1.lexeme);
881 #line 685 "expr.oxout.y"
892 if (yyyCond(0) != yyyPass) {
894 printf(" %s ",yyyTSTn->cL[0]->yyyAttrbs.yyyAttrb1.lexeme);
896 #line 700 "expr.oxout.y"
909 yyyRL = 0;yyySetCond(0)
913 if (yyyCond(0) != yyyPass) {
915 printf(" %s ",yyyTSTn->cL[0]->yyyAttrbs.yyyAttrb1.lexeme);
917 #line 721 "expr.oxout.y"
928 if (yyyCond(0) != yyyPass) {
930 printf(" %s ",yyyTSTn->cL[0]->yyyAttrbs.yyyAttrb1.lexeme);
932 #line 736 "expr.oxout.y"
941 if (yyyPass) goto yyyTpop; else goto yyyTpush;
944 } /* yyyDoTraversals */
946 void yyyExecuteRRsection(yyyGNT *rootNode) {
952 yyyCheckUnsolvedInstTrav(rootNode,&nNZrc,&cycleSum);
955 fputs("\n\n\n**********\n",stderr);
956 fputs("cycle detected in completed parse tree",stderr);
957 fputs(" after decoration.\n",stderr);
960 "number of unsolved attribute instances == %ld.\n",
964 "total number of remaining dependencies == %ld.\n",
967 fputs("average number of remaining dependencies\n",stderr);
968 fprintf(stderr," per unsolved instance == %f.\n",
969 ((float)(cycleSum)/(float)(nNZrc))
973 "searching parse tree for %ld unsolved instances:\n",
976 yyyUnsolvedInstSearchTravAux(rootNode);
978 yyyDoTraversals(rootNode);
979 } /* yyyExecuteRRsection */
983 yyyWAT yyyLRCIL[2] = {0,0,
988 void yyyYoxInit(void)
990 static int yyyInitDone = 0;
991 if (yyyInitDone) return;
993 if ((yyyRS = (struct yyyRSitem *)
994 calloc((size_t)(yyyRSmaxSize+1), (size_t)sizeof(struct yyyRSitem))
997 ((struct yyyRSitem *) NULL)
999 yyyfatal("malloc error in ox ready set space allocation\n");
1001 yyyAfterRS = yyyRS + yyyRSmaxSize;
1004 if ((yyySSALspace = (struct yyySolvedSAlistCell *)
1005 calloc((size_t)(yyySSALspaceSize+1), (size_t)sizeof(struct yyySolvedSAlistCell))
1008 ((struct yyySolvedSAlistCell *) NULL)
1010 yyyfatal("malloc error in stack solved list space allocation\n");
1013 yyyRSTop = yyyRS - 1;
1018 void yyyDecorate(void)
1020 while (yyyRSTop >= yyyRS)
1021 yyySolveAndSignal();
1026 void yyyGenIntNode(long yyyProdNum, int yyyRHSlength, int yyyNattrbs, struct yyyOxAttrbs *yyval_OxAttrbs, ...)
1028 yyySIT **yyyOxStackItem = &yyval_OxAttrbs->yyyOxStackItem;
1032 *yyyOxStackItem = (yyySIT *) malloc((size_t)sizeof(yyySIT));
1033 if (*yyyOxStackItem == (yyySIT *) NULL)
1034 yyyfatal("malloc error in ox yacc semantic stack space allocation\n");
1035 (*yyyOxStackItem)->node =
1036 (yyyGNT *) malloc((size_t)sizeof(yyyGNT));
1037 if ((*yyyOxStackItem)->node == (yyyGNT *) NULL)
1038 yyyfatal("malloc error in ox node space allocation\n");
1039 (*yyyOxStackItem)->solvedSAlist = yyyLambdaSSAL;
1040 (*yyyOxStackItem)->node->parent.stackref = *yyyOxStackItem;
1041 (*yyyOxStackItem)->node->parentIsStack = 1;
1042 (*yyyOxStackItem)->node->cLlen = yyyRHSlength;
1043 (*yyyOxStackItem)->node->cL =
1044 (yyyGNT **) calloc((size_t)yyyRHSlength, (size_t)sizeof(yyyGNT *));
1045 if ((*yyyOxStackItem)->node->cL == (yyyGNT **) NULL)
1046 yyyfatal("malloc error in ox child list space allocation\n");
1047 (*yyyOxStackItem)->node->refCountListLen = yyyNattrbs;
1048 (*yyyOxStackItem)->node->refCountList =
1049 (yyyRCT *) calloc((size_t)yyyNattrbs, (size_t)sizeof(yyyRCT));
1050 if ((*yyyOxStackItem)->node->refCountList == (yyyRCT *) NULL)
1051 yyyfatal("malloc error in ox reference count list space allocation\n");
1052 (*yyyOxStackItem)->node->prodNum = yyyProdNum;
1053 va_start(ap, yyval_OxAttrbs);
1054 for (i=1;i<=yyyRHSlength;i++)
1055 {yyySIT *yaccStDum = va_arg(ap,struct yyyOxAttrbs *)->yyyOxStackItem;
1056 gnpDum = (*yyyOxStackItem)->node->cL[i-1] = yaccStDum->node;
1057 gnpDum->whichSym = i;
1058 gnpDum->parent.noderef = (*yyyOxStackItem)->node;
1059 gnpDum->parentIsStack = 0;
1066 #define yyyDECORfREQ 50
1070 void yyyAdjustINRC(long yyyProdNum, int yyyRHSlength, long startP, long stopP, struct yyyOxAttrbs *yyval_OxAttrbs, ...)
1072 yyySIT *yyyOxStackItem = yyval_OxAttrbs->yyyOxStackItem;
1073 long SSALptr,SSALptrHead,*cPtrPtr;
1078 static unsigned short intNodeCount = yyyDECORfREQ;
1082 while (nextP < stopP)
1083 {if (yyyRCIL[nextP] == yyyR)
1084 {(yyyOxStackItem->node->refCountList)[yyyRCIL[nextP+1]] = yyyRCIL[nextP+2];
1087 {(((yyyOxStackItem->node->cL)[yyyRCIL[nextP]])->refCountList)[yyyRCIL[nextP+1]] = yyyRCIL[nextP+2];
1091 pL = yyyIIEL + yyyIIIEL[yyyProdNum];
1092 va_start(ap, yyval_OxAttrbs);
1093 for (i=1;i<=yyyRHSlength;i++)
1094 {yyySIT *yaccStDum = va_arg(ap,struct yyyOxAttrbs *)->yyyOxStackItem;
1096 SSALptrHead = SSALptr = *(cPtrPtr = &(yaccStDum->solvedSAlist));
1097 if (SSALptr != yyyLambdaSSAL)
1098 {*cPtrPtr = yyyLambdaSSAL;
1101 iTemp = (*pL+yyySSALspace[SSALptr].attrbNum);
1102 yyySignalEnts(yyyOxStackItem->node,
1106 SSALptr = *(cPtrPtr = &(yyySSALspace[SSALptr].next));
1108 while (SSALptr != yyyLambdaSSAL);
1109 *cPtrPtr = yyySSALCfreeList;
1110 yyySSALCfreeList = SSALptrHead;
1115 while (nextP < stopP)
1116 {if (!yyyRCIL[nextP])
1117 {if (yyyRCIL[nextP-2] == yyyR)
1118 {pL = &(yyyOxStackItem->solvedSAlist);
1119 if (yyySSALCfreeList == yyyLambdaSSAL)
1120 {yyySSALspace[yyyNewSSALC].next = *pL;
1121 if ((*pL = yyyNewSSALC++) == yyySSALspaceSize)
1122 yyyHandleOverflow(yyySSALof);
1125 {iTemp = yyySSALCfreeList;
1126 yyySSALCfreeList = yyySSALspace[yyySSALCfreeList].next;
1127 yyySSALspace[iTemp].next = *pL;
1130 yyySSALspace[*pL].attrbNum = yyyRCIL[nextP-1];
1133 {if ((gnpDum = (yyyOxStackItem->node->cL)[yyyRCIL[nextP-2]])->prodNum != 0)
1135 iTemp = yyyIIEL[yyyIIIEL[gnpDum->prodNum]] + yyyRCIL[nextP-1];
1136 yyySignalEnts(gnpDum,
1145 if (!--intNodeCount)
1146 {intNodeCount = yyyDECORfREQ;
1153 void yyyGenLeaf(int nAttrbs,int typeNum,long startP,long stopP,YYSTYPE *yylval)
1155 yyySIT **yyyOxStackItem = &yylval->yyyOxAttrbs.yyyOxStackItem;
1156 (*yyyOxStackItem) = (yyySIT *) malloc((size_t)sizeof(yyySIT));
1157 if ((*yyyOxStackItem) == (yyySIT *) NULL)
1158 yyyfatal("malloc error in ox yacc semantic stack space allocation\n");
1159 (*yyyOxStackItem)->node =
1160 (yyyGNT *) malloc((size_t)sizeof(yyyGNT))
1162 if ((*yyyOxStackItem)->node == (yyyGNT *) NULL)
1163 yyyfatal("malloc error in ox node space allocation\n");
1164 (*yyyOxStackItem)->solvedSAlist = yyyLambdaSSAL;
1165 (*yyyOxStackItem)->node->parent.stackref = *yyyOxStackItem;
1166 (*yyyOxStackItem)->node->parentIsStack = 1;
1167 (*yyyOxStackItem)->node->cLlen = 0;
1168 (*yyyOxStackItem)->node->cL = (yyyGNT **)NULL;
1169 (*yyyOxStackItem)->node->refCountListLen = nAttrbs;
1170 rcPdum = (*yyyOxStackItem)->node->refCountList =
1171 (yyyRCT *) calloc((size_t)nAttrbs, (size_t)sizeof(yyyRCT));
1172 if (rcPdum == (yyyRCT *) NULL)
1173 yyyfatal("malloc error in ox reference count list space allocation\n");
1174 while (startP < stopP) rcPdum[yyyLRCIL[startP++]] = 0;
1175 (*yyyOxStackItem)->node->prodNum = 0;
1176 (*yyyOxStackItem)->node->whichSym = 0;
1189 #define yyyLastProdNum 8
1195 int yyyProdsInd[] = {
1197 0, 2, 6, 10, 14, 18, 22, 24,
1202 int yyyProds[][2] = {
1203 { 116, 0},{ 462, 0},{ 462, 0},{ 462, 0},{ 412, 0},
1204 { 462, 0},{ 462, 0},{ 462, 0},{ 420, 0},{ 462, 0},
1205 { 462, 0},{ 462, 0},{ 452, 0},{ 462, 0},{ 462, 0},
1206 { 462, 0},{ 436, 0},{ 462, 0},{ 462, 0},{ 396, 0},
1207 { 462, 0},{ 404, 0},{ 462, 0},{ 619, 1},{ 462, 0},
1212 int yyySortsInd[] = {
1225 char *yyyStringTab[] = {
1308 0,0,"'*'","lexeme",0,
1339 0,0,"CONST","LRpost",0,
1477 #define yyySizeofProd(num) (yyyProdsInd[(num)+1] - yyyProdsInd[(num)])
1479 #define yyyGSoccurStr(prodNum,symPos) \
1480 (yyyStringTab[yyyProds[yyyProdsInd[(prodNum)] + (symPos)][0]])
1482 #define yyySizeofSort(num) (yyySortsInd[(num)+1] - yyySortsInd[(num)])
1484 #define yyySortOf(prodNum,symPos) \
1485 (yyyProds[yyyProdsInd[(prodNum)] + (symPos)][1])
1487 #define yyyAttrbStr(prodNum,symPos,attrbNum) \
1488 (yyyStringTab[yyySorts[yyySortsInd[yyySortOf(prodNum,symPos)] + \
1496 void yyyShowProd(int i)
1499 nSyms = yyySizeofProd(i);
1500 for (j=0; j<nSyms; j++)
1502 fprintf(stderr,"%s",yyyGSoccurStr(i,j));
1503 if (j == 0) fputs(" : ",stderr); else putc(' ',stderr);
1505 fputs(";\n",stderr);
1511 {int i; for (i=1; i<=yyyLastProdNum; i++) yyyShowProd(i);}
1515 void yyyShowSymsAndSorts()
1518 for (i=1; i<=yyyLastProdNum; i++)
1522 "\n\n\n---------------------------------- %3.1d\n",i);
1523 /* yyyShowProd(i); */
1524 nSyms = yyySizeofProd(i);
1525 for (j=0; j<nSyms; j++)
1528 fprintf(stderr,"%s\n",yyyGSoccurStr(i,j));
1529 sortSize = yyySizeofSort(yyySortOf(i,j));
1530 for (k=0; k<sortSize; k++)
1531 fprintf(stderr," %s\n",yyyAttrbStr(i,j,k));
1532 if (j == 0) fputs("->\n",stderr);
1541 void yyyCheckNodeInstancesSolved(yyyGNT *np)
1542 {int mysort,sortSize,i,prodNum,symPos,inTerminalNode;
1543 int nUnsolvedInsts = 0;
1545 if (np->prodNum != 0)
1546 {inTerminalNode = 0;
1547 prodNum = np->prodNum;
1551 {inTerminalNode = 1;
1552 prodNum = np->parent.noderef->prodNum;
1553 symPos = np->whichSym;
1555 mysort = yyySortOf(prodNum,symPos);
1556 sortSize = yyySizeofSort(mysort);
1557 for (i=0; i<sortSize; i++)
1558 if ((np->refCountList)[i] != 0) nUnsolvedInsts += 1;
1561 "\nFound node that has %d unsolved attribute instance(s).\n",
1564 fprintf(stderr,"Node is labeled \"%s\".\n",
1565 yyyGSoccurStr(prodNum,symPos));
1567 {fputs("Node is terminal. Its parent production is:\n ",stderr);
1568 yyyShowProd(prodNum);
1571 {fputs("Node is nonterminal. ",stderr);
1572 if (!(np->parentIsStack))
1574 "Node is %dth child in its parent production:\n ",
1577 yyyShowProd(np->parent.noderef->prodNum);
1579 fputs("Node is on left hand side of this production:\n ",stderr);
1580 yyyShowProd(np->prodNum);
1582 fputs("The following instances are unsolved:\n",stderr);
1583 for (i=0; i<sortSize; i++)
1584 if ((np->refCountList)[i] != 0)
1585 fprintf(stderr," %-16s still has %1d dependencies.\n",
1586 yyyAttrbStr(prodNum,symPos,i),(np->refCountList)[i]);
1592 void yyyCheckUnsolvedInstTrav(yyyGNT *pNode,long *nNZrc,long *cycleSum)
1593 {yyyGNT **yyyCLpdum;
1597 /* visit the refCountList of each node in the tree, and sum the non-zero refCounts */
1598 rcp = pNode->refCountList;
1599 i = pNode->refCountListLen;
1601 if (*rcp++) {*cycleSum += *(rcp - 1); (*nNZrc)++;}
1602 yyyCLpdum = pNode->cL;
1606 yyyCheckUnsolvedInstTrav(*yyyCLpdum,nNZrc,cycleSum);
1613 void yyyUnsolvedInstSearchTravAux(yyyGNT *pNode)
1614 {yyyGNT **yyyCLpdum;
1617 yyyCheckNodeInstancesSolved(pNode);
1618 yyyCLpdum = pNode->cL;
1622 yyyUnsolvedInstSearchTravAux(*yyyCLpdum);
1629 void yyyUnsolvedInstSearchTrav(yyyGNT *pNode)
1630 {yyyGNT **yyyCLpdum;
1633 yyyCLpdum = pNode->cL;
1637 yyyUnsolvedInstSearchTravAux(*yyyCLpdum);
1644 #line 1645 "expr.oxout.tab.c"
1647 #include <stdio.h> /* needed for printf */
1650 #include <stdlib.h> /* needed for malloc, etc */
1651 #include <string.h> /* needed for memset */
1653 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
1654 static int yygrowstack(YYSTACKDATA *data)
1661 if ((newsize = data->stacksize) == 0)
1662 newsize = YYINITSTACKSIZE;
1663 else if (newsize >= YYMAXDEPTH)
1665 else if ((newsize *= 2) > YYMAXDEPTH)
1666 newsize = YYMAXDEPTH;
1668 i = (int) (data->s_mark - data->s_base);
1669 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
1673 data->s_base = newss;
1674 data->s_mark = newss + i;
1676 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
1680 data->l_base = newvs;
1681 data->l_mark = newvs + i;
1683 data->stacksize = newsize;
1684 data->s_last = data->s_base + newsize - 1;
1688 #if YYPURE || defined(YY_NO_LEAKS)
1689 static void yyfreestack(YYSTACKDATA *data)
1693 memset(data, 0, sizeof(*data));
1696 #define yyfreestack(data) /* nothing */
1699 #define YYABORT goto yyabort
1700 #define YYREJECT goto yyabort
1701 #define YYACCEPT goto yyaccept
1702 #define YYERROR goto yyerrlab
1707 int yym, yyn, yystate;
1711 if ((yys = getenv("YYDEBUG")) != 0)
1714 if (yyn >= '0' && yyn <= '9')
1715 yydebug = yyn - '0';
1727 memset(&yystack, 0, sizeof(yystack));
1730 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1731 yystack.s_mark = yystack.s_base;
1732 yystack.l_mark = yystack.l_base;
1734 *yystack.s_mark = 0;
1737 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
1741 if (yychar < 0) yychar = YYEOF;
1745 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1746 printf("%sdebug: state %d, reading %d (%s)\n",
1747 YYPREFIX, yystate, yychar, yys);
1751 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
1752 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
1756 printf("%sdebug: state %d, shifting to state %d\n",
1757 YYPREFIX, yystate, yytable[yyn]);
1759 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1760 yystate = yytable[yyn];
1761 *++yystack.s_mark = yytable[yyn];
1762 *++yystack.l_mark = yylval;
1764 if (yyerrflag > 0) --yyerrflag;
1767 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
1768 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
1773 if (yyerrflag != 0) goto yyinrecovery;
1775 YYERROR_CALL("syntax error");
1777 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
1787 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
1788 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
1792 printf("%sdebug: state %d, error recovery shifting\
1793 to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
1795 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1796 yystate = yytable[yyn];
1797 *++yystack.s_mark = yytable[yyn];
1798 *++yystack.l_mark = yylval;
1805 printf("%sdebug: error recovery discarding state %d\n",
1806 YYPREFIX, *yystack.s_mark);
1808 if (yystack.s_mark <= yystack.s_base) goto yyabort;
1816 if (yychar == YYEOF) goto yyabort;
1820 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1821 printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
1822 YYPREFIX, yystate, yychar, yys);
1832 printf("%sdebug: state %d, reducing by rule %d (%s)\n",
1833 YYPREFIX, yystate, yyn, yyrule[yyn]);
1837 yyval = yystack.l_mark[1-yym];
1839 memset(&yyval, 0, sizeof yyval);
1844 #line 64 "expr.oxout.y"
1848 #line 66 "expr.oxout.y"
1850 yyyDecorate(); yyyExecuteRRsection(yystack.l_mark[0].yyyOxAttrbs.yyyOxStackItem->node);
1854 #line 73 "expr.oxout.y"
1856 yyyGenIntNode(1,1,0,&yyval.yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);
1857 yyyAdjustINRC(1,1,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}}
1860 #line 80 "expr.oxout.y"
1862 yyyGenIntNode(2,3,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);
1863 yyyAdjustINRC(2,3,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}}
1866 #line 87 "expr.oxout.y"
1868 yyyGenIntNode(3,3,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);
1869 yyyAdjustINRC(3,3,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}}
1872 #line 94 "expr.oxout.y"
1874 yyyGenIntNode(4,3,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);
1875 yyyAdjustINRC(4,3,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}}
1878 #line 101 "expr.oxout.y"
1880 yyyGenIntNode(5,3,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);
1881 yyyAdjustINRC(5,3,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}}
1884 #line 108 "expr.oxout.y"
1886 yyyGenIntNode(6,3,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);
1887 yyyAdjustINRC(6,3,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}}
1890 #line 114 "expr.oxout.y"
1892 yyyGenIntNode(7,1,0,&yyval.yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);
1893 yyyAdjustINRC(7,1,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}}
1896 #line 121 "expr.oxout.y"
1898 yyyGenIntNode(8,1,0,&yyval.yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);
1899 yyyAdjustINRC(8,1,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}}
1901 #line 1902 "expr.oxout.tab.c"
1903 yystack.s_mark -= yym;
1904 yystate = *yystack.s_mark;
1905 yystack.l_mark -= yym;
1907 if (yystate == 0 && yym == 0)
1911 printf("%sdebug: after reduction, shifting from state 0 to\
1912 state %d\n", YYPREFIX, YYFINAL);
1915 *++yystack.s_mark = YYFINAL;
1916 *++yystack.l_mark = yyval;
1920 if (yychar < 0) yychar = YYEOF;
1924 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1925 printf("%sdebug: state %d, reading %d (%s)\n",
1926 YYPREFIX, YYFINAL, yychar, yys);
1930 if (yychar == YYEOF) goto yyaccept;
1933 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1934 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1935 yystate = yytable[yyn];
1937 yystate = yydgoto[yym];
1940 printf("%sdebug: after reduction, shifting from state %d \
1941 to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
1943 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1944 *++yystack.s_mark = (YYINT) yystate;
1945 *++yystack.l_mark = yyval;
1949 YYERROR_CALL("yacc stack overflow");
1952 yyfreestack(&yystack);
1956 yyfreestack(&yystack);