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