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 2 7 #define YYMINOR 0 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 #undef YYBTYACC 17 #define YYBTYACC 0 18 #define YYDEBUGSTR YYPREFIX "debug" 19 20 #ifndef yyparse 21 #define yyparse expr_oxout_parse 22 #endif /* yyparse */ 23 24 #ifndef yylex 25 #define yylex expr_oxout_lex 26 #endif /* yylex */ 27 28 #ifndef yyerror 29 #define yyerror expr_oxout_error 30 #endif /* yyerror */ 31 32 #ifndef yychar 33 #define yychar expr_oxout_char 34 #endif /* yychar */ 35 36 #ifndef yyval 37 #define yyval expr_oxout_val 38 #endif /* yyval */ 39 40 #ifndef yylval 41 #define yylval expr_oxout_lval 42 #endif /* yylval */ 43 44 #ifndef yydebug 45 #define yydebug expr_oxout_debug 46 #endif /* yydebug */ 47 48 #ifndef yynerrs 49 #define yynerrs expr_oxout_nerrs 50 #endif /* yynerrs */ 51 52 #ifndef yyerrflag 53 #define yyerrflag expr_oxout_errflag 54 #endif /* yyerrflag */ 55 56 #ifndef yylhs 57 #define yylhs expr_oxout_lhs 58 #endif /* yylhs */ 59 60 #ifndef yylen 61 #define yylen expr_oxout_len 62 #endif /* yylen */ 63 64 #ifndef yydefred 65 #define yydefred expr_oxout_defred 66 #endif /* yydefred */ 67 68 #ifndef yystos 69 #define yystos expr_oxout_stos 70 #endif /* yystos */ 71 72 #ifndef yydgoto 73 #define yydgoto expr_oxout_dgoto 74 #endif /* yydgoto */ 75 76 #ifndef yysindex 77 #define yysindex expr_oxout_sindex 78 #endif /* yysindex */ 79 80 #ifndef yyrindex 81 #define yyrindex expr_oxout_rindex 82 #endif /* yyrindex */ 83 84 #ifndef yygindex 85 #define yygindex expr_oxout_gindex 86 #endif /* yygindex */ 87 88 #ifndef yytable 89 #define yytable expr_oxout_table 90 #endif /* yytable */ 91 92 #ifndef yycheck 93 #define yycheck expr_oxout_check 94 #endif /* yycheck */ 95 96 #ifndef yyname 97 #define yyname expr_oxout_name 98 #endif /* yyname */ 99 100 #ifndef yyrule 101 #define yyrule expr_oxout_rule 102 #endif /* yyrule */ 103 104 #if YYBTYACC 105 106 #ifndef yycindex 107 #define yycindex expr_oxout_cindex 108 #endif /* yycindex */ 109 110 #ifndef yyctable 111 #define yyctable expr_oxout_ctable 112 #endif /* yyctable */ 113 114 #endif /* YYBTYACC */ 115 116 #define YYPREFIX "expr_oxout_" 117 118 #define YYPURE 0 119 120 #line 5 "expr.oxout.y" 121 #include <stdlib.h> 122 #include <string.h> 123 #line 8 "expr.Y" 124 125 #include "expr.oxout.h" 126 #include <stdio.h> 127 128 extern int yylex(void); 129 extern void yyerror(const char *); 130 #line 27 "expr.oxout.y" 131 #include <limits.h> 132 #define yyyR USHRT_MAX 133 #ifdef YYSTYPE 134 #undef YYSTYPE_IS_DECLARED 135 #define YYSTYPE_IS_DECLARED 1 136 #endif 137 #ifndef YYSTYPE_IS_DECLARED 138 #define YYSTYPE_IS_DECLARED 1 139 #line 31 "expr.oxout.y" 140 typedef union { 141 struct yyyOxAttrbs { 142 struct yyyStackItem *yyyOxStackItem; 143 } yyyOxAttrbs; 144 } YYSTYPE; 145 #endif /* !YYSTYPE_IS_DECLARED */ 146 #line 38 "expr.oxout.y" 147 #include <stdio.h> 148 #include <stdarg.h> 149 150 static int yyyYok = 1; 151 152 extern yyyFT yyyRCIL[]; 153 154 void yyyExecuteRRsection(yyyGNT *rootNode); 155 void yyyYoxInit(void); 156 void yyyDecorate(void); 157 struct yyyOxAttrbs; /* hack required to compensate for 'msta' behavior */ 158 void yyyGenIntNode(long yyyProdNum, int yyyRHSlength, int yyyNattrbs, struct yyyOxAttrbs *yyval_OxAttrbs, ...); 159 void yyyAdjustINRC(long yyyProdNum, int yyyRHSlength, long startP, long stopP, struct yyyOxAttrbs *yyval_OxAttrbs, ...); 160 void yyyCheckUnsolvedInstTrav(yyyGNT *rootNode,long *nNZrc,long *cycleSum); 161 void yyyUnsolvedInstSearchTrav(yyyGNT *pNode); 162 void yyyUnsolvedInstSearchTravAux(yyyGNT *pNode); 163 void yyyabort(void); 164 165 #line 166 "expr.oxout.tab.c" 166 167 /* compatibility with bison */ 168 #ifdef YYPARSE_PARAM 169 /* compatibility with FreeBSD */ 170 # ifdef YYPARSE_PARAM_TYPE 171 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM) 172 # else 173 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM) 174 # endif 175 #else 176 # define YYPARSE_DECL() yyparse(void) 177 #endif 178 179 /* Parameters sent to lex. */ 180 #ifdef YYLEX_PARAM 181 # define YYLEX_DECL() yylex(void *YYLEX_PARAM) 182 # define YYLEX yylex(YYLEX_PARAM) 183 #else 184 # define YYLEX_DECL() yylex(void) 185 # define YYLEX yylex() 186 #endif 187 188 /* Parameters sent to yyerror. */ 189 #ifndef YYERROR_DECL 190 #define YYERROR_DECL() yyerror(const char *s) 191 #endif 192 #ifndef YYERROR_CALL 193 #define YYERROR_CALL(msg) yyerror(msg) 194 #endif 195 196 extern int YYPARSE_DECL(); 197 198 #define ID 257 199 #define CONST 258 200 #define YYERRCODE 256 201 typedef int YYINT; 202 static const YYINT expr_oxout_lhs[] = { -1, 203 2, 0, 1, 3, 3, 3, 3, 3, 3, 3, 204 }; 205 static const YYINT expr_oxout_len[] = { 2, 206 0, 2, 1, 3, 3, 3, 3, 3, 1, 1, 207 }; 208 static const YYINT expr_oxout_defred[] = { 1, 209 0, 0, 9, 10, 0, 2, 0, 0, 0, 0, 210 0, 0, 8, 0, 0, 4, 0, 211 }; 212 #if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) 213 static const YYINT expr_oxout_stos[] = { 0, 214 260, 262, 257, 258, 40, 261, 263, 263, 43, 45, 215 42, 47, 41, 263, 263, 263, 263, 216 }; 217 #endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ 218 static const YYINT expr_oxout_dgoto[] = { 1, 219 6, 2, 7, 220 }; 221 static const YYINT expr_oxout_sindex[] = { 0, 222 0, -40, 0, 0, -40, 0, -18, -24, -40, -40, 223 -40, -40, 0, -37, -37, 0, -39, 224 }; 225 static const YYINT expr_oxout_rindex[] = { 0, 226 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 227 0, 0, 0, 2, 8, 0, 1, 228 }; 229 #if YYBTYACC 230 static const YYINT expr_oxout_cindex[] = { 0, 231 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 232 0, 0, 0, 0, 0, 0, 0, 233 }; 234 #endif 235 static const YYINT expr_oxout_gindex[] = { 0, 236 0, 0, 4, 237 }; 238 #define YYTABLESIZE 218 239 static const YYINT expr_oxout_table[] = { 5, 240 6, 5, 11, 0, 11, 3, 0, 7, 8, 12, 241 0, 0, 14, 15, 16, 17, 13, 11, 9, 0, 242 10, 0, 12, 11, 9, 0, 10, 0, 12, 0, 243 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 244 0, 6, 5, 6, 5, 6, 5, 6, 7, 0, 245 7, 0, 7, 0, 0, 0, 0, 0, 0, 0, 246 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 247 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 248 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 249 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 250 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 251 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 252 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 253 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 254 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 256 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 257 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 258 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 259 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 260 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 261 0, 0, 0, 0, 0, 0, 3, 4, 262 }; 263 static const YYINT expr_oxout_check[] = { 40, 264 0, 0, 42, -1, 42, 0, -1, 0, 5, 47, 265 -1, -1, 9, 10, 11, 12, 41, 42, 43, -1, 266 45, -1, 47, 42, 43, -1, 45, -1, 47, -1, 267 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 268 -1, 41, 41, 43, 43, 45, 45, 47, 41, -1, 269 43, -1, 45, -1, -1, -1, -1, -1, -1, -1, 270 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 271 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 272 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 273 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 274 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 275 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 276 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 277 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 278 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 279 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 280 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 281 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 282 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 283 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 284 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 285 -1, -1, -1, -1, -1, -1, 257, 258, 286 }; 287 #if YYBTYACC 288 static const YYINT expr_oxout_ctable[] = { -1, 289 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 290 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 291 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 292 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 293 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 294 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 295 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 296 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 297 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 298 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 299 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 300 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 301 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 302 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 303 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 304 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 305 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 306 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 307 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 308 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 309 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 310 -1, -1, -1, -1, -1, -1, -1, 311 }; 312 #endif 313 #define YYFINAL 1 314 #ifndef YYDEBUG 315 #define YYDEBUG 0 316 #endif 317 #define YYMAXTOKEN 258 318 #define YYUNDFTOKEN 264 319 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a)) 320 #if YYDEBUG 321 static const char *const expr_oxout_name[] = { 322 323 "$end",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 324 0,0,0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 325 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 326 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 327 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 328 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 329 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","ID", 330 "CONST","$accept","yyyAugNonterm","s","$$1","expr","illegal-symbol", 331 }; 332 static const char *const expr_oxout_rule[] = { 333 "$accept : yyyAugNonterm", 334 "$$1 :", 335 "yyyAugNonterm : $$1 s", 336 "s : expr", 337 "expr : expr '*' expr", 338 "expr : expr '+' expr", 339 "expr : expr '/' expr", 340 "expr : expr '-' expr", 341 "expr : '(' expr ')'", 342 "expr : ID", 343 "expr : CONST", 344 345 }; 346 #endif 347 348 #if YYDEBUG 349 int yydebug; 350 #endif 351 352 int yyerrflag; 353 int yychar; 354 YYSTYPE yyval; 355 YYSTYPE yylval; 356 int yynerrs; 357 358 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 359 YYLTYPE yyloc; /* position returned by actions */ 360 YYLTYPE yylloc; /* position from the lexer */ 361 #endif 362 363 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 364 #ifndef YYLLOC_DEFAULT 365 #define YYLLOC_DEFAULT(loc, rhs, n) \ 366 do \ 367 { \ 368 if (n == 0) \ 369 { \ 370 (loc).first_line = YYRHSLOC(rhs, 0).last_line; \ 371 (loc).first_column = YYRHSLOC(rhs, 0).last_column; \ 372 (loc).last_line = YYRHSLOC(rhs, 0).last_line; \ 373 (loc).last_column = YYRHSLOC(rhs, 0).last_column; \ 374 } \ 375 else \ 376 { \ 377 (loc).first_line = YYRHSLOC(rhs, 1).first_line; \ 378 (loc).first_column = YYRHSLOC(rhs, 1).first_column; \ 379 (loc).last_line = YYRHSLOC(rhs, n).last_line; \ 380 (loc).last_column = YYRHSLOC(rhs, n).last_column; \ 381 } \ 382 } while (0) 383 #endif /* YYLLOC_DEFAULT */ 384 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ 385 #if YYBTYACC 386 387 #ifndef YYLVQUEUEGROWTH 388 #define YYLVQUEUEGROWTH 32 389 #endif 390 #endif /* YYBTYACC */ 391 392 /* define the initial stack-sizes */ 393 #ifdef YYSTACKSIZE 394 #undef YYMAXDEPTH 395 #define YYMAXDEPTH YYSTACKSIZE 396 #else 397 #ifdef YYMAXDEPTH 398 #define YYSTACKSIZE YYMAXDEPTH 399 #else 400 #define YYSTACKSIZE 10000 401 #define YYMAXDEPTH 10000 402 #endif 403 #endif 404 405 #ifndef YYINITSTACKSIZE 406 #define YYINITSTACKSIZE 200 407 #endif 408 409 typedef struct { 410 unsigned stacksize; 411 YYINT *s_base; 412 YYINT *s_mark; 413 YYINT *s_last; 414 YYSTYPE *l_base; 415 YYSTYPE *l_mark; 416 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 417 YYLTYPE *p_base; 418 YYLTYPE *p_mark; 419 #endif 420 } YYSTACKDATA; 421 #if YYBTYACC 422 423 struct YYParseState_s 424 { 425 struct YYParseState_s *save; /* Previously saved parser state */ 426 YYSTACKDATA yystack; /* saved parser stack */ 427 int state; /* saved parser state */ 428 int errflag; /* saved error recovery status */ 429 int lexeme; /* saved index of the conflict lexeme in the lexical queue */ 430 YYINT ctry; /* saved index in yyctable[] for this conflict */ 431 }; 432 typedef struct YYParseState_s YYParseState; 433 #endif /* YYBTYACC */ 434 /* variables for the parser stack */ 435 static YYSTACKDATA yystack; 436 #if YYBTYACC 437 438 /* Current parser state */ 439 static YYParseState *yyps = 0; 440 441 /* yypath != NULL: do the full parse, starting at *yypath parser state. */ 442 static YYParseState *yypath = 0; 443 444 /* Base of the lexical value queue */ 445 static YYSTYPE *yylvals = 0; 446 447 /* Current position at lexical value queue */ 448 static YYSTYPE *yylvp = 0; 449 450 /* End position of lexical value queue */ 451 static YYSTYPE *yylve = 0; 452 453 /* The last allocated position at the lexical value queue */ 454 static YYSTYPE *yylvlim = 0; 455 456 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 457 /* Base of the lexical position queue */ 458 static YYLTYPE *yylpsns = 0; 459 460 /* Current position at lexical position queue */ 461 static YYLTYPE *yylpp = 0; 462 463 /* End position of lexical position queue */ 464 static YYLTYPE *yylpe = 0; 465 466 /* The last allocated position at the lexical position queue */ 467 static YYLTYPE *yylplim = 0; 468 #endif 469 470 /* Current position at lexical token queue */ 471 static YYINT *yylexp = 0; 472 473 static YYINT *yylexemes = 0; 474 #endif /* YYBTYACC */ 475 #line 53 "expr.Y" 476 477 478 int yyparse(void); 479 480 int main() 481 {yyparse(); 482 } 483 484 485 486 #line 138 "expr.oxout.y" 487 long yyySSALspaceSize = 20000; 488 long yyyRSmaxSize = 1000; 489 long yyyTravStackMaxSize = 2000; 490 491 struct yyySolvedSAlistCell {yyyWAT attrbNum; 492 long next; 493 }; 494 495 #define yyyLambdaSSAL 0 496 long yyySSALCfreeList = yyyLambdaSSAL; 497 long yyyNewSSALC = 1; 498 499 struct yyySolvedSAlistCell *yyySSALspace; 500 501 long yyyNbytesStackStg; 502 503 504 505 yyyFT yyyRCIL[1]; 506 507 short yyyIIIEL[] = {0, 508 0,2,6,10,14,18,22,24, 509 }; 510 511 long yyyIIEL[] = { 512 0,0,0,0,0,0,0,0,0,0,0,0, 513 0,0,0,0,0,0,0,0,0,0,0,0, 514 1,1, 515 }; 516 517 long yyyIEL[] = { 518 0,0,0, 519 }; 520 521 yyyFT yyyEntL[1]; 522 523 void yyyfatal(char *msg) 524 {fputs(msg,stderr);exit(-1);} 525 526 527 528 #define yyySSALof 'S' 529 #define yyyRSof 'q' 530 #define yyyTSof 't' 531 532 533 534 void yyyHandleOverflow(char which) 535 {char *msg1 = "?", *msg2; 536 long oldSize = 0, newSize; 537 switch(which) 538 { 539 case yyySSALof : 540 msg1 = "SSAL overflow: "; 541 oldSize = yyySSALspaceSize; 542 break; 543 case yyyRSof : 544 msg1 = "ready set overflow: "; 545 oldSize = yyyRSmaxSize; 546 break; 547 case yyyTSof : 548 msg1 = "traversal stack overflow: "; 549 oldSize = yyyTravStackMaxSize; 550 break; 551 default :; 552 } 553 newSize = (3*oldSize)/2; 554 if (newSize < 100) newSize = 100; 555 fputs(msg1,stderr); 556 fprintf(stderr,"size was %ld.\n",oldSize); 557 msg2 = " Have to modify evaluator: -Y%c%ld.\n"; 558 fprintf(stderr,msg2,which,newSize); 559 exit(-1); 560 } 561 562 563 564 void yyySignalEnts(yyyGNT *node,long startP,long stopP) 565 {yyyGNT *dumNode; 566 567 while (startP < stopP) 568 { 569 if (!yyyEntL[startP]) dumNode = node; 570 else dumNode = (node->cL)[yyyEntL[startP]-1]; 571 if (!(--((dumNode->refCountList)[yyyEntL[startP+1]] 572 ) 573 ) 574 ) 575 { 576 if (++yyyRSTop == yyyAfterRS) 577 {yyyHandleOverflow(yyyRSof); 578 break; 579 } 580 yyyRSTop->node = dumNode; 581 yyyRSTop->whichSym = yyyEntL[startP]; 582 yyyRSTop->wa = yyyEntL[startP+1]; 583 } 584 startP += 2; 585 } 586 } 587 588 589 590 591 592 593 void yyySolveAndSignal() { 594 long yyyiDum,*yyypL; 595 int yyyws,yyywa; 596 yyyGNT *yyyRSTopN,*yyyRefN; 597 yyyParent yyyRSTopNp; 598 599 600 yyyRSTopNp = (yyyRSTopN = yyyRSTop->node)->parent; 601 yyyRefN= (yyyws = (yyyRSTop->whichSym))?yyyRSTopNp.noderef:yyyRSTopN; 602 yyywa = yyyRSTop->wa; 603 yyyRSTop--; 604 switch(yyyRefN->prodNum) { 605 case 1: /***yacc rule 1***/ 606 switch (yyyws) { 607 } 608 break; 609 case 2: /***yacc rule 2***/ 610 switch (yyyws) { 611 } 612 break; 613 case 3: /***yacc rule 3***/ 614 switch (yyyws) { 615 } 616 break; 617 case 4: /***yacc rule 4***/ 618 switch (yyyws) { 619 } 620 break; 621 case 5: /***yacc rule 5***/ 622 switch (yyyws) { 623 } 624 break; 625 case 6: /***yacc rule 6***/ 626 switch (yyyws) { 627 } 628 break; 629 case 7: /***yacc rule 7***/ 630 switch (yyyws) { 631 case 1: /**/ 632 switch (yyywa) { 633 } 634 break; 635 } 636 break; 637 case 8: /***yacc rule 8***/ 638 switch (yyyws) { 639 case 1: /**/ 640 switch (yyywa) { 641 } 642 break; 643 } 644 break; 645 } /* switch */ 646 647 if (yyyws) /* the just-solved instance was inherited. */ 648 {if (yyyRSTopN->prodNum) 649 {yyyiDum = yyyIIEL[yyyIIIEL[yyyRSTopN->prodNum]] + yyywa; 650 yyySignalEnts(yyyRSTopN,yyyIEL[yyyiDum], 651 yyyIEL[yyyiDum+1] 652 ); 653 } 654 } 655 else /* the just-solved instance was synthesized. */ 656 {if (!(yyyRSTopN->parentIsStack)) /* node has a parent. */ 657 {yyyiDum = yyyIIEL[yyyIIIEL[yyyRSTopNp.noderef->prodNum] + 658 yyyRSTopN->whichSym 659 ] + 660 yyywa; 661 yyySignalEnts(yyyRSTopNp.noderef, 662 yyyIEL[yyyiDum], 663 yyyIEL[yyyiDum+1] 664 ); 665 } 666 else /* node is still on the stack--it has no parent yet. */ 667 {yyypL = &(yyyRSTopNp.stackref->solvedSAlist); 668 if (yyySSALCfreeList == yyyLambdaSSAL) 669 {yyySSALspace[yyyNewSSALC].next = *yyypL; 670 if ((*yyypL = yyyNewSSALC++) == yyySSALspaceSize) 671 yyyHandleOverflow(yyySSALof); 672 } 673 else 674 {yyyiDum = yyySSALCfreeList; 675 yyySSALCfreeList = yyySSALspace[yyySSALCfreeList].next; 676 yyySSALspace[yyyiDum].next = *yyypL; 677 *yyypL = yyyiDum; 678 } 679 yyySSALspace[*yyypL].attrbNum = yyywa; 680 } 681 } 682 683 } /* yyySolveAndSignal */ 684 685 686 687 688 689 690 #define condStg unsigned int conds; 691 #define yyyClearConds {yyyTST->conds = 0;} 692 #define yyySetCond(n) {yyyTST->conds += (1<<(n));} 693 #define yyyCond(n) ((yyyTST->conds & (1<<(n)))?1:0) 694 695 696 697 struct yyyTravStackItem {yyyGNT *node; 698 char isReady; 699 condStg 700 }; 701 702 703 704 void yyyDoTraversals(yyyGNT *rootNode) 705 {struct yyyTravStackItem *yyyTravStack,*yyyTST,*yyyAfterTravStack; 706 yyyGNT *yyyTSTn,**yyyCLptr2; 707 int yyyi,yyyRL,yyyPass; 708 int i; 709 710 if (!yyyYok) return; 711 if ((yyyTravStack = 712 ((struct yyyTravStackItem *) 713 calloc((size_t)yyyTravStackMaxSize, 714 (size_t)sizeof(struct yyyTravStackItem) 715 ) 716 ) 717 ) 718 == 719 (struct yyyTravStackItem *)NULL 720 ) 721 {fputs("malloc error in traversal stack allocation\n",stderr); 722 exit(-1); 723 } 724 725 yyyAfterTravStack = yyyTravStack + yyyTravStackMaxSize; 726 yyyTravStack++; 727 728 729 for (yyyi=0; yyyi<2; yyyi++) { 730 yyyTST = yyyTravStack; 731 yyyTST->node = rootNode; 732 yyyTST->isReady = 0; 733 yyyClearConds 734 735 while(yyyTST >= yyyTravStack) 736 {yyyTSTn = yyyTST->node; 737 if (yyyTST->isReady) 738 {yyyPass = 1; 739 goto yyyTravSwitch; 740 yyyTpop: 741 yyyTST--; 742 } 743 else 744 {yyyPass = 0; 745 goto yyyTravSwitch; 746 yyyTpush: 747 yyyTST->isReady = 1; 748 if (yyyTSTn->prodNum) 749 {if (yyyRL) 750 {yyyCLptr2 = yyyTSTn->cL; 751 i = yyyTSTn->cLlen; 752 while (i--) 753 {if (++yyyTST == yyyAfterTravStack) 754 yyyHandleOverflow(yyyTSof); 755 else 756 {yyyTST->node = *yyyCLptr2; 757 yyyTST->isReady = 0; 758 yyyClearConds 759 } 760 yyyCLptr2++; 761 } 762 } /* right to left */ 763 else /* left to right */ 764 {i = yyyTSTn->cLlen; 765 yyyCLptr2 = yyyTSTn->cL + i; 766 while (i--) 767 {yyyCLptr2--; 768 if (++yyyTST == yyyAfterTravStack) 769 yyyHandleOverflow(yyyTSof); 770 else 771 {yyyTST->node = *yyyCLptr2; 772 yyyTST->isReady = 0; 773 yyyClearConds 774 } 775 } 776 } /* left to right */ 777 } 778 } /* else */ 779 continue; 780 yyyTravSwitch: 781 switch(yyyTSTn->prodNum) { 782 case 1: 783 switch(yyyi) { 784 case 0: 785 switch(yyyPass) { 786 case 0: 787 yyyRL = 0;yyySetCond(0) 788 789 if (! 790 #line 24 "expr.Y" 791 (1) 792 #line 444 "expr.oxout.y" 793 ) yyySetCond(1) 794 yyySetCond(2) 795 796 case 1: 797 798 if (yyyCond(0) != yyyPass) { 799 #line 24 "expr.Y" 800 801 #line 453 "expr.oxout.y" 802 } 803 if (yyyCond(1) != yyyPass) { 804 #line 24 "expr.Y" 805 printf("\n"); 806 807 #line 459 "expr.oxout.y" 808 } 809 if (yyyCond(2) != yyyPass) { 810 #line 25 "expr.Y" 811 printf("prefix: "); 812 813 #line 465 "expr.oxout.y" 814 } 815 break; 816 } 817 break; 818 case 1: 819 switch(yyyPass) { 820 case 0: 821 yyyRL = 0; 822 if ( 823 #line 23 "expr.Y" 824 (1) 825 #line 477 "expr.oxout.y" 826 ) yyySetCond(2) 827 828 case 1: 829 830 if (yyyCond(0) != yyyPass) { 831 #line 22 "expr.Y" 832 printf("\n"); 833 834 #line 486 "expr.oxout.y" 835 } 836 if (yyyCond(1) != yyyPass) { 837 #line 23 "expr.Y" 838 839 #line 491 "expr.oxout.y" 840 } 841 if (yyyCond(2) != yyyPass) { 842 #line 23 "expr.Y" 843 printf("postfix: "); 844 845 #line 497 "expr.oxout.y" 846 } 847 break; 848 } 849 break; 850 } 851 852 break; 853 case 2: 854 switch(yyyi) { 855 case 0: 856 switch(yyyPass) { 857 case 0: 858 yyyRL = 0;yyySetCond(0) 859 860 case 1: 861 862 if (yyyCond(0) != yyyPass) { 863 #line 29 "expr.Y" 864 printf(" * "); 865 866 #line 518 "expr.oxout.y" 867 } 868 break; 869 } 870 break; 871 case 1: 872 switch(yyyPass) { 873 case 0: 874 yyyRL = 0; 875 case 1: 876 877 if (yyyCond(0) != yyyPass) { 878 #line 28 "expr.Y" 879 printf(" * "); 880 881 #line 533 "expr.oxout.y" 882 } 883 break; 884 } 885 break; 886 } 887 888 break; 889 case 3: 890 switch(yyyi) { 891 case 0: 892 switch(yyyPass) { 893 case 0: 894 yyyRL = 0;yyySetCond(0) 895 896 case 1: 897 898 if (yyyCond(0) != yyyPass) { 899 #line 32 "expr.Y" 900 printf(" + "); 901 902 #line 554 "expr.oxout.y" 903 } 904 break; 905 } 906 break; 907 case 1: 908 switch(yyyPass) { 909 case 0: 910 yyyRL = 0; 911 case 1: 912 913 if (yyyCond(0) != yyyPass) { 914 #line 33 "expr.Y" 915 printf(" + "); 916 917 #line 569 "expr.oxout.y" 918 } 919 break; 920 } 921 break; 922 } 923 924 break; 925 case 4: 926 switch(yyyi) { 927 case 0: 928 switch(yyyPass) { 929 case 0: 930 yyyRL = 0;yyySetCond(0) 931 932 case 1: 933 934 if (yyyCond(0) != yyyPass) { 935 #line 37 "expr.Y" 936 printf(" / "); 937 938 #line 590 "expr.oxout.y" 939 } 940 break; 941 } 942 break; 943 case 1: 944 switch(yyyPass) { 945 case 0: 946 yyyRL = 0; 947 case 1: 948 949 if (yyyCond(0) != yyyPass) { 950 #line 36 "expr.Y" 951 printf(" / "); 952 953 #line 605 "expr.oxout.y" 954 } 955 break; 956 } 957 break; 958 } 959 960 break; 961 case 5: 962 switch(yyyi) { 963 case 0: 964 switch(yyyPass) { 965 case 0: 966 yyyRL = 0;yyySetCond(0) 967 968 case 1: 969 970 if (yyyCond(0) != yyyPass) { 971 #line 41 "expr.Y" 972 printf(" - "); 973 974 #line 626 "expr.oxout.y" 975 } 976 break; 977 } 978 break; 979 case 1: 980 switch(yyyPass) { 981 case 0: 982 yyyRL = 0; 983 case 1: 984 985 if (yyyCond(0) != yyyPass) { 986 #line 40 "expr.Y" 987 printf(" - "); 988 989 #line 641 "expr.oxout.y" 990 } 991 break; 992 } 993 break; 994 } 995 996 break; 997 case 6: 998 switch(yyyi) { 999 case 0: 1000 switch(yyyPass) { 1001 case 0: 1002 yyyRL = 0; 1003 case 1: 1004 1005 break; 1006 } 1007 break; 1008 case 1: 1009 switch(yyyPass) { 1010 case 0: 1011 yyyRL = 0; 1012 case 1: 1013 1014 break; 1015 } 1016 break; 1017 } 1018 1019 break; 1020 case 7: 1021 switch(yyyi) { 1022 case 0: 1023 switch(yyyPass) { 1024 case 0: 1025 yyyRL = 0;yyySetCond(0) 1026 1027 case 1: 1028 1029 if (yyyCond(0) != yyyPass) { 1030 #line 46 "expr.Y" 1031 printf(" %s ",yyyTSTn->cL[0]->yyyAttrbs.yyyAttrb1.lexeme); 1032 1033 #line 685 "expr.oxout.y" 1034 } 1035 break; 1036 } 1037 break; 1038 case 1: 1039 switch(yyyPass) { 1040 case 0: 1041 yyyRL = 0; 1042 case 1: 1043 1044 if (yyyCond(0) != yyyPass) { 1045 #line 45 "expr.Y" 1046 printf(" %s ",yyyTSTn->cL[0]->yyyAttrbs.yyyAttrb1.lexeme); 1047 1048 #line 700 "expr.oxout.y" 1049 } 1050 break; 1051 } 1052 break; 1053 } 1054 1055 break; 1056 case 8: 1057 switch(yyyi) { 1058 case 0: 1059 switch(yyyPass) { 1060 case 0: 1061 yyyRL = 0;yyySetCond(0) 1062 1063 case 1: 1064 1065 if (yyyCond(0) != yyyPass) { 1066 #line 50 "expr.Y" 1067 printf(" %s ",yyyTSTn->cL[0]->yyyAttrbs.yyyAttrb1.lexeme); 1068 1069 #line 721 "expr.oxout.y" 1070 } 1071 break; 1072 } 1073 break; 1074 case 1: 1075 switch(yyyPass) { 1076 case 0: 1077 yyyRL = 0; 1078 case 1: 1079 1080 if (yyyCond(0) != yyyPass) { 1081 #line 49 "expr.Y" 1082 printf(" %s ",yyyTSTn->cL[0]->yyyAttrbs.yyyAttrb1.lexeme); 1083 1084 #line 736 "expr.oxout.y" 1085 } 1086 break; 1087 } 1088 break; 1089 } 1090 1091 break; 1092 } /* switch */ 1093 if (yyyPass) goto yyyTpop; else goto yyyTpush; 1094 } /* while */ 1095 } /* for */ 1096 } /* yyyDoTraversals */ 1097 1098 void yyyExecuteRRsection(yyyGNT *rootNode) { 1099 int yyyi; 1100 long cycleSum = 0; 1101 long nNZrc = 0; 1102 1103 if (!yyyYok) return; 1104 yyyCheckUnsolvedInstTrav(rootNode,&nNZrc,&cycleSum); 1105 if (nNZrc) 1106 { 1107 fputs("\n\n\n**********\n",stderr); 1108 fputs("cycle detected in completed parse tree",stderr); 1109 fputs(" after decoration.\n",stderr); 1110 #if CYCLE_VERBOSE 1111 fprintf(stderr, 1112 "number of unsolved attribute instances == %ld.\n", 1113 nNZrc 1114 ); 1115 fprintf(stderr, 1116 "total number of remaining dependencies == %ld.\n", 1117 cycleSum 1118 ); 1119 fputs("average number of remaining dependencies\n",stderr); 1120 fprintf(stderr," per unsolved instance == %f.\n", 1121 ((float)(cycleSum)/(float)(nNZrc)) 1122 ); 1123 #endif 1124 fprintf(stderr, 1125 "searching parse tree for %ld unsolved instances:\n", 1126 nNZrc 1127 ); 1128 yyyUnsolvedInstSearchTravAux(rootNode); 1129 } 1130 yyyDoTraversals(rootNode); 1131 } /* yyyExecuteRRsection */ 1132 1133 1134 1135 yyyWAT yyyLRCIL[2] = {0,0, 1136 }; 1137 1138 1139 1140 void yyyYoxInit(void) 1141 { 1142 static int yyyInitDone = 0; 1143 if (yyyInitDone) return; 1144 1145 if ((yyyRS = (yyyRSitem *) 1146 calloc((size_t)(yyyRSmaxSize+1), (size_t)sizeof(yyyRSitem)) 1147 ) 1148 == 1149 ((yyyRSitem *) NULL) 1150 ) 1151 yyyfatal("malloc error in ox ready set space allocation\n"); 1152 yyyRS++; 1153 yyyAfterRS = yyyRS + yyyRSmaxSize; 1154 1155 1156 if ((yyySSALspace = (struct yyySolvedSAlistCell *) 1157 calloc((size_t)(yyySSALspaceSize+1), (size_t)sizeof(struct yyySolvedSAlistCell)) 1158 ) 1159 == 1160 ((struct yyySolvedSAlistCell *) NULL) 1161 ) 1162 yyyfatal("malloc error in stack solved list space allocation\n"); 1163 yyyInitDone = 1; 1164 1165 yyyRSTop = yyyRS - 1; 1166 } /* yyyYoxInit */ 1167 1168 1169 1170 void yyyDecorate(void) 1171 { 1172 while (yyyRSTop >= yyyRS) 1173 yyySolveAndSignal(); 1174 } 1175 1176 1177 1178 void yyyGenIntNode(long yyyProdNum, int yyyRHSlength, int yyyNattrbs, struct yyyOxAttrbs *yyval_OxAttrbs, ...) 1179 {yyyWST i; 1180 yyySIT **yyyOxStackItem = &yyval_OxAttrbs->yyyOxStackItem; 1181 yyyGNT *gnpDum; 1182 va_list ap; 1183 1184 *yyyOxStackItem = (yyySIT *) malloc((size_t)sizeof(yyySIT)); 1185 if (*yyyOxStackItem == (yyySIT *) NULL) 1186 yyyfatal("malloc error in ox yacc semantic stack space allocation\n"); 1187 (*yyyOxStackItem)->node = 1188 (yyyGNT *) malloc((size_t)sizeof(yyyGNT)); 1189 if ((*yyyOxStackItem)->node == (yyyGNT *) NULL) 1190 yyyfatal("malloc error in ox node space allocation\n"); 1191 (*yyyOxStackItem)->solvedSAlist = yyyLambdaSSAL; 1192 (*yyyOxStackItem)->node->parent.stackref = *yyyOxStackItem; 1193 (*yyyOxStackItem)->node->parentIsStack = 1; 1194 (*yyyOxStackItem)->node->cLlen = yyyRHSlength; 1195 (*yyyOxStackItem)->node->cL = 1196 (yyyGNT **) calloc((size_t)yyyRHSlength, (size_t)sizeof(yyyGNT *)); 1197 if ((*yyyOxStackItem)->node->cL == (yyyGNT **) NULL) 1198 yyyfatal("malloc error in ox child list space allocation\n"); 1199 (*yyyOxStackItem)->node->refCountListLen = yyyNattrbs; 1200 (*yyyOxStackItem)->node->refCountList = 1201 (yyyRCT *) calloc((size_t)yyyNattrbs, (size_t)sizeof(yyyRCT)); 1202 if ((*yyyOxStackItem)->node->refCountList == (yyyRCT *) NULL) 1203 yyyfatal("malloc error in ox reference count list space allocation\n"); 1204 (*yyyOxStackItem)->node->prodNum = (int) yyyProdNum; 1205 va_start(ap, yyval_OxAttrbs); 1206 for (i=1;i<=yyyRHSlength;i++) 1207 {yyySIT *yaccStDum = va_arg(ap,struct yyyOxAttrbs *)->yyyOxStackItem; 1208 gnpDum = (*yyyOxStackItem)->node->cL[i-1] = yaccStDum->node; 1209 gnpDum->whichSym = i; 1210 gnpDum->parent.noderef = (*yyyOxStackItem)->node; 1211 gnpDum->parentIsStack = 0; 1212 } 1213 va_end(ap); 1214 } 1215 1216 1217 1218 #define yyyDECORfREQ 50 1219 1220 1221 1222 void yyyAdjustINRC(long yyyProdNum, int yyyRHSlength, long startP, long stopP, struct yyyOxAttrbs *yyval_OxAttrbs, ...) 1223 {yyyWST i; 1224 yyySIT *yyyOxStackItem = yyval_OxAttrbs->yyyOxStackItem; 1225 long SSALptr,SSALptrHead,*cPtrPtr; 1226 long *pL; 1227 yyyGNT *gnpDum; 1228 long iTemp; 1229 long nextP; 1230 static unsigned short intNodeCount = yyyDECORfREQ; 1231 va_list ap; 1232 1233 nextP = startP; 1234 while (nextP < stopP) 1235 {if (yyyRCIL[nextP] == yyyR) 1236 {(yyyOxStackItem->node->refCountList)[yyyRCIL[nextP+1]] = yyyRCIL[nextP+2]; 1237 } 1238 else 1239 {(((yyyOxStackItem->node->cL)[yyyRCIL[nextP]])->refCountList)[yyyRCIL[nextP+1]] = yyyRCIL[nextP+2]; 1240 } 1241 nextP += 3; 1242 } 1243 pL = yyyIIEL + yyyIIIEL[yyyProdNum]; 1244 va_start(ap, yyval_OxAttrbs); 1245 for (i=1;i<=yyyRHSlength;i++) 1246 {yyySIT *yaccStDum = va_arg(ap,struct yyyOxAttrbs *)->yyyOxStackItem; 1247 pL++; 1248 SSALptrHead = SSALptr = *(cPtrPtr = &(yaccStDum->solvedSAlist)); 1249 if (SSALptr != yyyLambdaSSAL) 1250 {*cPtrPtr = yyyLambdaSSAL; 1251 do 1252 { 1253 iTemp = (*pL+yyySSALspace[SSALptr].attrbNum); 1254 yyySignalEnts(yyyOxStackItem->node, 1255 yyyIEL[iTemp], 1256 yyyIEL[iTemp+1] 1257 ); 1258 SSALptr = *(cPtrPtr = &(yyySSALspace[SSALptr].next)); 1259 } 1260 while (SSALptr != yyyLambdaSSAL); 1261 *cPtrPtr = yyySSALCfreeList; 1262 yyySSALCfreeList = SSALptrHead; 1263 } 1264 } 1265 va_end(ap); 1266 nextP = startP + 2; 1267 while (nextP < stopP) 1268 {if (!yyyRCIL[nextP]) 1269 {if (yyyRCIL[nextP-2] == yyyR) 1270 {pL = &(yyyOxStackItem->solvedSAlist); 1271 if (yyySSALCfreeList == yyyLambdaSSAL) 1272 {yyySSALspace[yyyNewSSALC].next = *pL; 1273 if ((*pL = yyyNewSSALC++) == yyySSALspaceSize) 1274 yyyHandleOverflow(yyySSALof); 1275 } 1276 else 1277 {iTemp = yyySSALCfreeList; 1278 yyySSALCfreeList = yyySSALspace[yyySSALCfreeList].next; 1279 yyySSALspace[iTemp].next = *pL; 1280 *pL = iTemp; 1281 } 1282 yyySSALspace[*pL].attrbNum = yyyRCIL[nextP-1]; 1283 } 1284 else 1285 {if ((gnpDum = (yyyOxStackItem->node->cL)[yyyRCIL[nextP-2]])->prodNum != 0) 1286 { 1287 iTemp = yyyIIEL[yyyIIIEL[gnpDum->prodNum]] + yyyRCIL[nextP-1]; 1288 yyySignalEnts(gnpDum, 1289 yyyIEL[iTemp], 1290 yyyIEL[iTemp+1] 1291 ); 1292 } 1293 } 1294 } 1295 nextP += 3; 1296 } 1297 if (!--intNodeCount) 1298 {intNodeCount = yyyDECORfREQ; 1299 yyyDecorate(); 1300 } 1301 } 1302 1303 1304 1305 void yyyGenLeaf(int nAttrbs,int typeNum,long startP,long stopP,YYSTYPE *mylval) 1306 {yyyRCT *rcPdum; 1307 yyySIT **yyyOxStackItem = &mylval->yyyOxAttrbs.yyyOxStackItem; 1308 (*yyyOxStackItem) = (yyySIT *) malloc((size_t)sizeof(yyySIT)); 1309 if ((*yyyOxStackItem) == (yyySIT *) NULL) 1310 yyyfatal("malloc error in ox yacc semantic stack space allocation\n"); 1311 (*yyyOxStackItem)->node = 1312 (yyyGNT *) malloc((size_t)sizeof(yyyGNT)) 1313 ; 1314 if ((*yyyOxStackItem)->node == (yyyGNT *) NULL) 1315 yyyfatal("malloc error in ox node space allocation\n"); 1316 (*yyyOxStackItem)->solvedSAlist = yyyLambdaSSAL; 1317 (*yyyOxStackItem)->node->parent.stackref = *yyyOxStackItem; 1318 (*yyyOxStackItem)->node->parentIsStack = 1; 1319 (*yyyOxStackItem)->node->cLlen = 0; 1320 (*yyyOxStackItem)->node->cL = (yyyGNT **)NULL; 1321 (*yyyOxStackItem)->node->refCountListLen = nAttrbs; 1322 rcPdum = (*yyyOxStackItem)->node->refCountList = 1323 (yyyRCT *) calloc((size_t)nAttrbs, (size_t)sizeof(yyyRCT)); 1324 if (rcPdum == (yyyRCT *) NULL) 1325 yyyfatal("malloc error in ox reference count list space allocation\n"); 1326 while (startP < stopP) rcPdum[yyyLRCIL[startP++]] = 0; 1327 (*yyyOxStackItem)->node->prodNum = 0; 1328 (*yyyOxStackItem)->node->whichSym = 0; 1329 } 1330 1331 1332 1333 void yyyabort(void) 1334 {yyyYok = 0; 1335 } 1336 1337 1338 1339 1340 1341 #define yyyLastProdNum 8 1342 1343 1344 #define yyyNsorts 1 1345 1346 1347 int yyyProdsInd[] = { 1348 0, 1349 0, 2, 6, 10, 14, 18, 22, 24, 1350 26, 1351 }; 1352 1353 1354 int yyyProds[][2] = { 1355 { 116, 0},{ 462, 0},{ 462, 0},{ 462, 0},{ 412, 0}, 1356 { 462, 0},{ 462, 0},{ 462, 0},{ 420, 0},{ 462, 0}, 1357 { 462, 0},{ 462, 0},{ 452, 0},{ 462, 0},{ 462, 0}, 1358 { 462, 0},{ 436, 0},{ 462, 0},{ 462, 0},{ 396, 0}, 1359 { 462, 0},{ 404, 0},{ 462, 0},{ 619, 1},{ 462, 0}, 1360 { 567, 1}, 1361 }; 1362 1363 1364 int yyySortsInd[] = { 1365 0, 1366 0, 1367 1, 1368 }; 1369 1370 1371 int yyySorts[] = { 1372 413, 1373 }; 1374 1375 1376 1377 char *yyyStringTab[] = { 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,"s",0,0,0, 1402 0,0,"y",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,"LRpre",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, 1458 0,0,0,0,"')'", 1459 0,0,0,0,0, 1460 0,0,"'*'","lexeme",0, 1461 0,0,0,0,0, 1462 "'+'",0,0,0,0, 1463 0,0,0,0,0, 1464 0,0,0,0,0, 1465 0,"'-'",0,0,0, 1466 0,0,0,0,0, 1467 0,0,0,0,0, 1468 0,0,"'/'",0,0, 1469 0,0,0,0,0, 1470 0,0,"expr",0,0, 1471 0,0,0,0,0, 1472 0,0,0,0,0, 1473 0,"printf",0,0,0, 1474 0,0,0,0,0, 1475 0,0,0,0,0, 1476 0,0,0,0,0, 1477 0,0,0,0,0, 1478 0,0,0,0,0, 1479 0,0,0,0,0, 1480 0,0,0,0,0, 1481 0,0,0,0,0, 1482 0,0,0,0,0, 1483 0,0,0,0,0, 1484 0,0,0,0,0, 1485 0,0,0,0,0, 1486 0,0,0,0,0, 1487 0,0,0,0,0, 1488 0,0,0,0,0, 1489 0,0,0,0,0, 1490 0,0,0,0,0, 1491 0,0,"CONST","LRpost",0, 1492 0,0,0,0,0, 1493 0,0,0,0,0, 1494 0,0,0,0,0, 1495 0,0,0,0,0, 1496 0,0,0,0,0, 1497 0,0,0,0,0, 1498 0,0,0,0,0, 1499 0,0,0,0,0, 1500 0,0,0,0,0, 1501 0,0,0,0,"ID", 1502 0,0,0,0,0, 1503 0,0,0,0,0, 1504 0,0,0,0,0, 1505 0,0,0,0,0, 1506 0,0,0,0,0, 1507 0,0,0,0,0, 1508 0,0,0,0,0, 1509 0,0,0,0,0, 1510 0,0,0,0,0, 1511 0,0,0,0,0, 1512 0,0,0,0,0, 1513 0,0,0,0,0, 1514 0,0,0,0,0, 1515 0,0,0,0,0, 1516 0,0,0,0,0, 1517 0,0,0,0,0, 1518 0,0,0,0,0, 1519 0,0,0,0,0, 1520 0,0,0,0,0, 1521 0,0,0,0,0, 1522 0,0,0,0,0, 1523 0,0,0,0,0, 1524 0,0,0,0,0, 1525 0,0,0,0,0, 1526 0,0,0,0,0, 1527 0,0,0,0,0, 1528 0,0,0,0,0, 1529 0,0,0,0,0, 1530 0,0,0,0,0, 1531 0,0,0,0,0, 1532 0,0,0,0,0, 1533 0,0,0,0,0, 1534 0,0,0,0,0, 1535 0,0,0,0,0, 1536 0,0,0,0,0, 1537 0,0,0,0,0, 1538 0,0,0,0,0, 1539 0,0,0,0,0, 1540 0,0,0,0,0, 1541 0,0,0,0,0, 1542 0,0,0,0,0, 1543 0,0,0,0,0, 1544 0,0,0,0,0, 1545 0,0,0,0,0, 1546 0,0,0,0,0, 1547 0,0,0,0,0, 1548 0,0,0,0,0, 1549 0,0,0,0,0, 1550 0,0,0,0,0, 1551 0,0,0,0,0, 1552 0,0,0,0,0, 1553 0,0,0,0,0, 1554 0,0,0,0,0, 1555 0,0,0,0,0, 1556 0,0,0,0,0, 1557 0,0,0,0,0, 1558 0,0,0,0,0, 1559 0,0,0,0,0, 1560 0,0,0,0,0, 1561 0,0,0,0,0, 1562 0,0,0,0,0, 1563 0,0,0,0,0, 1564 0,0,0,0,0, 1565 0,0,0,0,0, 1566 0,0,0,0,0, 1567 0,0,0,0,0, 1568 0,0,0,0,0, 1569 0,0,0,0,0, 1570 0,0,0,0,0, 1571 0,0,0,0,0, 1572 0,0,0,0,0, 1573 0,0,0,0,0, 1574 0,0,0,0,0, 1575 0,0,0,0,0, 1576 0,0,0,0,0, 1577 0,0,0,0,0, 1578 0,0,0,0,0, 1579 0,0,0,0,0, 1580 0,0,0,0,0, 1581 0,0,0,0,0, 1582 0,0,0,0,0, 1583 0,0,0,0,0, 1584 0,0,0,0,0, 1585 0,0,0,0,0, 1586 0,0,0,0,0, 1587 0,0,0,0,0, 1588 0,0,0,0,0, 1589 0,0,0,0,0, 1590 0,0,0,0,0, 1591 0,0,0,0,0, 1592 0,0,0,0,0, 1593 0,0,0,0,0, 1594 0,0,0,0,0, 1595 0,0,0,0,0, 1596 0,0,0,0,0, 1597 0,0,0,0,0, 1598 0,0,0,0,0, 1599 0,0,0,0,0, 1600 0,0,0,0,0, 1601 0,0,0,0,0, 1602 0,0,0,0,0, 1603 0,0,0,0,0, 1604 0,0,0,0,0, 1605 0,0,0,0,0, 1606 0,0,0,0,0, 1607 0,0,0,0,0, 1608 0,0,0,0,0, 1609 0,0,0,0,0, 1610 0,0,0,0,0, 1611 0,0,0,0,0, 1612 0,0,0,0,0, 1613 0,0,0,0,0, 1614 0,0,0,0,0, 1615 0,0,0,0,0, 1616 0,0,0,0,0, 1617 0,0,0,0,0, 1618 0,0,0,0,0, 1619 0,0,0,0,0, 1620 0,0,0,0,0, 1621 0,0,0,0,0, 1622 0,0,0,0,0, 1623 0,0,0,0,0, 1624 0, 1625 }; 1626 1627 1628 1629 #define yyySizeofProd(num) (yyyProdsInd[(num)+1] - yyyProdsInd[(num)]) 1630 1631 #define yyyGSoccurStr(prodNum,symPos) \ 1632 (yyyStringTab[yyyProds[yyyProdsInd[(prodNum)] + (symPos)][0]]) 1633 1634 #define yyySizeofSort(num) (yyySortsInd[(num)+1] - yyySortsInd[(num)]) 1635 1636 #define yyySortOf(prodNum,symPos) \ 1637 (yyyProds[yyyProdsInd[(prodNum)] + (symPos)][1]) 1638 1639 #define yyyAttrbStr(prodNum,symPos,attrbNum) \ 1640 (yyyStringTab[yyySorts[yyySortsInd[yyySortOf(prodNum,symPos)] + \ 1641 (attrbNum) \ 1642 ] \ 1643 ] \ 1644 ) 1645 1646 1647 1648 void yyyShowProd(int i) 1649 {int j,nSyms; 1650 1651 nSyms = yyySizeofProd(i); 1652 for (j=0; j<nSyms; j++) 1653 { 1654 fprintf(stderr,"%s",yyyGSoccurStr(i,j)); 1655 if (j == 0) fputs(" : ",stderr); else putc(' ',stderr); 1656 } 1657 fputs(";\n",stderr); 1658 } 1659 1660 1661 1662 void yyyShowProds() 1663 {int i; for (i=1; i<=yyyLastProdNum; i++) yyyShowProd(i);} 1664 1665 1666 1667 void yyyShowSymsAndSorts() 1668 {int i; 1669 1670 for (i=1; i<=yyyLastProdNum; i++) 1671 {int j, nSyms; 1672 1673 fprintf(stderr, 1674 "\n\n\n---------------------------------- %3.1d\n",i); 1675 /* yyyShowProd(i); */ 1676 nSyms = yyySizeofProd(i); 1677 for (j=0; j<nSyms; j++) 1678 {int k, sortSize; 1679 1680 fprintf(stderr,"%s\n",yyyGSoccurStr(i,j)); 1681 sortSize = yyySizeofSort(yyySortOf(i,j)); 1682 for (k=0; k<sortSize; k++) 1683 fprintf(stderr," %s\n",yyyAttrbStr(i,j,k)); 1684 if (j == 0) fputs("->\n",stderr); 1685 else 1686 putc('\n',stderr); 1687 } 1688 } 1689 } 1690 1691 1692 1693 void yyyCheckNodeInstancesSolved(yyyGNT *np) 1694 {int mysort,sortSize,i,prodNum,symPos,inTerminalNode; 1695 int nUnsolvedInsts = 0; 1696 1697 if (np->prodNum != 0) 1698 {inTerminalNode = 0; 1699 prodNum = np->prodNum; 1700 symPos = 0; 1701 } 1702 else 1703 {inTerminalNode = 1; 1704 prodNum = np->parent.noderef->prodNum; 1705 symPos = np->whichSym; 1706 } 1707 mysort = yyySortOf(prodNum,symPos); 1708 sortSize = yyySizeofSort(mysort); 1709 for (i=0; i<sortSize; i++) 1710 if ((np->refCountList)[i] != 0) nUnsolvedInsts += 1; 1711 if (nUnsolvedInsts) 1712 {fprintf(stderr, 1713 "\nFound node that has %d unsolved attribute instance(s).\n", 1714 nUnsolvedInsts 1715 ); 1716 fprintf(stderr,"Node is labeled \"%s\".\n", 1717 yyyGSoccurStr(prodNum,symPos)); 1718 if (inTerminalNode) 1719 {fputs("Node is terminal. Its parent production is:\n ",stderr); 1720 yyyShowProd(prodNum); 1721 } 1722 else 1723 {fputs("Node is nonterminal. ",stderr); 1724 if (!(np->parentIsStack)) 1725 {fprintf(stderr, 1726 "Node is %dth child in its parent production:\n ", 1727 np->whichSym 1728 ); 1729 yyyShowProd(np->parent.noderef->prodNum); 1730 } 1731 fputs("Node is on left hand side of this production:\n ",stderr); 1732 yyyShowProd(np->prodNum); 1733 } 1734 fputs("The following instances are unsolved:\n",stderr); 1735 for (i=0; i<sortSize; i++) 1736 if ((np->refCountList)[i] != 0) 1737 fprintf(stderr," %-16s still has %1d dependencies.\n", 1738 yyyAttrbStr(prodNum,symPos,i),(np->refCountList)[i]); 1739 } 1740 } 1741 1742 1743 1744 void yyyCheckUnsolvedInstTrav(yyyGNT *pNode,long *nNZrc,long *cycleSum) 1745 {yyyGNT **yyyCLpdum; 1746 yyyRCT *rcp; 1747 int i; 1748 1749 /* visit the refCountList of each node in the tree, and sum the non-zero refCounts */ 1750 rcp = pNode->refCountList; 1751 i = pNode->refCountListLen; 1752 while (i--) 1753 if (*rcp++) {*cycleSum += *(rcp - 1); (*nNZrc)++;} 1754 yyyCLpdum = pNode->cL; 1755 i = pNode->cLlen; 1756 while (i--) 1757 { 1758 yyyCheckUnsolvedInstTrav(*yyyCLpdum,nNZrc,cycleSum); 1759 yyyCLpdum++; 1760 } 1761 } 1762 1763 1764 1765 void yyyUnsolvedInstSearchTravAux(yyyGNT *pNode) 1766 {yyyGNT **yyyCLpdum; 1767 int i; 1768 1769 yyyCheckNodeInstancesSolved(pNode); 1770 yyyCLpdum = pNode->cL; 1771 i = pNode->cLlen; 1772 while (i--) 1773 { 1774 yyyUnsolvedInstSearchTravAux(*yyyCLpdum); 1775 yyyCLpdum++; 1776 } 1777 } 1778 1779 1780 1781 void yyyUnsolvedInstSearchTrav(yyyGNT *pNode) 1782 {yyyGNT **yyyCLpdum; 1783 int i; 1784 1785 yyyCLpdum = pNode->cL; 1786 i = pNode->cLlen; 1787 while (i--) 1788 { 1789 yyyUnsolvedInstSearchTravAux(*yyyCLpdum); 1790 yyyCLpdum++; 1791 } 1792 } 1793 1794 1795 1796 #line 1797 "expr.oxout.tab.c" 1797 1798 /* For use in generated program */ 1799 #define yydepth (int)(yystack.s_mark - yystack.s_base) 1800 #if YYBTYACC 1801 #define yytrial (yyps->save) 1802 #endif /* YYBTYACC */ 1803 1804 #if YYDEBUG 1805 #include <stdio.h> /* needed for printf */ 1806 #endif 1807 1808 #include <stdlib.h> /* needed for malloc, etc */ 1809 #include <string.h> /* needed for memset */ 1810 1811 /* allocate initial stack or double stack size, up to YYMAXDEPTH */ 1812 static int yygrowstack(YYSTACKDATA *data) 1813 { 1814 int i; 1815 unsigned newsize; 1816 YYINT *newss; 1817 YYSTYPE *newvs; 1818 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1819 YYLTYPE *newps; 1820 #endif 1821 1822 if ((newsize = data->stacksize) == 0) 1823 newsize = YYINITSTACKSIZE; 1824 else if (newsize >= YYMAXDEPTH) 1825 return YYENOMEM; 1826 else if ((newsize *= 2) > YYMAXDEPTH) 1827 newsize = YYMAXDEPTH; 1828 1829 i = (int) (data->s_mark - data->s_base); 1830 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss)); 1831 if (newss == NULL) 1832 return YYENOMEM; 1833 1834 data->s_base = newss; 1835 data->s_mark = newss + i; 1836 1837 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)); 1838 if (newvs == NULL) 1839 return YYENOMEM; 1840 1841 data->l_base = newvs; 1842 data->l_mark = newvs + i; 1843 1844 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1845 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps)); 1846 if (newps == NULL) 1847 return YYENOMEM; 1848 1849 data->p_base = newps; 1850 data->p_mark = newps + i; 1851 #endif 1852 1853 data->stacksize = newsize; 1854 data->s_last = data->s_base + newsize - 1; 1855 1856 #if YYDEBUG 1857 if (yydebug) 1858 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize); 1859 #endif 1860 return 0; 1861 } 1862 1863 #if YYPURE || defined(YY_NO_LEAKS) 1864 static void yyfreestack(YYSTACKDATA *data) 1865 { 1866 free(data->s_base); 1867 free(data->l_base); 1868 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1869 free(data->p_base); 1870 #endif 1871 memset(data, 0, sizeof(*data)); 1872 } 1873 #else 1874 #define yyfreestack(data) /* nothing */ 1875 #endif /* YYPURE || defined(YY_NO_LEAKS) */ 1876 #if YYBTYACC 1877 1878 static YYParseState * 1879 yyNewState(unsigned size) 1880 { 1881 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState)); 1882 if (p == NULL) return NULL; 1883 1884 p->yystack.stacksize = size; 1885 if (size == 0) 1886 { 1887 p->yystack.s_base = NULL; 1888 p->yystack.l_base = NULL; 1889 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1890 p->yystack.p_base = NULL; 1891 #endif 1892 return p; 1893 } 1894 p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT)); 1895 if (p->yystack.s_base == NULL) return NULL; 1896 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE)); 1897 if (p->yystack.l_base == NULL) return NULL; 1898 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE)); 1899 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1900 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE)); 1901 if (p->yystack.p_base == NULL) return NULL; 1902 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE)); 1903 #endif 1904 1905 return p; 1906 } 1907 1908 static void 1909 yyFreeState(YYParseState *p) 1910 { 1911 yyfreestack(&p->yystack); 1912 free(p); 1913 } 1914 #endif /* YYBTYACC */ 1915 1916 #define YYABORT goto yyabort 1917 #define YYREJECT goto yyabort 1918 #define YYACCEPT goto yyaccept 1919 #define YYERROR goto yyerrlab 1920 #if YYBTYACC 1921 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0) 1922 #define YYVALID_NESTED do { if (yyps->save && \ 1923 yyps->save->save == 0) goto yyvalid; } while(0) 1924 #endif /* YYBTYACC */ 1925 1926 int 1927 YYPARSE_DECL() 1928 { 1929 int yym, yyn, yystate, yyresult; 1930 #if YYBTYACC 1931 int yynewerrflag; 1932 YYParseState *yyerrctx = NULL; 1933 #endif /* YYBTYACC */ 1934 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1935 YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */ 1936 #endif 1937 #if YYDEBUG 1938 const char *yys; 1939 1940 if ((yys = getenv("YYDEBUG")) != NULL) 1941 { 1942 yyn = *yys; 1943 if (yyn >= '0' && yyn <= '9') 1944 yydebug = yyn - '0'; 1945 } 1946 if (yydebug) 1947 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX); 1948 #endif 1949 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1950 memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range)); 1951 #endif 1952 1953 #if YYBTYACC 1954 yyps = yyNewState(0); if (yyps == 0) goto yyenomem; 1955 yyps->save = 0; 1956 #endif /* YYBTYACC */ 1957 yym = 0; 1958 /* yyn is set below */ 1959 yynerrs = 0; 1960 yyerrflag = 0; 1961 yychar = YYEMPTY; 1962 yystate = 0; 1963 1964 #if YYPURE 1965 memset(&yystack, 0, sizeof(yystack)); 1966 #endif 1967 1968 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 1969 yystack.s_mark = yystack.s_base; 1970 yystack.l_mark = yystack.l_base; 1971 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1972 yystack.p_mark = yystack.p_base; 1973 #endif 1974 yystate = 0; 1975 *yystack.s_mark = 0; 1976 1977 yyloop: 1978 if ((yyn = yydefred[yystate]) != 0) goto yyreduce; 1979 if (yychar < 0) 1980 { 1981 #if YYBTYACC 1982 do { 1983 if (yylvp < yylve) 1984 { 1985 /* we're currently re-reading tokens */ 1986 yylval = *yylvp++; 1987 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 1988 yylloc = *yylpp++; 1989 #endif 1990 yychar = *yylexp++; 1991 break; 1992 } 1993 if (yyps->save) 1994 { 1995 /* in trial mode; save scanner results for future parse attempts */ 1996 if (yylvp == yylvlim) 1997 { /* Enlarge lexical value queue */ 1998 size_t p = (size_t) (yylvp - yylvals); 1999 size_t s = (size_t) (yylvlim - yylvals); 2000 2001 s += YYLVQUEUEGROWTH; 2002 if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; 2003 if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; 2004 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2005 if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; 2006 #endif 2007 yylvp = yylve = yylvals + p; 2008 yylvlim = yylvals + s; 2009 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2010 yylpp = yylpe = yylpsns + p; 2011 yylplim = yylpsns + s; 2012 #endif 2013 yylexp = yylexemes + p; 2014 } 2015 *yylexp = (YYINT) YYLEX; 2016 *yylvp++ = yylval; 2017 yylve++; 2018 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2019 *yylpp++ = yylloc; 2020 yylpe++; 2021 #endif 2022 yychar = *yylexp++; 2023 break; 2024 } 2025 /* normal operation, no conflict encountered */ 2026 #endif /* YYBTYACC */ 2027 yychar = YYLEX; 2028 #if YYBTYACC 2029 } while (0); 2030 #endif /* YYBTYACC */ 2031 if (yychar < 0) yychar = YYEOF; 2032 #if YYDEBUG 2033 if (yydebug) 2034 { 2035 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 2036 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)", 2037 YYDEBUGSTR, yydepth, yystate, yychar, yys); 2038 #ifdef YYSTYPE_TOSTRING 2039 #if YYBTYACC 2040 if (!yytrial) 2041 #endif /* YYBTYACC */ 2042 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval)); 2043 #endif 2044 fputc('\n', stderr); 2045 } 2046 #endif 2047 } 2048 #if YYBTYACC 2049 2050 /* Do we have a conflict? */ 2051 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 && 2052 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) 2053 { 2054 YYINT ctry; 2055 2056 if (yypath) 2057 { 2058 YYParseState *save; 2059 #if YYDEBUG 2060 if (yydebug) 2061 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n", 2062 YYDEBUGSTR, yydepth, yystate); 2063 #endif 2064 /* Switch to the next conflict context */ 2065 save = yypath; 2066 yypath = save->save; 2067 save->save = NULL; 2068 ctry = save->ctry; 2069 if (save->state != yystate) YYABORT; 2070 yyFreeState(save); 2071 2072 } 2073 else 2074 { 2075 2076 /* Unresolved conflict - start/continue trial parse */ 2077 YYParseState *save; 2078 #if YYDEBUG 2079 if (yydebug) 2080 { 2081 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate); 2082 if (yyps->save) 2083 fputs("ALREADY in conflict, continuing trial parse.\n", stderr); 2084 else 2085 fputs("Starting trial parse.\n", stderr); 2086 } 2087 #endif 2088 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1)); 2089 if (save == NULL) goto yyenomem; 2090 save->save = yyps->save; 2091 save->state = yystate; 2092 save->errflag = yyerrflag; 2093 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); 2094 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT)); 2095 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); 2096 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); 2097 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2098 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); 2099 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); 2100 #endif 2101 ctry = yytable[yyn]; 2102 if (yyctable[ctry] == -1) 2103 { 2104 #if YYDEBUG 2105 if (yydebug && yychar >= YYEOF) 2106 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth); 2107 #endif 2108 ctry++; 2109 } 2110 save->ctry = ctry; 2111 if (yyps->save == NULL) 2112 { 2113 /* If this is a first conflict in the stack, start saving lexemes */ 2114 if (!yylexemes) 2115 { 2116 yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); 2117 if (yylexemes == NULL) goto yyenomem; 2118 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); 2119 if (yylvals == NULL) goto yyenomem; 2120 yylvlim = yylvals + YYLVQUEUEGROWTH; 2121 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2122 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE)); 2123 if (yylpsns == NULL) goto yyenomem; 2124 yylplim = yylpsns + YYLVQUEUEGROWTH; 2125 #endif 2126 } 2127 if (yylvp == yylve) 2128 { 2129 yylvp = yylve = yylvals; 2130 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2131 yylpp = yylpe = yylpsns; 2132 #endif 2133 yylexp = yylexemes; 2134 if (yychar >= YYEOF) 2135 { 2136 *yylve++ = yylval; 2137 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2138 *yylpe++ = yylloc; 2139 #endif 2140 *yylexp = (YYINT) yychar; 2141 yychar = YYEMPTY; 2142 } 2143 } 2144 } 2145 if (yychar >= YYEOF) 2146 { 2147 yylvp--; 2148 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2149 yylpp--; 2150 #endif 2151 yylexp--; 2152 yychar = YYEMPTY; 2153 } 2154 save->lexeme = (int) (yylvp - yylvals); 2155 yyps->save = save; 2156 } 2157 if (yytable[yyn] == ctry) 2158 { 2159 #if YYDEBUG 2160 if (yydebug) 2161 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n", 2162 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]); 2163 #endif 2164 if (yychar < 0) 2165 { 2166 yylvp++; 2167 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2168 yylpp++; 2169 #endif 2170 yylexp++; 2171 } 2172 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) 2173 goto yyoverflow; 2174 yystate = yyctable[ctry]; 2175 *++yystack.s_mark = (YYINT) yystate; 2176 *++yystack.l_mark = yylval; 2177 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2178 *++yystack.p_mark = yylloc; 2179 #endif 2180 yychar = YYEMPTY; 2181 if (yyerrflag > 0) --yyerrflag; 2182 goto yyloop; 2183 } 2184 else 2185 { 2186 yyn = yyctable[ctry]; 2187 goto yyreduce; 2188 } 2189 } /* End of code dealing with conflicts */ 2190 #endif /* YYBTYACC */ 2191 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && 2192 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) 2193 { 2194 #if YYDEBUG 2195 if (yydebug) 2196 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n", 2197 YYDEBUGSTR, yydepth, yystate, yytable[yyn]); 2198 #endif 2199 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 2200 yystate = yytable[yyn]; 2201 *++yystack.s_mark = yytable[yyn]; 2202 *++yystack.l_mark = yylval; 2203 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2204 *++yystack.p_mark = yylloc; 2205 #endif 2206 yychar = YYEMPTY; 2207 if (yyerrflag > 0) --yyerrflag; 2208 goto yyloop; 2209 } 2210 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && 2211 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) 2212 { 2213 yyn = yytable[yyn]; 2214 goto yyreduce; 2215 } 2216 if (yyerrflag != 0) goto yyinrecovery; 2217 #if YYBTYACC 2218 2219 yynewerrflag = 1; 2220 goto yyerrhandler; 2221 goto yyerrlab; /* redundant goto avoids 'unused label' warning */ 2222 2223 yyerrlab: 2224 /* explicit YYERROR from an action -- pop the rhs of the rule reduced 2225 * before looking for error recovery */ 2226 yystack.s_mark -= yym; 2227 yystate = *yystack.s_mark; 2228 yystack.l_mark -= yym; 2229 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2230 yystack.p_mark -= yym; 2231 #endif 2232 2233 yynewerrflag = 0; 2234 yyerrhandler: 2235 while (yyps->save) 2236 { 2237 int ctry; 2238 YYParseState *save = yyps->save; 2239 #if YYDEBUG 2240 if (yydebug) 2241 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n", 2242 YYDEBUGSTR, yydepth, yystate, yyps->save->state, 2243 (int)(yylvp - yylvals - yyps->save->lexeme)); 2244 #endif 2245 /* Memorize most forward-looking error state in case it's really an error. */ 2246 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals) 2247 { 2248 /* Free old saved error context state */ 2249 if (yyerrctx) yyFreeState(yyerrctx); 2250 /* Create and fill out new saved error context state */ 2251 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1)); 2252 if (yyerrctx == NULL) goto yyenomem; 2253 yyerrctx->save = yyps->save; 2254 yyerrctx->state = yystate; 2255 yyerrctx->errflag = yyerrflag; 2256 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); 2257 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT)); 2258 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); 2259 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); 2260 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2261 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); 2262 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); 2263 #endif 2264 yyerrctx->lexeme = (int) (yylvp - yylvals); 2265 } 2266 yylvp = yylvals + save->lexeme; 2267 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2268 yylpp = yylpsns + save->lexeme; 2269 #endif 2270 yylexp = yylexemes + save->lexeme; 2271 yychar = YYEMPTY; 2272 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); 2273 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT)); 2274 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); 2275 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); 2276 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2277 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); 2278 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); 2279 #endif 2280 ctry = ++save->ctry; 2281 yystate = save->state; 2282 /* We tried shift, try reduce now */ 2283 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce; 2284 yyps->save = save->save; 2285 save->save = NULL; 2286 yyFreeState(save); 2287 2288 /* Nothing left on the stack -- error */ 2289 if (!yyps->save) 2290 { 2291 #if YYDEBUG 2292 if (yydebug) 2293 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n", 2294 YYPREFIX, yydepth); 2295 #endif 2296 /* Restore state as it was in the most forward-advanced error */ 2297 yylvp = yylvals + yyerrctx->lexeme; 2298 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2299 yylpp = yylpsns + yyerrctx->lexeme; 2300 #endif 2301 yylexp = yylexemes + yyerrctx->lexeme; 2302 yychar = yylexp[-1]; 2303 yylval = yylvp[-1]; 2304 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2305 yylloc = yylpp[-1]; 2306 #endif 2307 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); 2308 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT)); 2309 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); 2310 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); 2311 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2312 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); 2313 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); 2314 #endif 2315 yystate = yyerrctx->state; 2316 yyFreeState(yyerrctx); 2317 yyerrctx = NULL; 2318 } 2319 yynewerrflag = 1; 2320 } 2321 if (yynewerrflag == 0) goto yyinrecovery; 2322 #endif /* YYBTYACC */ 2323 2324 YYERROR_CALL("syntax error"); 2325 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2326 yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */ 2327 #endif 2328 2329 #if !YYBTYACC 2330 goto yyerrlab; /* redundant goto avoids 'unused label' warning */ 2331 yyerrlab: 2332 #endif 2333 ++yynerrs; 2334 2335 yyinrecovery: 2336 if (yyerrflag < 3) 2337 { 2338 yyerrflag = 3; 2339 for (;;) 2340 { 2341 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && 2342 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) 2343 { 2344 #if YYDEBUG 2345 if (yydebug) 2346 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n", 2347 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]); 2348 #endif 2349 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 2350 yystate = yytable[yyn]; 2351 *++yystack.s_mark = yytable[yyn]; 2352 *++yystack.l_mark = yylval; 2353 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2354 /* lookahead position is error end position */ 2355 yyerror_loc_range[2] = yylloc; 2356 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */ 2357 *++yystack.p_mark = yyloc; 2358 #endif 2359 goto yyloop; 2360 } 2361 else 2362 { 2363 #if YYDEBUG 2364 if (yydebug) 2365 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n", 2366 YYDEBUGSTR, yydepth, *yystack.s_mark); 2367 #endif 2368 if (yystack.s_mark <= yystack.s_base) goto yyabort; 2369 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2370 /* the current TOS position is the error start position */ 2371 yyerror_loc_range[1] = *yystack.p_mark; 2372 #endif 2373 #if defined(YYDESTRUCT_CALL) 2374 #if YYBTYACC 2375 if (!yytrial) 2376 #endif /* YYBTYACC */ 2377 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2378 YYDESTRUCT_CALL("error: discarding state", 2379 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark); 2380 #else 2381 YYDESTRUCT_CALL("error: discarding state", 2382 yystos[*yystack.s_mark], yystack.l_mark); 2383 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ 2384 #endif /* defined(YYDESTRUCT_CALL) */ 2385 --yystack.s_mark; 2386 --yystack.l_mark; 2387 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2388 --yystack.p_mark; 2389 #endif 2390 } 2391 } 2392 } 2393 else 2394 { 2395 if (yychar == YYEOF) goto yyabort; 2396 #if YYDEBUG 2397 if (yydebug) 2398 { 2399 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 2400 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n", 2401 YYDEBUGSTR, yydepth, yystate, yychar, yys); 2402 } 2403 #endif 2404 #if defined(YYDESTRUCT_CALL) 2405 #if YYBTYACC 2406 if (!yytrial) 2407 #endif /* YYBTYACC */ 2408 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2409 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc); 2410 #else 2411 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval); 2412 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ 2413 #endif /* defined(YYDESTRUCT_CALL) */ 2414 yychar = YYEMPTY; 2415 goto yyloop; 2416 } 2417 2418 yyreduce: 2419 yym = yylen[yyn]; 2420 #if YYDEBUG 2421 if (yydebug) 2422 { 2423 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)", 2424 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]); 2425 #ifdef YYSTYPE_TOSTRING 2426 #if YYBTYACC 2427 if (!yytrial) 2428 #endif /* YYBTYACC */ 2429 if (yym > 0) 2430 { 2431 int i; 2432 fputc('<', stderr); 2433 for (i = yym; i > 0; i--) 2434 { 2435 if (i != yym) fputs(", ", stderr); 2436 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]], 2437 yystack.l_mark[1-i]), stderr); 2438 } 2439 fputc('>', stderr); 2440 } 2441 #endif 2442 fputc('\n', stderr); 2443 } 2444 #endif 2445 if (yym > 0) 2446 yyval = yystack.l_mark[1-yym]; 2447 else 2448 memset(&yyval, 0, sizeof yyval); 2449 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2450 2451 /* Perform position reduction */ 2452 memset(&yyloc, 0, sizeof(yyloc)); 2453 #if YYBTYACC 2454 if (!yytrial) 2455 #endif /* YYBTYACC */ 2456 { 2457 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym); 2458 /* just in case YYERROR is invoked within the action, save 2459 the start of the rhs as the error start position */ 2460 yyerror_loc_range[1] = yystack.p_mark[1-yym]; 2461 } 2462 #endif 2463 2464 switch (yyn) 2465 { 2466 case 1: 2467 #line 64 "expr.oxout.y" 2468 {yyyYoxInit();} 2469 #line 2470 "expr.oxout.tab.c" 2470 break; 2471 case 2: 2472 #line 66 "expr.oxout.y" 2473 { 2474 yyyDecorate(); yyyExecuteRRsection(yystack.l_mark[0].yyyOxAttrbs.yyyOxStackItem->node); 2475 } 2476 #line 2477 "expr.oxout.tab.c" 2477 break; 2478 case 3: 2479 #line 73 "expr.oxout.y" 2480 {if(yyyYok){ 2481 yyyGenIntNode(1,1,0,&yyval.yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs); 2482 yyyAdjustINRC(1,1,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}} 2483 #line 2484 "expr.oxout.tab.c" 2484 break; 2485 case 4: 2486 #line 80 "expr.oxout.y" 2487 {if(yyyYok){ 2488 yyyGenIntNode(2,3,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs); 2489 yyyAdjustINRC(2,3,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}} 2490 #line 2491 "expr.oxout.tab.c" 2491 break; 2492 case 5: 2493 #line 87 "expr.oxout.y" 2494 {if(yyyYok){ 2495 yyyGenIntNode(3,3,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs); 2496 yyyAdjustINRC(3,3,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}} 2497 #line 2498 "expr.oxout.tab.c" 2498 break; 2499 case 6: 2500 #line 94 "expr.oxout.y" 2501 {if(yyyYok){ 2502 yyyGenIntNode(4,3,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs); 2503 yyyAdjustINRC(4,3,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}} 2504 #line 2505 "expr.oxout.tab.c" 2505 break; 2506 case 7: 2507 #line 101 "expr.oxout.y" 2508 {if(yyyYok){ 2509 yyyGenIntNode(5,3,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs); 2510 yyyAdjustINRC(5,3,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}} 2511 #line 2512 "expr.oxout.tab.c" 2512 break; 2513 case 8: 2514 #line 108 "expr.oxout.y" 2515 {if(yyyYok){ 2516 yyyGenIntNode(6,3,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs); 2517 yyyAdjustINRC(6,3,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}} 2518 #line 2519 "expr.oxout.tab.c" 2519 break; 2520 case 9: 2521 #line 114 "expr.oxout.y" 2522 {if(yyyYok){ 2523 yyyGenIntNode(7,1,0,&yyval.yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs); 2524 yyyAdjustINRC(7,1,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}} 2525 #line 2526 "expr.oxout.tab.c" 2526 break; 2527 case 10: 2528 #line 121 "expr.oxout.y" 2529 {if(yyyYok){ 2530 yyyGenIntNode(8,1,0,&yyval.yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs); 2531 yyyAdjustINRC(8,1,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}} 2532 #line 2533 "expr.oxout.tab.c" 2533 break; 2534 #line 2535 "expr.oxout.tab.c" 2535 default: 2536 break; 2537 } 2538 yystack.s_mark -= yym; 2539 yystate = *yystack.s_mark; 2540 yystack.l_mark -= yym; 2541 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2542 yystack.p_mark -= yym; 2543 #endif 2544 yym = yylhs[yyn]; 2545 if (yystate == 0 && yym == 0) 2546 { 2547 #if YYDEBUG 2548 if (yydebug) 2549 { 2550 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth); 2551 #ifdef YYSTYPE_TOSTRING 2552 #if YYBTYACC 2553 if (!yytrial) 2554 #endif /* YYBTYACC */ 2555 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval)); 2556 #endif 2557 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL); 2558 } 2559 #endif 2560 yystate = YYFINAL; 2561 *++yystack.s_mark = YYFINAL; 2562 *++yystack.l_mark = yyval; 2563 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2564 *++yystack.p_mark = yyloc; 2565 #endif 2566 if (yychar < 0) 2567 { 2568 #if YYBTYACC 2569 do { 2570 if (yylvp < yylve) 2571 { 2572 /* we're currently re-reading tokens */ 2573 yylval = *yylvp++; 2574 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2575 yylloc = *yylpp++; 2576 #endif 2577 yychar = *yylexp++; 2578 break; 2579 } 2580 if (yyps->save) 2581 { 2582 /* in trial mode; save scanner results for future parse attempts */ 2583 if (yylvp == yylvlim) 2584 { /* Enlarge lexical value queue */ 2585 size_t p = (size_t) (yylvp - yylvals); 2586 size_t s = (size_t) (yylvlim - yylvals); 2587 2588 s += YYLVQUEUEGROWTH; 2589 if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) 2590 goto yyenomem; 2591 if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) 2592 goto yyenomem; 2593 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2594 if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) 2595 goto yyenomem; 2596 #endif 2597 yylvp = yylve = yylvals + p; 2598 yylvlim = yylvals + s; 2599 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2600 yylpp = yylpe = yylpsns + p; 2601 yylplim = yylpsns + s; 2602 #endif 2603 yylexp = yylexemes + p; 2604 } 2605 *yylexp = (YYINT) YYLEX; 2606 *yylvp++ = yylval; 2607 yylve++; 2608 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2609 *yylpp++ = yylloc; 2610 yylpe++; 2611 #endif 2612 yychar = *yylexp++; 2613 break; 2614 } 2615 /* normal operation, no conflict encountered */ 2616 #endif /* YYBTYACC */ 2617 yychar = YYLEX; 2618 #if YYBTYACC 2619 } while (0); 2620 #endif /* YYBTYACC */ 2621 if (yychar < 0) yychar = YYEOF; 2622 #if YYDEBUG 2623 if (yydebug) 2624 { 2625 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 2626 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n", 2627 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys); 2628 } 2629 #endif 2630 } 2631 if (yychar == YYEOF) goto yyaccept; 2632 goto yyloop; 2633 } 2634 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && 2635 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) 2636 yystate = yytable[yyn]; 2637 else 2638 yystate = yydgoto[yym]; 2639 #if YYDEBUG 2640 if (yydebug) 2641 { 2642 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth); 2643 #ifdef YYSTYPE_TOSTRING 2644 #if YYBTYACC 2645 if (!yytrial) 2646 #endif /* YYBTYACC */ 2647 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval)); 2648 #endif 2649 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate); 2650 } 2651 #endif 2652 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 2653 *++yystack.s_mark = (YYINT) yystate; 2654 *++yystack.l_mark = yyval; 2655 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2656 *++yystack.p_mark = yyloc; 2657 #endif 2658 goto yyloop; 2659 #if YYBTYACC 2660 2661 /* Reduction declares that this path is valid. Set yypath and do a full parse */ 2662 yyvalid: 2663 if (yypath) YYABORT; 2664 while (yyps->save) 2665 { 2666 YYParseState *save = yyps->save; 2667 yyps->save = save->save; 2668 save->save = yypath; 2669 yypath = save; 2670 } 2671 #if YYDEBUG 2672 if (yydebug) 2673 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n", 2674 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme)); 2675 #endif 2676 if (yyerrctx) 2677 { 2678 yyFreeState(yyerrctx); 2679 yyerrctx = NULL; 2680 } 2681 yylvp = yylvals + yypath->lexeme; 2682 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2683 yylpp = yylpsns + yypath->lexeme; 2684 #endif 2685 yylexp = yylexemes + yypath->lexeme; 2686 yychar = YYEMPTY; 2687 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); 2688 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT)); 2689 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); 2690 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); 2691 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2692 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); 2693 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); 2694 #endif 2695 yystate = yypath->state; 2696 goto yyloop; 2697 #endif /* YYBTYACC */ 2698 2699 yyoverflow: 2700 YYERROR_CALL("yacc stack overflow"); 2701 #if YYBTYACC 2702 goto yyabort_nomem; 2703 yyenomem: 2704 YYERROR_CALL("memory exhausted"); 2705 yyabort_nomem: 2706 #endif /* YYBTYACC */ 2707 yyresult = 2; 2708 goto yyreturn; 2709 2710 yyabort: 2711 yyresult = 1; 2712 goto yyreturn; 2713 2714 yyaccept: 2715 #if YYBTYACC 2716 if (yyps->save) goto yyvalid; 2717 #endif /* YYBTYACC */ 2718 yyresult = 0; 2719 2720 yyreturn: 2721 #if defined(YYDESTRUCT_CALL) 2722 if (yychar != YYEOF && yychar != YYEMPTY) 2723 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2724 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc); 2725 #else 2726 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval); 2727 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ 2728 2729 { 2730 YYSTYPE *pv; 2731 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) 2732 YYLTYPE *pp; 2733 2734 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp) 2735 YYDESTRUCT_CALL("cleanup: discarding state", 2736 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp); 2737 #else 2738 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv) 2739 YYDESTRUCT_CALL("cleanup: discarding state", 2740 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv); 2741 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ 2742 } 2743 #endif /* defined(YYDESTRUCT_CALL) */ 2744 2745 #if YYBTYACC 2746 if (yyerrctx) 2747 { 2748 yyFreeState(yyerrctx); 2749 yyerrctx = NULL; 2750 } 2751 while (yyps) 2752 { 2753 YYParseState *save = yyps; 2754 yyps = save->save; 2755 save->save = NULL; 2756 yyFreeState(save); 2757 } 2758 while (yypath) 2759 { 2760 YYParseState *save = yypath; 2761 yypath = save->save; 2762 save->save = NULL; 2763 yyFreeState(save); 2764 } 2765 #endif /* YYBTYACC */ 2766 yyfreestack(&yystack); 2767 return (yyresult); 2768 } 2769