xref: /freebsd/contrib/byacc/test/yacc/expr.oxout.tab.c (revision 13464e4a44fc58490a03bb8bfc7e3c972e9c30b2)
1 /* original parser id follows */
2 /* yysccsid[] = "@(#)yaccpar	1.9 (Berkeley) 02/21/93" */
3 /* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
4 
5 #define YYBYACC 1
6 #define YYMAJOR 1
7 #define YYMINOR 9
8 #define YYCHECK "yyyymmdd"
9 
10 #define YYEMPTY        (-1)
11 #define yyclearin      (yychar = YYEMPTY)
12 #define yyerrok        (yyerrflag = 0)
13 #define YYRECOVERING() (yyerrflag != 0)
14 #define YYENOMEM       (-2)
15 #define YYEOF          0
16 
17 #ifndef yyparse
18 #define yyparse    expr.oxout_parse
19 #endif /* yyparse */
20 
21 #ifndef yylex
22 #define yylex      expr.oxout_lex
23 #endif /* yylex */
24 
25 #ifndef yyerror
26 #define yyerror    expr.oxout_error
27 #endif /* yyerror */
28 
29 #ifndef yychar
30 #define yychar     expr.oxout_char
31 #endif /* yychar */
32 
33 #ifndef yyval
34 #define yyval      expr.oxout_val
35 #endif /* yyval */
36 
37 #ifndef yylval
38 #define yylval     expr.oxout_lval
39 #endif /* yylval */
40 
41 #ifndef yydebug
42 #define yydebug    expr.oxout_debug
43 #endif /* yydebug */
44 
45 #ifndef yynerrs
46 #define yynerrs    expr.oxout_nerrs
47 #endif /* yynerrs */
48 
49 #ifndef yyerrflag
50 #define yyerrflag  expr.oxout_errflag
51 #endif /* yyerrflag */
52 
53 #ifndef yylhs
54 #define yylhs      expr.oxout_lhs
55 #endif /* yylhs */
56 
57 #ifndef yylen
58 #define yylen      expr.oxout_len
59 #endif /* yylen */
60 
61 #ifndef yydefred
62 #define yydefred   expr.oxout_defred
63 #endif /* yydefred */
64 
65 #ifndef yydgoto
66 #define yydgoto    expr.oxout_dgoto
67 #endif /* yydgoto */
68 
69 #ifndef yysindex
70 #define yysindex   expr.oxout_sindex
71 #endif /* yysindex */
72 
73 #ifndef yyrindex
74 #define yyrindex   expr.oxout_rindex
75 #endif /* yyrindex */
76 
77 #ifndef yygindex
78 #define yygindex   expr.oxout_gindex
79 #endif /* yygindex */
80 
81 #ifndef yytable
82 #define yytable    expr.oxout_table
83 #endif /* yytable */
84 
85 #ifndef yycheck
86 #define yycheck    expr.oxout_check
87 #endif /* yycheck */
88 
89 #ifndef yyname
90 #define yyname     expr.oxout_name
91 #endif /* yyname */
92 
93 #ifndef yyrule
94 #define yyrule     expr.oxout_rule
95 #endif /* yyrule */
96 #define YYPREFIX "expr.oxout_"
97 
98 #define YYPURE 0
99 
100 #line 5 "expr.oxout.y"
101 #include <stdlib.h>
102 #include <string.h>
103 #line 8 "expr.Y"
104 
105 #include "expr.oxout.h"
106 #include <stdio.h>
107 
108 extern int yylex(void);
109 extern void yyerror(const char *);
110 #line 27 "expr.oxout.y"
111 #include <limits.h>
112 #define yyyR USHRT_MAX
113 #ifdef YYSTYPE
114 #undef  YYSTYPE_IS_DECLARED
115 #define YYSTYPE_IS_DECLARED 1
116 #endif
117 #ifndef YYSTYPE_IS_DECLARED
118 #define YYSTYPE_IS_DECLARED 1
119 #line 31 "expr.oxout.y"
120 typedef union {
121 struct yyyOxAttrbs {
122 struct yyyStackItem *yyyOxStackItem;
123 } yyyOxAttrbs;
124 } YYSTYPE;
125 #endif /* !YYSTYPE_IS_DECLARED */
126 #line 38 "expr.oxout.y"
127 #include <stdio.h>
128 #include <stdarg.h>
129 
130 static int yyyYok = 1;
131 
132 extern yyyFT yyyRCIL[];
133 
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);
143 void yyyabort(void);
144 
145 #line 146 "expr.oxout.tab.c"
146 
147 /* compatibility with bison */
148 #ifdef YYPARSE_PARAM
149 /* compatibility with FreeBSD */
150 # ifdef YYPARSE_PARAM_TYPE
151 #  define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
152 # else
153 #  define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
154 # endif
155 #else
156 # define YYPARSE_DECL() yyparse(void)
157 #endif
158 
159 /* Parameters sent to lex. */
160 #ifdef YYLEX_PARAM
161 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
162 # define YYLEX yylex(YYLEX_PARAM)
163 #else
164 # define YYLEX_DECL() yylex(void)
165 # define YYLEX yylex()
166 #endif
167 
168 /* Parameters sent to yyerror. */
169 #ifndef YYERROR_DECL
170 #define YYERROR_DECL() yyerror(const char *s)
171 #endif
172 #ifndef YYERROR_CALL
173 #define YYERROR_CALL(msg) yyerror(msg)
174 #endif
175 
176 extern int YYPARSE_DECL();
177 
178 #define ID 257
179 #define CONST 258
180 #define YYERRCODE 256
181 typedef int YYINT;
182 static const YYINT expr.oxout_lhs[] = {                  -1,
183     2,    0,    1,    3,    3,    3,    3,    3,    3,    3,
184 };
185 static const YYINT expr.oxout_len[] = {                   2,
186     0,    2,    1,    3,    3,    3,    3,    3,    1,    1,
187 };
188 static const YYINT expr.oxout_defred[] = {                1,
189     0,    0,    9,   10,    0,    2,    0,    0,    0,    0,
190     0,    0,    8,    0,    0,    4,    0,
191 };
192 static const YYINT expr.oxout_dgoto[] = {                 1,
193     6,    2,    7,
194 };
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,
198 };
199 static const YYINT expr.oxout_rindex[] = {                0,
200     0,    0,    0,    0,    0,    0,    6,    0,    0,    0,
201     0,    0,    0,    2,    8,    0,    1,
202 };
203 static const YYINT expr.oxout_gindex[] = {                0,
204     0,    0,    4,
205 };
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,
230 };
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,
254 };
255 #define YYFINAL 1
256 #ifndef YYDEBUG
257 #define YYDEBUG 0
258 #endif
259 #define YYMAXTOKEN 258
260 #define YYUNDFTOKEN 264
261 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
262 #if YYDEBUG
263 static const char *const expr.oxout_name[] = {
264 
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",
273 };
274 static const char *const expr.oxout_rule[] = {
275 "$accept : yyyAugNonterm",
276 "$$1 :",
277 "yyyAugNonterm : $$1 s",
278 "s : expr",
279 "expr : expr '*' expr",
280 "expr : expr '+' expr",
281 "expr : expr '/' expr",
282 "expr : expr '-' expr",
283 "expr : '(' expr ')'",
284 "expr : ID",
285 "expr : CONST",
286 
287 };
288 #endif
289 
290 int      yydebug;
291 int      yynerrs;
292 
293 int      yyerrflag;
294 int      yychar;
295 YYSTYPE  yyval;
296 YYSTYPE  yylval;
297 
298 /* define the initial stack-sizes */
299 #ifdef YYSTACKSIZE
300 #undef YYMAXDEPTH
301 #define YYMAXDEPTH  YYSTACKSIZE
302 #else
303 #ifdef YYMAXDEPTH
304 #define YYSTACKSIZE YYMAXDEPTH
305 #else
306 #define YYSTACKSIZE 10000
307 #define YYMAXDEPTH  10000
308 #endif
309 #endif
310 
311 #define YYINITSTACKSIZE 200
312 
313 typedef struct {
314     unsigned stacksize;
315     YYINT    *s_base;
316     YYINT    *s_mark;
317     YYINT    *s_last;
318     YYSTYPE  *l_base;
319     YYSTYPE  *l_mark;
320 } YYSTACKDATA;
321 /* variables for the parser stack */
322 static YYSTACKDATA yystack;
323 #line 53 "expr.Y"
324 
325 
326 int yyparse(void);
327 
328 int main()
329   {yyparse();
330   }
331 
332 
333 
334 #line 138 "expr.oxout.y"
335 long yyySSALspaceSize =    20000;
336 long yyyRSmaxSize =        1000;
337 long yyyTravStackMaxSize = 2000;
338 
339 struct yyySolvedSAlistCell {yyyWAT attrbNum;
340                             long next;
341                            };
342 
343 #define yyyLambdaSSAL 0
344 long yyySSALCfreeList = yyyLambdaSSAL;
345 long yyyNewSSALC = 1;
346 
347 struct yyySolvedSAlistCell *yyySSALspace;
348 
349 long yyyNbytesStackStg;
350 
351 
352 
353 yyyFT yyyRCIL[1];
354 
355 short yyyIIIEL[] = {0,
356 0,2,6,10,14,18,22,24,
357 };
358 
359 long yyyIIEL[] = {
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,
362 1,1,
363 };
364 
365 long yyyIEL[] = {
366 0,0,0,
367 };
368 
369 yyyFT yyyEntL[1];
370 
371 void yyyfatal(char *msg)
372 {fputs(msg,stderr);exit(-1);}
373 
374 
375 
376 #define yyySSALof 'S'
377 #define yyyRSof   'q'
378 #define yyyTSof   't'
379 
380 
381 
382 void yyyHandleOverflow(char which)
383   {char *msg1,*msg2;
384    long  oldSize,newSize;
385    switch(which)
386      {
387       case yyySSALof :
388            msg1 = "SSAL overflow: ";
389            oldSize = yyySSALspaceSize;
390            break;
391       case yyyRSof   :
392            msg1 = "ready set overflow: ";
393            oldSize = yyyRSmaxSize;
394            break;
395       case yyyTSof   :
396            msg1 = "traversal stack overflow: ";
397            oldSize = yyyTravStackMaxSize;
398            break;
399       default        :;
400      }
401    newSize = (3*oldSize)/2;
402    if (newSize < 100) newSize = 100;
403    fputs(msg1,stderr);
404    fprintf(stderr,"size was %ld.\n",oldSize);
405    msg2 = "     Have to modify evaluator:  -Y%c%ld.\n";
406    fprintf(stderr,msg2,which,newSize);
407    exit(-1);
408   }
409 
410 
411 
412 void yyySignalEnts(yyyGNT *node,long startP,long stopP)
413   {yyyGNT *dumNode;
414 
415    while (startP < stopP)
416      {
417       if (!yyyEntL[startP]) dumNode = node;
418          else dumNode = (node->cL)[yyyEntL[startP]-1];
419       if (!(--((dumNode->refCountList)[yyyEntL[startP+1]]
420               )
421            )
422          )
423          {
424           if (++yyyRSTop == yyyAfterRS)
425              {yyyHandleOverflow(yyyRSof);
426               break;
427              }
428           yyyRSTop->node = dumNode;
429           yyyRSTop->whichSym = yyyEntL[startP];
430           yyyRSTop->wa = yyyEntL[startP+1];
431          }
432       startP += 2;
433      }
434   }
435 
436 
437 
438 
439 
440 
441 void yyySolveAndSignal() {
442 long yyyiDum,*yyypL;
443 int yyyws,yyywa;
444 yyyGNT *yyyRSTopN,*yyyRefN;
445 yyyParent yyyRSTopNp;
446 
447 
448 yyyRSTopNp = (yyyRSTopN = yyyRSTop->node)->parent;
449 yyyRefN= (yyyws = (yyyRSTop->whichSym))?yyyRSTopNp.noderef:yyyRSTopN;
450 yyywa = yyyRSTop->wa;
451 yyyRSTop--;
452 switch(yyyRefN->prodNum) {
453 case 1:  /***yacc rule 1***/
454   switch (yyyws) {
455   }
456 break;
457 case 2:  /***yacc rule 2***/
458   switch (yyyws) {
459   }
460 break;
461 case 3:  /***yacc rule 3***/
462   switch (yyyws) {
463   }
464 break;
465 case 4:  /***yacc rule 4***/
466   switch (yyyws) {
467   }
468 break;
469 case 5:  /***yacc rule 5***/
470   switch (yyyws) {
471   }
472 break;
473 case 6:  /***yacc rule 6***/
474   switch (yyyws) {
475   }
476 break;
477 case 7:  /***yacc rule 7***/
478   switch (yyyws) {
479   case 1:  /**/
480     switch (yyywa) {
481     }
482   break;
483   }
484 break;
485 case 8:  /***yacc rule 8***/
486   switch (yyyws) {
487   case 1:  /**/
488     switch (yyywa) {
489     }
490   break;
491   }
492 break;
493 } /* switch */
494 
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],
499                                 yyyIEL[yyyiDum+1]
500                      );
501        }
502    }
503    else     /* the just-solved instance was synthesized. */
504    {if (!(yyyRSTopN->parentIsStack)) /* node has a parent. */
505        {yyyiDum = yyyIIEL[yyyIIIEL[yyyRSTopNp.noderef->prodNum] +
506                           yyyRSTopN->whichSym
507                          ] +
508                   yyywa;
509         yyySignalEnts(yyyRSTopNp.noderef,
510                       yyyIEL[yyyiDum],
511                       yyyIEL[yyyiDum+1]
512                      );
513        }
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);
520            }
521            else
522            {yyyiDum = yyySSALCfreeList;
523             yyySSALCfreeList = yyySSALspace[yyySSALCfreeList].next;
524             yyySSALspace[yyyiDum].next = *yyypL;
525             *yyypL = yyyiDum;
526            }
527         yyySSALspace[*yyypL].attrbNum = yyywa;
528        }
529    }
530 
531 } /* yyySolveAndSignal */
532 
533 
534 
535 
536 
537 
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)
542 
543 
544 
545 struct yyyTravStackItem {yyyGNT *node;
546                          char isReady;
547                          condStg
548                         };
549 
550 
551 
552 void yyyDoTraversals(yyyGNT *rootNode)
553 {struct yyyTravStackItem *yyyTravStack,*yyyTST,*yyyAfterTravStack;
554  yyyGNT *yyyTSTn,**yyyCLptr2;
555  int yyyi,yyyRL,yyyPass;
556  int i;
557 
558  if (!yyyYok) return;
559  if ((yyyTravStack =
560                  ((struct yyyTravStackItem *)
561                   calloc((size_t)yyyTravStackMaxSize,
562                          (size_t)sizeof(struct yyyTravStackItem)
563                         )
564                  )
565      )
566      ==
567      (struct yyyTravStackItem *)NULL
568     )
569     {fputs("malloc error in traversal stack allocation\n",stderr);
570      exit(-1);
571     }
572 
573 yyyAfterTravStack = yyyTravStack + yyyTravStackMaxSize;
574 yyyTravStack++;
575 
576 
577 for (yyyi=0; yyyi<2; yyyi++) {
578 yyyTST = yyyTravStack;
579 yyyTST->node = rootNode;
580 yyyTST->isReady = 0;
581 yyyClearConds
582 
583 while(yyyTST >= yyyTravStack)
584   {yyyTSTn = yyyTST->node;
585    if (yyyTST->isReady)
586       {yyyPass = 1;
587        goto yyyTravSwitch;
588 yyyTpop:
589        yyyTST--;
590       }
591       else
592       {yyyPass = 0;
593        goto yyyTravSwitch;
594 yyyTpush:
595        yyyTST->isReady = 1;
596        if (yyyTSTn->prodNum)
597           {if (yyyRL)
598              {yyyCLptr2 = yyyTSTn->cL;
599               i = yyyTSTn->cLlen;
600               while (i--)
601                 {if (++yyyTST == yyyAfterTravStack)
602                     yyyHandleOverflow(yyyTSof);
603                     else
604                     {yyyTST->node = *yyyCLptr2;
605                      yyyTST->isReady = 0;
606                      yyyClearConds
607                     }
608                  yyyCLptr2++;
609                 }
610              } /* right to left */
611              else  /* left to right */
612              {i = yyyTSTn->cLlen;
613               yyyCLptr2 = yyyTSTn->cL + i;
614               while (i--)
615                 {yyyCLptr2--;
616                  if (++yyyTST == yyyAfterTravStack)
617                     yyyHandleOverflow(yyyTSof);
618                     else
619                     {yyyTST->node = *yyyCLptr2;
620                      yyyTST->isReady = 0;
621                      yyyClearConds
622                     }
623                 }
624              } /* left to right */
625           }
626       } /* else */
627    continue;
628 yyyTravSwitch:
629 				switch(yyyTSTn->prodNum)	{
630 case 1:
631 	switch(yyyi)	{
632 		case 0:
633 			switch(yyyPass)	{
634 				case 0:
635 yyyRL = 0;yyySetCond(0)
636 
637 if (!
638 #line 24 "expr.Y"
639   (1)
640 #line 444 "expr.oxout.y"
641 ) yyySetCond(1)
642 yyySetCond(2)
643 
644 				case 1:
645 
646 if (yyyCond(0) != yyyPass) {
647 #line 24 "expr.Y"
648 
649 #line 453 "expr.oxout.y"
650 }
651 if (yyyCond(1) != yyyPass) {
652 #line 24 "expr.Y"
653  printf("\n");
654 
655 #line 459 "expr.oxout.y"
656 }
657 if (yyyCond(2) != yyyPass) {
658 #line 25 "expr.Y"
659   printf("prefix:   ");
660 
661 #line 465 "expr.oxout.y"
662 }
663 				break;
664 					}
665 		break;
666 		case 1:
667 			switch(yyyPass)	{
668 				case 0:
669 yyyRL = 0;
670 if (
671 #line 23 "expr.Y"
672   (1)
673 #line 477 "expr.oxout.y"
674 ) yyySetCond(2)
675 
676 				case 1:
677 
678 if (yyyCond(0) != yyyPass) {
679 #line 22 "expr.Y"
680  printf("\n");
681 
682 #line 486 "expr.oxout.y"
683 }
684 if (yyyCond(1) != yyyPass) {
685 #line 23 "expr.Y"
686 
687 #line 491 "expr.oxout.y"
688 }
689 if (yyyCond(2) != yyyPass) {
690 #line 23 "expr.Y"
691  printf("postfix:  ")/* missing ; */
692 
693 #line 497 "expr.oxout.y"
694 }
695 				break;
696 					}
697 		break;
698 			}
699 
700 break;
701 case 2:
702 	switch(yyyi)	{
703 		case 0:
704 			switch(yyyPass)	{
705 				case 0:
706 yyyRL = 0;yyySetCond(0)
707 
708 				case 1:
709 
710 if (yyyCond(0) != yyyPass) {
711 #line 29 "expr.Y"
712   printf(" * ");
713 
714 #line 518 "expr.oxout.y"
715 }
716 				break;
717 					}
718 		break;
719 		case 1:
720 			switch(yyyPass)	{
721 				case 0:
722 yyyRL = 0;
723 				case 1:
724 
725 if (yyyCond(0) != yyyPass) {
726 #line 28 "expr.Y"
727  printf(" * ");
728 
729 #line 533 "expr.oxout.y"
730 }
731 				break;
732 					}
733 		break;
734 			}
735 
736 break;
737 case 3:
738 	switch(yyyi)	{
739 		case 0:
740 			switch(yyyPass)	{
741 				case 0:
742 yyyRL = 0;yyySetCond(0)
743 
744 				case 1:
745 
746 if (yyyCond(0) != yyyPass) {
747 #line 32 "expr.Y"
748   printf(" + ");
749 
750 #line 554 "expr.oxout.y"
751 }
752 				break;
753 					}
754 		break;
755 		case 1:
756 			switch(yyyPass)	{
757 				case 0:
758 yyyRL = 0;
759 				case 1:
760 
761 if (yyyCond(0) != yyyPass) {
762 #line 33 "expr.Y"
763  printf(" + ");
764 
765 #line 569 "expr.oxout.y"
766 }
767 				break;
768 					}
769 		break;
770 			}
771 
772 break;
773 case 4:
774 	switch(yyyi)	{
775 		case 0:
776 			switch(yyyPass)	{
777 				case 0:
778 yyyRL = 0;yyySetCond(0)
779 
780 				case 1:
781 
782 if (yyyCond(0) != yyyPass) {
783 #line 37 "expr.Y"
784   printf(" / ");
785 
786 #line 590 "expr.oxout.y"
787 }
788 				break;
789 					}
790 		break;
791 		case 1:
792 			switch(yyyPass)	{
793 				case 0:
794 yyyRL = 0;
795 				case 1:
796 
797 if (yyyCond(0) != yyyPass) {
798 #line 36 "expr.Y"
799  printf(" / ");
800 
801 #line 605 "expr.oxout.y"
802 }
803 				break;
804 					}
805 		break;
806 			}
807 
808 break;
809 case 5:
810 	switch(yyyi)	{
811 		case 0:
812 			switch(yyyPass)	{
813 				case 0:
814 yyyRL = 0;yyySetCond(0)
815 
816 				case 1:
817 
818 if (yyyCond(0) != yyyPass) {
819 #line 41 "expr.Y"
820   printf(" - ");
821 
822 #line 626 "expr.oxout.y"
823 }
824 				break;
825 					}
826 		break;
827 		case 1:
828 			switch(yyyPass)	{
829 				case 0:
830 yyyRL = 0;
831 				case 1:
832 
833 if (yyyCond(0) != yyyPass) {
834 #line 40 "expr.Y"
835  printf(" - ");
836 
837 #line 641 "expr.oxout.y"
838 }
839 				break;
840 					}
841 		break;
842 			}
843 
844 break;
845 case 6:
846 	switch(yyyi)	{
847 		case 0:
848 			switch(yyyPass)	{
849 				case 0:
850 yyyRL = 0;
851 				case 1:
852 
853 				break;
854 					}
855 		break;
856 		case 1:
857 			switch(yyyPass)	{
858 				case 0:
859 yyyRL = 0;
860 				case 1:
861 
862 				break;
863 					}
864 		break;
865 			}
866 
867 break;
868 case 7:
869 	switch(yyyi)	{
870 		case 0:
871 			switch(yyyPass)	{
872 				case 0:
873 yyyRL = 0;yyySetCond(0)
874 
875 				case 1:
876 
877 if (yyyCond(0) != yyyPass) {
878 #line 46 "expr.Y"
879   printf(" %s ",yyyTSTn->cL[0]->yyyAttrbs.yyyAttrb1.lexeme);
880 
881 #line 685 "expr.oxout.y"
882 }
883 				break;
884 					}
885 		break;
886 		case 1:
887 			switch(yyyPass)	{
888 				case 0:
889 yyyRL = 0;
890 				case 1:
891 
892 if (yyyCond(0) != yyyPass) {
893 #line 45 "expr.Y"
894  printf(" %s ",yyyTSTn->cL[0]->yyyAttrbs.yyyAttrb1.lexeme);
895 
896 #line 700 "expr.oxout.y"
897 }
898 				break;
899 					}
900 		break;
901 			}
902 
903 break;
904 case 8:
905 	switch(yyyi)	{
906 		case 0:
907 			switch(yyyPass)	{
908 				case 0:
909 yyyRL = 0;yyySetCond(0)
910 
911 				case 1:
912 
913 if (yyyCond(0) != yyyPass) {
914 #line 50 "expr.Y"
915   printf(" %s ",yyyTSTn->cL[0]->yyyAttrbs.yyyAttrb1.lexeme);
916 
917 #line 721 "expr.oxout.y"
918 }
919 				break;
920 					}
921 		break;
922 		case 1:
923 			switch(yyyPass)	{
924 				case 0:
925 yyyRL = 0;
926 				case 1:
927 
928 if (yyyCond(0) != yyyPass) {
929 #line 49 "expr.Y"
930  printf(" %s ",yyyTSTn->cL[0]->yyyAttrbs.yyyAttrb1.lexeme);
931 
932 #line 736 "expr.oxout.y"
933 }
934 				break;
935 					}
936 		break;
937 			}
938 
939 break;
940 								} /* switch */
941    if (yyyPass) goto yyyTpop; else goto yyyTpush;
942   } /* while */
943  } /* for */
944 } /* yyyDoTraversals */
945 
946 void yyyExecuteRRsection(yyyGNT *rootNode)  {
947    int yyyi;
948    long cycleSum = 0;
949    long nNZrc = 0;
950 
951    if (!yyyYok) return;
952    yyyCheckUnsolvedInstTrav(rootNode,&nNZrc,&cycleSum);
953    if (nNZrc)
954       {
955        fputs("\n\n\n**********\n",stderr);
956        fputs("cycle detected in completed parse tree",stderr);
957        fputs(" after decoration.\n",stderr);
958 #if CYCLE_VERBOSE
959        fprintf(stderr,
960                "number of unsolved attribute instances == %ld.\n",
961                nNZrc
962               );
963        fprintf(stderr,
964                "total number of remaining dependencies == %ld.\n",
965                cycleSum
966               );
967        fputs("average number of remaining dependencies\n",stderr);
968        fprintf(stderr,"  per unsolved instance == %f.\n",
969                ((float)(cycleSum)/(float)(nNZrc))
970               );
971 #endif
972        fprintf(stderr,
973          "searching parse tree for %ld unsolved instances:\n",
974                nNZrc
975               );
976        yyyUnsolvedInstSearchTravAux(rootNode);
977       }
978    yyyDoTraversals(rootNode);
979 } /* yyyExecuteRRsection */
980 
981 
982 
983 yyyWAT yyyLRCIL[2] = {0,0,
984 };
985 
986 
987 
988 void yyyYoxInit(void)
989   {
990    static int yyyInitDone = 0;
991    if (yyyInitDone) return;
992 
993    if ((yyyRS = (struct yyyRSitem *)
994          calloc((size_t)(yyyRSmaxSize+1), (size_t)sizeof(struct yyyRSitem))
995        )
996        ==
997        ((struct yyyRSitem *) NULL)
998       )
999       yyyfatal("malloc error in ox ready set space allocation\n");
1000    yyyRS++;
1001    yyyAfterRS = yyyRS + yyyRSmaxSize;
1002 
1003 
1004    if ((yyySSALspace = (struct yyySolvedSAlistCell *)
1005           calloc((size_t)(yyySSALspaceSize+1), (size_t)sizeof(struct yyySolvedSAlistCell))
1006        )
1007        ==
1008        ((struct yyySolvedSAlistCell *) NULL)
1009       )
1010       yyyfatal("malloc error in stack solved list space allocation\n");
1011    yyyInitDone = 1;
1012 
1013    yyyRSTop = yyyRS - 1;
1014   } /* yyyYoxInit */
1015 
1016 
1017 
1018 void yyyDecorate(void)
1019   {
1020    while (yyyRSTop >= yyyRS)
1021       yyySolveAndSignal();
1022   }
1023 
1024 
1025 
1026 void yyyGenIntNode(long yyyProdNum, int yyyRHSlength, int yyyNattrbs, struct yyyOxAttrbs *yyval_OxAttrbs, ...)
1027   {yyyWST i;
1028    yyySIT **yyyOxStackItem = &yyval_OxAttrbs->yyyOxStackItem;
1029    yyyGNT *gnpDum;
1030    va_list ap;
1031 
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;
1060      }
1061    va_end(ap);
1062   }
1063 
1064 
1065 
1066 #define yyyDECORfREQ 50
1067 
1068 
1069 
1070 void yyyAdjustINRC(long yyyProdNum, int yyyRHSlength, long startP, long stopP, struct yyyOxAttrbs *yyval_OxAttrbs, ...)
1071   {yyyWST i;
1072    yyySIT *yyyOxStackItem = yyval_OxAttrbs->yyyOxStackItem;
1073    long SSALptr,SSALptrHead,*cPtrPtr;
1074    long *pL;
1075    yyyGNT *gnpDum;
1076    long iTemp;
1077    long nextP;
1078    static unsigned short intNodeCount = yyyDECORfREQ;
1079    va_list ap;
1080 
1081    nextP = startP;
1082    while (nextP < stopP)
1083      {if (yyyRCIL[nextP] == yyyR)
1084          {(yyyOxStackItem->node->refCountList)[yyyRCIL[nextP+1]] = yyyRCIL[nextP+2];
1085          }
1086          else
1087          {(((yyyOxStackItem->node->cL)[yyyRCIL[nextP]])->refCountList)[yyyRCIL[nextP+1]] = yyyRCIL[nextP+2];
1088          }
1089       nextP += 3;
1090      }
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;
1095       pL++;
1096       SSALptrHead = SSALptr = *(cPtrPtr = &(yaccStDum->solvedSAlist));
1097       if (SSALptr != yyyLambdaSSAL)
1098          {*cPtrPtr = yyyLambdaSSAL;
1099           do
1100             {
1101              iTemp = (*pL+yyySSALspace[SSALptr].attrbNum);
1102              yyySignalEnts(yyyOxStackItem->node,
1103                            yyyIEL[iTemp],
1104                            yyyIEL[iTemp+1]
1105                           );
1106              SSALptr = *(cPtrPtr = &(yyySSALspace[SSALptr].next));
1107             }
1108             while (SSALptr != yyyLambdaSSAL);
1109           *cPtrPtr = yyySSALCfreeList;
1110           yyySSALCfreeList = SSALptrHead;
1111          }
1112      }
1113    va_end(ap);
1114    nextP = startP + 2;
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);
1123                  }
1124                  else
1125                  {iTemp = yyySSALCfreeList;
1126                   yyySSALCfreeList = yyySSALspace[yyySSALCfreeList].next;
1127                   yyySSALspace[iTemp].next = *pL;
1128                   *pL = iTemp;
1129                  }
1130               yyySSALspace[*pL].attrbNum = yyyRCIL[nextP-1];
1131              }
1132              else
1133              {if ((gnpDum = (yyyOxStackItem->node->cL)[yyyRCIL[nextP-2]])->prodNum != 0)
1134                  {
1135                   iTemp = yyyIIEL[yyyIIIEL[gnpDum->prodNum]] + yyyRCIL[nextP-1];
1136                   yyySignalEnts(gnpDum,
1137                                 yyyIEL[iTemp],
1138                                 yyyIEL[iTemp+1]
1139                                );
1140                  }
1141              }
1142          }
1143       nextP += 3;
1144      }
1145    if (!--intNodeCount)
1146       {intNodeCount = yyyDECORfREQ;
1147        yyyDecorate();
1148       }
1149   }
1150 
1151 
1152 
1153 void yyyGenLeaf(int nAttrbs,int typeNum,long startP,long stopP,YYSTYPE *yylval)
1154   {yyyRCT *rcPdum;
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))
1161                          ;
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;
1177   }
1178 
1179 
1180 
1181 void yyyabort(void)
1182   {yyyYok = 0;
1183   }
1184 
1185 
1186 
1187 
1188 
1189 #define yyyLastProdNum 8
1190 
1191 
1192 #define yyyNsorts 1
1193 
1194 
1195 int yyyProdsInd[] = {
1196    0,
1197    0,   2,   6,  10,  14,  18,  22,  24,
1198   26,
1199 };
1200 
1201 
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},
1208 { 567,   1},
1209 };
1210 
1211 
1212 int yyySortsInd[] = {
1213   0,
1214   0,
1215   1,
1216 };
1217 
1218 
1219 int yyySorts[] = {
1220   413,
1221 };
1222 
1223 
1224 
1225 char *yyyStringTab[] = {
1226 0,0,0,0,0,
1227 0,0,0,0,0,
1228 0,0,0,0,0,
1229 0,0,0,0,0,
1230 0,0,0,0,0,
1231 0,0,0,0,0,
1232 0,0,0,0,0,
1233 0,0,0,0,0,
1234 0,0,0,0,0,
1235 0,0,0,0,0,
1236 0,0,0,0,0,
1237 0,0,0,0,0,
1238 0,0,0,0,0,
1239 0,0,0,0,0,
1240 0,0,0,0,0,
1241 0,0,0,0,0,
1242 0,0,0,0,0,
1243 0,0,0,0,0,
1244 0,0,0,0,0,
1245 0,0,0,0,0,
1246 0,0,0,0,0,
1247 0,0,0,0,0,
1248 0,0,0,0,0,
1249 0,"s",0,0,0,
1250 0,0,"y",0,0,
1251 0,0,0,0,0,
1252 0,0,0,0,0,
1253 0,0,0,0,0,
1254 0,0,0,0,0,
1255 0,0,0,0,0,
1256 0,0,0,0,0,
1257 0,0,0,0,0,
1258 0,0,0,0,0,
1259 0,0,0,0,0,
1260 0,0,0,0,0,
1261 0,0,0,0,0,
1262 0,0,0,0,0,
1263 0,0,0,0,0,
1264 0,0,0,0,0,
1265 0,0,0,0,0,
1266 0,0,0,0,0,
1267 0,0,0,0,0,
1268 0,0,0,0,0,
1269 0,0,0,0,0,
1270 0,0,0,0,0,
1271 0,0,0,0,0,
1272 0,0,0,0,0,
1273 0,0,0,0,0,
1274 0,0,0,0,0,
1275 0,0,0,0,0,
1276 0,0,0,0,0,
1277 0,0,0,0,0,
1278 0,0,0,0,0,
1279 0,0,0,0,0,
1280 0,0,0,0,0,
1281 0,0,0,0,0,
1282 0,0,0,0,0,
1283 0,0,0,0,0,
1284 0,0,0,0,0,
1285 0,0,0,0,0,
1286 0,0,0,0,0,
1287 0,0,0,0,0,
1288 0,0,0,0,0,
1289 0,0,0,0,0,
1290 0,0,0,0,0,
1291 0,"LRpre",0,0,0,
1292 0,0,0,0,0,
1293 0,0,0,0,0,
1294 0,0,0,0,0,
1295 0,0,0,0,0,
1296 0,0,0,0,0,
1297 0,0,0,0,0,
1298 0,0,0,0,0,
1299 0,0,0,0,0,
1300 0,0,0,0,0,
1301 0,0,0,0,0,
1302 0,0,0,0,0,
1303 0,0,0,0,0,
1304 0,0,0,0,0,
1305 0,"'('",0,0,0,
1306 0,0,0,0,"')'",
1307 0,0,0,0,0,
1308 0,0,"'*'","lexeme",0,
1309 0,0,0,0,0,
1310 "'+'",0,0,0,0,
1311 0,0,0,0,0,
1312 0,0,0,0,0,
1313 0,"'-'",0,0,0,
1314 0,0,0,0,0,
1315 0,0,0,0,0,
1316 0,0,"'/'",0,0,
1317 0,0,0,0,0,
1318 0,0,"expr",0,0,
1319 0,0,0,0,0,
1320 0,0,0,0,0,
1321 0,"printf",0,0,0,
1322 0,0,0,0,0,
1323 0,0,0,0,0,
1324 0,0,0,0,0,
1325 0,0,0,0,0,
1326 0,0,0,0,0,
1327 0,0,0,0,0,
1328 0,0,0,0,0,
1329 0,0,0,0,0,
1330 0,0,0,0,0,
1331 0,0,0,0,0,
1332 0,0,0,0,0,
1333 0,0,0,0,0,
1334 0,0,0,0,0,
1335 0,0,0,0,0,
1336 0,0,0,0,0,
1337 0,0,0,0,0,
1338 0,0,0,0,0,
1339 0,0,"CONST","LRpost",0,
1340 0,0,0,0,0,
1341 0,0,0,0,0,
1342 0,0,0,0,0,
1343 0,0,0,0,0,
1344 0,0,0,0,0,
1345 0,0,0,0,0,
1346 0,0,0,0,0,
1347 0,0,0,0,0,
1348 0,0,0,0,0,
1349 0,0,0,0,"ID",
1350 0,0,0,0,0,
1351 0,0,0,0,0,
1352 0,0,0,0,0,
1353 0,0,0,0,0,
1354 0,0,0,0,0,
1355 0,0,0,0,0,
1356 0,0,0,0,0,
1357 0,0,0,0,0,
1358 0,0,0,0,0,
1359 0,0,0,0,0,
1360 0,0,0,0,0,
1361 0,0,0,0,0,
1362 0,0,0,0,0,
1363 0,0,0,0,0,
1364 0,0,0,0,0,
1365 0,0,0,0,0,
1366 0,0,0,0,0,
1367 0,0,0,0,0,
1368 0,0,0,0,0,
1369 0,0,0,0,0,
1370 0,0,0,0,0,
1371 0,0,0,0,0,
1372 0,0,0,0,0,
1373 0,0,0,0,0,
1374 0,0,0,0,0,
1375 0,0,0,0,0,
1376 0,0,0,0,0,
1377 0,0,0,0,0,
1378 0,0,0,0,0,
1379 0,0,0,0,0,
1380 0,0,0,0,0,
1381 0,0,0,0,0,
1382 0,0,0,0,0,
1383 0,0,0,0,0,
1384 0,0,0,0,0,
1385 0,0,0,0,0,
1386 0,0,0,0,0,
1387 0,0,0,0,0,
1388 0,0,0,0,0,
1389 0,0,0,0,0,
1390 0,0,0,0,0,
1391 0,0,0,0,0,
1392 0,0,0,0,0,
1393 0,0,0,0,0,
1394 0,0,0,0,0,
1395 0,0,0,0,0,
1396 0,0,0,0,0,
1397 0,0,0,0,0,
1398 0,0,0,0,0,
1399 0,0,0,0,0,
1400 0,0,0,0,0,
1401 0,0,0,0,0,
1402 0,0,0,0,0,
1403 0,0,0,0,0,
1404 0,0,0,0,0,
1405 0,0,0,0,0,
1406 0,0,0,0,0,
1407 0,0,0,0,0,
1408 0,0,0,0,0,
1409 0,0,0,0,0,
1410 0,0,0,0,0,
1411 0,0,0,0,0,
1412 0,0,0,0,0,
1413 0,0,0,0,0,
1414 0,0,0,0,0,
1415 0,0,0,0,0,
1416 0,0,0,0,0,
1417 0,0,0,0,0,
1418 0,0,0,0,0,
1419 0,0,0,0,0,
1420 0,0,0,0,0,
1421 0,0,0,0,0,
1422 0,0,0,0,0,
1423 0,0,0,0,0,
1424 0,0,0,0,0,
1425 0,0,0,0,0,
1426 0,0,0,0,0,
1427 0,0,0,0,0,
1428 0,0,0,0,0,
1429 0,0,0,0,0,
1430 0,0,0,0,0,
1431 0,0,0,0,0,
1432 0,0,0,0,0,
1433 0,0,0,0,0,
1434 0,0,0,0,0,
1435 0,0,0,0,0,
1436 0,0,0,0,0,
1437 0,0,0,0,0,
1438 0,0,0,0,0,
1439 0,0,0,0,0,
1440 0,0,0,0,0,
1441 0,0,0,0,0,
1442 0,0,0,0,0,
1443 0,0,0,0,0,
1444 0,0,0,0,0,
1445 0,0,0,0,0,
1446 0,0,0,0,0,
1447 0,0,0,0,0,
1448 0,0,0,0,0,
1449 0,0,0,0,0,
1450 0,0,0,0,0,
1451 0,0,0,0,0,
1452 0,0,0,0,0,
1453 0,0,0,0,0,
1454 0,0,0,0,0,
1455 0,0,0,0,0,
1456 0,0,0,0,0,
1457 0,0,0,0,0,
1458 0,0,0,0,0,
1459 0,0,0,0,0,
1460 0,0,0,0,0,
1461 0,0,0,0,0,
1462 0,0,0,0,0,
1463 0,0,0,0,0,
1464 0,0,0,0,0,
1465 0,0,0,0,0,
1466 0,0,0,0,0,
1467 0,0,0,0,0,
1468 0,0,0,0,0,
1469 0,0,0,0,0,
1470 0,0,0,0,0,
1471 0,0,0,0,0,
1472 0,
1473 };
1474 
1475 
1476 
1477 #define yyySizeofProd(num) (yyyProdsInd[(num)+1] - yyyProdsInd[(num)])
1478 
1479 #define yyyGSoccurStr(prodNum,symPos) \
1480    (yyyStringTab[yyyProds[yyyProdsInd[(prodNum)] + (symPos)][0]])
1481 
1482 #define yyySizeofSort(num) (yyySortsInd[(num)+1] - yyySortsInd[(num)])
1483 
1484 #define yyySortOf(prodNum,symPos) \
1485   (yyyProds[yyyProdsInd[(prodNum)] + (symPos)][1])
1486 
1487 #define yyyAttrbStr(prodNum,symPos,attrbNum)                      \
1488   (yyyStringTab[yyySorts[yyySortsInd[yyySortOf(prodNum,symPos)] + \
1489                          (attrbNum)                               \
1490                         ]                                         \
1491                ]                                                  \
1492   )
1493 
1494 
1495 
1496 void yyyShowProd(int i)
1497   {int j,nSyms;
1498 
1499    nSyms = yyySizeofProd(i);
1500    for (j=0; j<nSyms; j++)
1501      {
1502       fprintf(stderr,"%s",yyyGSoccurStr(i,j));
1503       if (j == 0) fputs(" : ",stderr); else putc(' ',stderr);
1504      }
1505    fputs(";\n",stderr);
1506   }
1507 
1508 
1509 
1510 void yyyShowProds()
1511   {int i; for (i=1; i<=yyyLastProdNum; i++) yyyShowProd(i);}
1512 
1513 
1514 
1515 void yyyShowSymsAndSorts()
1516   {int i;
1517 
1518    for (i=1; i<=yyyLastProdNum; i++)
1519      {int j, nSyms;
1520 
1521       fprintf(stderr,
1522               "\n\n\n---------------------------------- %3.1d\n",i);
1523       /* yyyShowProd(i); */
1524       nSyms = yyySizeofProd(i);
1525       for (j=0; j<nSyms; j++)
1526         {int k, sortSize;
1527 
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);
1533               else
1534               putc('\n',stderr);
1535         }
1536      }
1537   }
1538 
1539 
1540 
1541 void yyyCheckNodeInstancesSolved(yyyGNT *np)
1542   {int mysort,sortSize,i,prodNum,symPos,inTerminalNode;
1543    int nUnsolvedInsts = 0;
1544 
1545    if (np->prodNum != 0)
1546      {inTerminalNode = 0;
1547       prodNum = np->prodNum;
1548       symPos = 0;
1549      }
1550    else
1551      {inTerminalNode = 1;
1552       prodNum = np->parent.noderef->prodNum;
1553       symPos = np->whichSym;
1554      }
1555    mysort = yyySortOf(prodNum,symPos);
1556    sortSize = yyySizeofSort(mysort);
1557    for (i=0; i<sortSize; i++)
1558      if ((np->refCountList)[i] != 0) nUnsolvedInsts += 1;
1559    if (nUnsolvedInsts)
1560      {fprintf(stderr,
1561       "\nFound node that has %d unsolved attribute instance(s).\n",
1562               nUnsolvedInsts
1563              );
1564       fprintf(stderr,"Node is labeled \"%s\".\n",
1565              yyyGSoccurStr(prodNum,symPos));
1566       if (inTerminalNode)
1567         {fputs("Node is terminal.  Its parent production is:\n  ",stderr);
1568          yyyShowProd(prodNum);
1569         }
1570       else
1571         {fputs("Node is nonterminal.  ",stderr);
1572          if (!(np->parentIsStack))
1573            {fprintf(stderr,
1574                     "Node is %dth child in its parent production:\n  ",
1575                    np->whichSym
1576                   );
1577             yyyShowProd(np->parent.noderef->prodNum);
1578            }
1579          fputs("Node is on left hand side of this production:\n  ",stderr);
1580          yyyShowProd(np->prodNum);
1581         }
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]);
1587      }
1588   }
1589 
1590 
1591 
1592 void yyyCheckUnsolvedInstTrav(yyyGNT *pNode,long *nNZrc,long *cycleSum)
1593   {yyyGNT **yyyCLpdum;
1594    yyyRCT *rcp;
1595    int i;
1596 
1597    /* visit the refCountList of each node in the tree, and sum the non-zero refCounts */
1598    rcp = pNode->refCountList;
1599    i = pNode->refCountListLen;
1600    while (i--)
1601       if (*rcp++) {*cycleSum += *(rcp - 1); (*nNZrc)++;}
1602    yyyCLpdum = pNode->cL;
1603    i = pNode->cLlen;
1604    while (i--)
1605      {
1606       yyyCheckUnsolvedInstTrav(*yyyCLpdum,nNZrc,cycleSum);
1607       yyyCLpdum++;
1608      }
1609   }
1610 
1611 
1612 
1613 void yyyUnsolvedInstSearchTravAux(yyyGNT *pNode)
1614   {yyyGNT **yyyCLpdum;
1615    int i;
1616 
1617    yyyCheckNodeInstancesSolved(pNode);
1618    yyyCLpdum = pNode->cL;
1619    i = pNode->cLlen;
1620    while (i--)
1621      {
1622       yyyUnsolvedInstSearchTravAux(*yyyCLpdum);
1623       yyyCLpdum++;
1624      }
1625   }
1626 
1627 
1628 
1629 void yyyUnsolvedInstSearchTrav(yyyGNT *pNode)
1630   {yyyGNT **yyyCLpdum;
1631    int i;
1632 
1633    yyyCLpdum = pNode->cL;
1634    i = pNode->cLlen;
1635    while (i--)
1636      {
1637       yyyUnsolvedInstSearchTravAux(*yyyCLpdum);
1638       yyyCLpdum++;
1639      }
1640   }
1641 
1642 
1643 
1644 #line 1645 "expr.oxout.tab.c"
1645 
1646 #if YYDEBUG
1647 #include <stdio.h>	/* needed for printf */
1648 #endif
1649 
1650 #include <stdlib.h>	/* needed for malloc, etc */
1651 #include <string.h>	/* needed for memset */
1652 
1653 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
1654 static int yygrowstack(YYSTACKDATA *data)
1655 {
1656     int i;
1657     unsigned newsize;
1658     YYINT *newss;
1659     YYSTYPE *newvs;
1660 
1661     if ((newsize = data->stacksize) == 0)
1662         newsize = YYINITSTACKSIZE;
1663     else if (newsize >= YYMAXDEPTH)
1664         return YYENOMEM;
1665     else if ((newsize *= 2) > YYMAXDEPTH)
1666         newsize = YYMAXDEPTH;
1667 
1668     i = (int) (data->s_mark - data->s_base);
1669     newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
1670     if (newss == 0)
1671         return YYENOMEM;
1672 
1673     data->s_base = newss;
1674     data->s_mark = newss + i;
1675 
1676     newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
1677     if (newvs == 0)
1678         return YYENOMEM;
1679 
1680     data->l_base = newvs;
1681     data->l_mark = newvs + i;
1682 
1683     data->stacksize = newsize;
1684     data->s_last = data->s_base + newsize - 1;
1685     return 0;
1686 }
1687 
1688 #if YYPURE || defined(YY_NO_LEAKS)
1689 static void yyfreestack(YYSTACKDATA *data)
1690 {
1691     free(data->s_base);
1692     free(data->l_base);
1693     memset(data, 0, sizeof(*data));
1694 }
1695 #else
1696 #define yyfreestack(data) /* nothing */
1697 #endif
1698 
1699 #define YYABORT  goto yyabort
1700 #define YYREJECT goto yyabort
1701 #define YYACCEPT goto yyaccept
1702 #define YYERROR  goto yyerrlab
1703 
1704 int
1705 YYPARSE_DECL()
1706 {
1707     int yym, yyn, yystate;
1708 #if YYDEBUG
1709     const char *yys;
1710 
1711     if ((yys = getenv("YYDEBUG")) != 0)
1712     {
1713         yyn = *yys;
1714         if (yyn >= '0' && yyn <= '9')
1715             yydebug = yyn - '0';
1716     }
1717 #endif
1718 
1719     yym = 0;
1720     yyn = 0;
1721     yynerrs = 0;
1722     yyerrflag = 0;
1723     yychar = YYEMPTY;
1724     yystate = 0;
1725 
1726 #if YYPURE
1727     memset(&yystack, 0, sizeof(yystack));
1728 #endif
1729 
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;
1733     yystate = 0;
1734     *yystack.s_mark = 0;
1735 
1736 yyloop:
1737     if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
1738     if (yychar < 0)
1739     {
1740         yychar = YYLEX;
1741         if (yychar < 0) yychar = YYEOF;
1742 #if YYDEBUG
1743         if (yydebug)
1744         {
1745             if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1746             printf("%sdebug: state %d, reading %d (%s)\n",
1747                     YYPREFIX, yystate, yychar, yys);
1748         }
1749 #endif
1750     }
1751     if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
1752             yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
1753     {
1754 #if YYDEBUG
1755         if (yydebug)
1756             printf("%sdebug: state %d, shifting to state %d\n",
1757                     YYPREFIX, yystate, yytable[yyn]);
1758 #endif
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;
1763         yychar = YYEMPTY;
1764         if (yyerrflag > 0)  --yyerrflag;
1765         goto yyloop;
1766     }
1767     if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
1768             yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
1769     {
1770         yyn = yytable[yyn];
1771         goto yyreduce;
1772     }
1773     if (yyerrflag != 0) goto yyinrecovery;
1774 
1775     YYERROR_CALL("syntax error");
1776 
1777     goto yyerrlab; /* redundant goto avoids 'unused label' warning */
1778 yyerrlab:
1779     ++yynerrs;
1780 
1781 yyinrecovery:
1782     if (yyerrflag < 3)
1783     {
1784         yyerrflag = 3;
1785         for (;;)
1786         {
1787             if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
1788                     yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
1789             {
1790 #if YYDEBUG
1791                 if (yydebug)
1792                     printf("%sdebug: state %d, error recovery shifting\
1793  to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
1794 #endif
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;
1799                 goto yyloop;
1800             }
1801             else
1802             {
1803 #if YYDEBUG
1804                 if (yydebug)
1805                     printf("%sdebug: error recovery discarding state %d\n",
1806                             YYPREFIX, *yystack.s_mark);
1807 #endif
1808                 if (yystack.s_mark <= yystack.s_base) goto yyabort;
1809                 --yystack.s_mark;
1810                 --yystack.l_mark;
1811             }
1812         }
1813     }
1814     else
1815     {
1816         if (yychar == YYEOF) goto yyabort;
1817 #if YYDEBUG
1818         if (yydebug)
1819         {
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);
1823         }
1824 #endif
1825         yychar = YYEMPTY;
1826         goto yyloop;
1827     }
1828 
1829 yyreduce:
1830 #if YYDEBUG
1831     if (yydebug)
1832         printf("%sdebug: state %d, reducing by rule %d (%s)\n",
1833                 YYPREFIX, yystate, yyn, yyrule[yyn]);
1834 #endif
1835     yym = yylen[yyn];
1836     if (yym > 0)
1837         yyval = yystack.l_mark[1-yym];
1838     else
1839         memset(&yyval, 0, sizeof yyval);
1840 
1841     switch (yyn)
1842     {
1843 case 1:
1844 #line 64 "expr.oxout.y"
1845 	{yyyYoxInit();}
1846 break;
1847 case 2:
1848 #line 66 "expr.oxout.y"
1849 	{
1850 		 yyyDecorate(); yyyExecuteRRsection(yystack.l_mark[0].yyyOxAttrbs.yyyOxStackItem->node);
1851 		}
1852 break;
1853 case 3:
1854 #line 73 "expr.oxout.y"
1855 	{if(yyyYok){
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);}}
1858 break;
1859 case 4:
1860 #line 80 "expr.oxout.y"
1861 	{if(yyyYok){
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);}}
1864 break;
1865 case 5:
1866 #line 87 "expr.oxout.y"
1867 	{if(yyyYok){
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);}}
1870 break;
1871 case 6:
1872 #line 94 "expr.oxout.y"
1873 	{if(yyyYok){
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);}}
1876 break;
1877 case 7:
1878 #line 101 "expr.oxout.y"
1879 	{if(yyyYok){
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);}}
1882 break;
1883 case 8:
1884 #line 108 "expr.oxout.y"
1885 	{if(yyyYok){
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);}}
1888 break;
1889 case 9:
1890 #line 114 "expr.oxout.y"
1891 	{if(yyyYok){
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);}}
1894 break;
1895 case 10:
1896 #line 121 "expr.oxout.y"
1897 	{if(yyyYok){
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);}}
1900 break;
1901 #line 1902 "expr.oxout.tab.c"
1902     }
1903     yystack.s_mark -= yym;
1904     yystate = *yystack.s_mark;
1905     yystack.l_mark -= yym;
1906     yym = yylhs[yyn];
1907     if (yystate == 0 && yym == 0)
1908     {
1909 #if YYDEBUG
1910         if (yydebug)
1911             printf("%sdebug: after reduction, shifting from state 0 to\
1912  state %d\n", YYPREFIX, YYFINAL);
1913 #endif
1914         yystate = YYFINAL;
1915         *++yystack.s_mark = YYFINAL;
1916         *++yystack.l_mark = yyval;
1917         if (yychar < 0)
1918         {
1919             yychar = YYLEX;
1920             if (yychar < 0) yychar = YYEOF;
1921 #if YYDEBUG
1922             if (yydebug)
1923             {
1924                 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1925                 printf("%sdebug: state %d, reading %d (%s)\n",
1926                         YYPREFIX, YYFINAL, yychar, yys);
1927             }
1928 #endif
1929         }
1930         if (yychar == YYEOF) goto yyaccept;
1931         goto yyloop;
1932     }
1933     if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1934             yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1935         yystate = yytable[yyn];
1936     else
1937         yystate = yydgoto[yym];
1938 #if YYDEBUG
1939     if (yydebug)
1940         printf("%sdebug: after reduction, shifting from state %d \
1941 to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
1942 #endif
1943     if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1944     *++yystack.s_mark = (YYINT) yystate;
1945     *++yystack.l_mark = yyval;
1946     goto yyloop;
1947 
1948 yyoverflow:
1949     YYERROR_CALL("yacc stack overflow");
1950 
1951 yyabort:
1952     yyfreestack(&yystack);
1953     return (1);
1954 
1955 yyaccept:
1956     yyfreestack(&yystack);
1957     return (0);
1958 }
1959