1 /* original parser id follows */ 2 /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ 3 /* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ 4 5 #define YYBYACC 1 6 #define YYMAJOR 1 7 #define YYMINOR 9 8 #define YYCHECK "yyyymmdd" 9 10 #define YYEMPTY (-1) 11 #define yyclearin (yychar = YYEMPTY) 12 #define yyerrok (yyerrflag = 0) 13 #define YYRECOVERING() (yyerrflag != 0) 14 #define YYENOMEM (-2) 15 #define YYEOF 0 16 17 /* %code "top" block start */ 18 #line 5 "calc_code_all.y" 19 /* CODE-TOP */ 20 /* %code "top" block end */ 21 #line 22 "calc_code_all.tab.c" 22 23 #ifndef yyparse 24 #define yyparse calc_code_all_parse 25 #endif /* yyparse */ 26 27 #ifndef yylex 28 #define yylex calc_code_all_lex 29 #endif /* yylex */ 30 31 #ifndef yyerror 32 #define yyerror calc_code_all_error 33 #endif /* yyerror */ 34 35 #ifndef yychar 36 #define yychar calc_code_all_char 37 #endif /* yychar */ 38 39 #ifndef yyval 40 #define yyval calc_code_all_val 41 #endif /* yyval */ 42 43 #ifndef yylval 44 #define yylval calc_code_all_lval 45 #endif /* yylval */ 46 47 #ifndef yydebug 48 #define yydebug calc_code_all_debug 49 #endif /* yydebug */ 50 51 #ifndef yynerrs 52 #define yynerrs calc_code_all_nerrs 53 #endif /* yynerrs */ 54 55 #ifndef yyerrflag 56 #define yyerrflag calc_code_all_errflag 57 #endif /* yyerrflag */ 58 59 #ifndef yylhs 60 #define yylhs calc_code_all_lhs 61 #endif /* yylhs */ 62 63 #ifndef yylen 64 #define yylen calc_code_all_len 65 #endif /* yylen */ 66 67 #ifndef yydefred 68 #define yydefred calc_code_all_defred 69 #endif /* yydefred */ 70 71 #ifndef yydgoto 72 #define yydgoto calc_code_all_dgoto 73 #endif /* yydgoto */ 74 75 #ifndef yysindex 76 #define yysindex calc_code_all_sindex 77 #endif /* yysindex */ 78 79 #ifndef yyrindex 80 #define yyrindex calc_code_all_rindex 81 #endif /* yyrindex */ 82 83 #ifndef yygindex 84 #define yygindex calc_code_all_gindex 85 #endif /* yygindex */ 86 87 #ifndef yytable 88 #define yytable calc_code_all_table 89 #endif /* yytable */ 90 91 #ifndef yycheck 92 #define yycheck calc_code_all_check 93 #endif /* yycheck */ 94 95 #ifndef yyname 96 #define yyname calc_code_all_name 97 #endif /* yyname */ 98 99 #ifndef yyrule 100 #define yyrule calc_code_all_rule 101 #endif /* yyrule */ 102 #define YYPREFIX "calc_code_all_" 103 104 #define YYPURE 0 105 106 #line 9 "calc_code_all.y" 107 # include <stdio.h> 108 # include <ctype.h> 109 110 int regs[26]; 111 int base; 112 113 extern int yylex(void); 114 static void yyerror(const char *s); 115 116 #line 117 "calc_code_all.tab.c" 117 118 #if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED) 119 /* Default: YYSTYPE is the semantic value type. */ 120 typedef int YYSTYPE; 121 # define YYSTYPE_IS_DECLARED 1 122 #endif 123 124 /* compatibility with bison */ 125 #ifdef YYPARSE_PARAM 126 /* compatibility with FreeBSD */ 127 # ifdef YYPARSE_PARAM_TYPE 128 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM) 129 # else 130 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM) 131 # endif 132 #else 133 # define YYPARSE_DECL() yyparse(void) 134 #endif 135 136 /* Parameters sent to lex. */ 137 #ifdef YYLEX_PARAM 138 # define YYLEX_DECL() yylex(void *YYLEX_PARAM) 139 # define YYLEX yylex(YYLEX_PARAM) 140 #else 141 # define YYLEX_DECL() yylex(void) 142 # define YYLEX yylex() 143 #endif 144 145 /* Parameters sent to yyerror. */ 146 #ifndef YYERROR_DECL 147 #define YYERROR_DECL() yyerror(const char *s) 148 #endif 149 #ifndef YYERROR_CALL 150 #define YYERROR_CALL(msg) yyerror(msg) 151 #endif 152 153 extern int YYPARSE_DECL(); 154 155 #define DIGIT 257 156 #define LETTER 258 157 #define UMINUS 259 158 #define YYERRCODE 256 159 typedef int YYINT; 160 static const YYINT calc_code_all_lhs[] = { -1, 161 0, 0, 0, 1, 1, 2, 2, 2, 2, 2, 162 2, 2, 2, 2, 2, 2, 3, 3, 163 }; 164 static const YYINT calc_code_all_len[] = { 2, 165 0, 3, 3, 1, 3, 3, 3, 3, 3, 3, 166 3, 3, 3, 2, 1, 1, 1, 2, 167 }; 168 static const YYINT calc_code_all_defred[] = { 1, 169 0, 0, 17, 0, 0, 0, 0, 0, 0, 3, 170 0, 15, 14, 0, 2, 0, 0, 0, 0, 0, 171 0, 0, 18, 0, 6, 0, 0, 0, 0, 9, 172 10, 11, 173 }; 174 static const YYINT calc_code_all_dgoto[] = { 1, 175 7, 8, 9, 176 }; 177 static const YYINT calc_code_all_sindex[] = { 0, 178 -40, -7, 0, -55, -38, -38, 1, -29, -247, 0, 179 -38, 0, 0, 22, 0, -38, -38, -38, -38, -38, 180 -38, -38, 0, -29, 0, 51, 60, -20, -20, 0, 181 0, 0, 182 }; 183 static const YYINT calc_code_all_rindex[] = { 0, 184 0, 0, 0, 2, 0, 0, 0, 9, -9, 0, 185 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 186 0, 0, 0, 10, 0, -6, 14, 5, 13, 0, 187 0, 0, 188 }; 189 static const YYINT calc_code_all_gindex[] = { 0, 190 0, 65, 0, 191 }; 192 #define YYTABLESIZE 220 193 static const YYINT calc_code_all_table[] = { 6, 194 16, 6, 10, 13, 5, 11, 5, 22, 17, 23, 195 15, 15, 20, 18, 7, 19, 22, 21, 4, 5, 196 0, 20, 8, 12, 0, 0, 21, 16, 16, 0, 197 0, 16, 16, 16, 13, 16, 0, 16, 15, 15, 198 0, 0, 7, 15, 15, 7, 15, 7, 15, 7, 199 8, 12, 0, 8, 12, 8, 0, 8, 22, 17, 200 0, 0, 25, 20, 18, 0, 19, 0, 21, 13, 201 14, 0, 0, 0, 0, 24, 0, 0, 0, 0, 202 26, 27, 28, 29, 30, 31, 32, 22, 17, 0, 203 0, 0, 20, 18, 16, 19, 22, 21, 0, 0, 204 0, 20, 18, 0, 19, 0, 21, 0, 0, 0, 205 0, 0, 0, 0, 16, 0, 0, 13, 0, 0, 206 0, 0, 0, 0, 0, 15, 0, 0, 7, 0, 207 0, 0, 0, 0, 0, 0, 8, 12, 0, 0, 208 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 209 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 210 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 211 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 212 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 213 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 214 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 215 0, 0, 0, 0, 0, 2, 3, 4, 3, 12, 216 }; 217 static const YYINT calc_code_all_check[] = { 40, 218 10, 40, 10, 10, 45, 61, 45, 37, 38, 257, 219 10, 10, 42, 43, 10, 45, 37, 47, 10, 10, 220 -1, 42, 10, 10, -1, -1, 47, 37, 38, -1, 221 -1, 41, 42, 43, 41, 45, -1, 47, 37, 38, 222 -1, -1, 38, 42, 43, 41, 45, 43, 47, 45, 223 38, 38, -1, 41, 41, 43, -1, 45, 37, 38, 224 -1, -1, 41, 42, 43, -1, 45, -1, 47, 5, 225 6, -1, -1, -1, -1, 11, -1, -1, -1, -1, 226 16, 17, 18, 19, 20, 21, 22, 37, 38, -1, 227 -1, -1, 42, 43, 124, 45, 37, 47, -1, -1, 228 -1, 42, 43, -1, 45, -1, 47, -1, -1, -1, 229 -1, -1, -1, -1, 124, -1, -1, 124, -1, -1, 230 -1, -1, -1, -1, -1, 124, -1, -1, 124, -1, 231 -1, -1, -1, -1, -1, -1, 124, 124, -1, -1, 232 -1, -1, -1, -1, -1, 124, -1, -1, -1, -1, 233 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 234 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 235 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 236 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 237 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 238 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 239 -1, -1, -1, -1, -1, 256, 257, 258, 257, 258, 240 }; 241 #define YYFINAL 1 242 #ifndef YYDEBUG 243 #define YYDEBUG 0 244 #endif 245 #define YYMAXTOKEN 259 246 #define YYUNDFTOKEN 265 247 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a)) 248 #if YYDEBUG 249 static const char *const calc_code_all_name[] = { 250 251 "end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 252 0,0,0,0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0, 253 0,0,0,0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 254 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0, 255 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 256 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 257 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 258 0,0,0,0,0,0,"DIGIT","LETTER","UMINUS",0,0,0,0,0,"illegal-symbol", 259 }; 260 static const char *const calc_code_all_rule[] = { 261 "$accept : list", 262 "list :", 263 "list : list stat '\\n'", 264 "list : list error '\\n'", 265 "stat : expr", 266 "stat : LETTER '=' expr", 267 "expr : '(' expr ')'", 268 "expr : expr '+' expr", 269 "expr : expr '-' expr", 270 "expr : expr '*' expr", 271 "expr : expr '/' expr", 272 "expr : expr '%' expr", 273 "expr : expr '&' expr", 274 "expr : expr '|' expr", 275 "expr : '-' expr", 276 "expr : LETTER", 277 "expr : number", 278 "number : DIGIT", 279 "number : number DIGIT", 280 281 }; 282 #endif 283 284 #if YYDEBUG 285 int yydebug; 286 #endif 287 288 int yyerrflag; 289 int yychar; 290 YYSTYPE yyval; 291 YYSTYPE yylval; 292 int yynerrs; 293 294 /* %code "requires" block start */ 295 #line 3 "calc_code_all.y" 296 /* CODE-REQUIRES */ 297 /* %code "requires" block end */ 298 #line 299 "calc_code_all.tab.c" 299 300 /* define the initial stack-sizes */ 301 #ifdef YYSTACKSIZE 302 #undef YYMAXDEPTH 303 #define YYMAXDEPTH YYSTACKSIZE 304 #else 305 #ifdef YYMAXDEPTH 306 #define YYSTACKSIZE YYMAXDEPTH 307 #else 308 #define YYSTACKSIZE 10000 309 #define YYMAXDEPTH 10000 310 #endif 311 #endif 312 313 #define YYINITSTACKSIZE 200 314 315 typedef struct { 316 unsigned stacksize; 317 YYINT *s_base; 318 YYINT *s_mark; 319 YYINT *s_last; 320 YYSTYPE *l_base; 321 YYSTYPE *l_mark; 322 } YYSTACKDATA; 323 /* variables for the parser stack */ 324 static YYSTACKDATA yystack; 325 326 /* %code "provides" block start */ 327 #line 4 "calc_code_all.y" 328 /* CODE-PROVIDES */ 329 #line 6 "calc_code_all.y" 330 /* CODE-PROVIDES2 */ 331 /* %code "provides" block end */ 332 #line 333 "calc_code_all.tab.c" 333 334 /* %code "" block start */ 335 #line 1 "calc_code_all.y" 336 /* CODE-DEFAULT2 */ 337 #line 2 "calc_code_all.y" 338 /* CODE-DEFAULT */ 339 /* %code "" block end */ 340 #line 341 "calc_code_all.tab.c" 341 #line 73 "calc_code_all.y" 342 /* start of programs */ 343 344 int 345 main (void) 346 { 347 while(!feof(stdin)) { 348 yyparse(); 349 } 350 return 0; 351 } 352 353 static void 354 yyerror(const char *s) 355 { 356 fprintf(stderr, "%s\n", s); 357 } 358 359 int 360 yylex(void) 361 { 362 /* lexical analysis routine */ 363 /* returns LETTER for a lower case letter, yylval = 0 through 25 */ 364 /* return DIGIT for a digit, yylval = 0 through 9 */ 365 /* all other characters are returned immediately */ 366 367 int c; 368 369 while( (c=getchar()) == ' ' ) { /* skip blanks */ } 370 371 /* c is now nonblank */ 372 373 if( islower( c )) { 374 yylval = c - 'a'; 375 return ( LETTER ); 376 } 377 if( isdigit( c )) { 378 yylval = c - '0'; 379 return ( DIGIT ); 380 } 381 return( c ); 382 } 383 #line 384 "calc_code_all.tab.c" 384 385 #if YYDEBUG 386 #include <stdio.h> /* needed for printf */ 387 #endif 388 389 #include <stdlib.h> /* needed for malloc, etc */ 390 #include <string.h> /* needed for memset */ 391 392 /* allocate initial stack or double stack size, up to YYMAXDEPTH */ 393 static int yygrowstack(YYSTACKDATA *data) 394 { 395 int i; 396 unsigned newsize; 397 YYINT *newss; 398 YYSTYPE *newvs; 399 400 if ((newsize = data->stacksize) == 0) 401 newsize = YYINITSTACKSIZE; 402 else if (newsize >= YYMAXDEPTH) 403 return YYENOMEM; 404 else if ((newsize *= 2) > YYMAXDEPTH) 405 newsize = YYMAXDEPTH; 406 407 i = (int) (data->s_mark - data->s_base); 408 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss)); 409 if (newss == 0) 410 return YYENOMEM; 411 412 data->s_base = newss; 413 data->s_mark = newss + i; 414 415 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)); 416 if (newvs == 0) 417 return YYENOMEM; 418 419 data->l_base = newvs; 420 data->l_mark = newvs + i; 421 422 data->stacksize = newsize; 423 data->s_last = data->s_base + newsize - 1; 424 return 0; 425 } 426 427 #if YYPURE || defined(YY_NO_LEAKS) 428 static void yyfreestack(YYSTACKDATA *data) 429 { 430 free(data->s_base); 431 free(data->l_base); 432 memset(data, 0, sizeof(*data)); 433 } 434 #else 435 #define yyfreestack(data) /* nothing */ 436 #endif 437 438 #define YYABORT goto yyabort 439 #define YYREJECT goto yyabort 440 #define YYACCEPT goto yyaccept 441 #define YYERROR goto yyerrlab 442 443 int 444 YYPARSE_DECL() 445 { 446 int yym, yyn, yystate; 447 #if YYDEBUG 448 const char *yys; 449 450 if ((yys = getenv("YYDEBUG")) != 0) 451 { 452 yyn = *yys; 453 if (yyn >= '0' && yyn <= '9') 454 yydebug = yyn - '0'; 455 } 456 #endif 457 458 yym = 0; 459 yyn = 0; 460 yynerrs = 0; 461 yyerrflag = 0; 462 yychar = YYEMPTY; 463 yystate = 0; 464 465 #if YYPURE 466 memset(&yystack, 0, sizeof(yystack)); 467 #endif 468 469 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 470 yystack.s_mark = yystack.s_base; 471 yystack.l_mark = yystack.l_base; 472 yystate = 0; 473 *yystack.s_mark = 0; 474 475 yyloop: 476 if ((yyn = yydefred[yystate]) != 0) goto yyreduce; 477 if (yychar < 0) 478 { 479 yychar = YYLEX; 480 if (yychar < 0) yychar = YYEOF; 481 #if YYDEBUG 482 if (yydebug) 483 { 484 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 485 printf("%sdebug: state %d, reading %d (%s)\n", 486 YYPREFIX, yystate, yychar, yys); 487 } 488 #endif 489 } 490 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && 491 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) 492 { 493 #if YYDEBUG 494 if (yydebug) 495 printf("%sdebug: state %d, shifting to state %d\n", 496 YYPREFIX, yystate, yytable[yyn]); 497 #endif 498 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 499 yystate = yytable[yyn]; 500 *++yystack.s_mark = yytable[yyn]; 501 *++yystack.l_mark = yylval; 502 yychar = YYEMPTY; 503 if (yyerrflag > 0) --yyerrflag; 504 goto yyloop; 505 } 506 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && 507 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) 508 { 509 yyn = yytable[yyn]; 510 goto yyreduce; 511 } 512 if (yyerrflag != 0) goto yyinrecovery; 513 514 YYERROR_CALL("syntax error"); 515 516 goto yyerrlab; /* redundant goto avoids 'unused label' warning */ 517 yyerrlab: 518 ++yynerrs; 519 520 yyinrecovery: 521 if (yyerrflag < 3) 522 { 523 yyerrflag = 3; 524 for (;;) 525 { 526 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && 527 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) 528 { 529 #if YYDEBUG 530 if (yydebug) 531 printf("%sdebug: state %d, error recovery shifting\ 532 to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); 533 #endif 534 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 535 yystate = yytable[yyn]; 536 *++yystack.s_mark = yytable[yyn]; 537 *++yystack.l_mark = yylval; 538 goto yyloop; 539 } 540 else 541 { 542 #if YYDEBUG 543 if (yydebug) 544 printf("%sdebug: error recovery discarding state %d\n", 545 YYPREFIX, *yystack.s_mark); 546 #endif 547 if (yystack.s_mark <= yystack.s_base) goto yyabort; 548 --yystack.s_mark; 549 --yystack.l_mark; 550 } 551 } 552 } 553 else 554 { 555 if (yychar == YYEOF) goto yyabort; 556 #if YYDEBUG 557 if (yydebug) 558 { 559 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 560 printf("%sdebug: state %d, error recovery discards token %d (%s)\n", 561 YYPREFIX, yystate, yychar, yys); 562 } 563 #endif 564 yychar = YYEMPTY; 565 goto yyloop; 566 } 567 568 yyreduce: 569 #if YYDEBUG 570 if (yydebug) 571 printf("%sdebug: state %d, reducing by rule %d (%s)\n", 572 YYPREFIX, yystate, yyn, yyrule[yyn]); 573 #endif 574 yym = yylen[yyn]; 575 if (yym > 0) 576 yyval = yystack.l_mark[1-yym]; 577 else 578 memset(&yyval, 0, sizeof yyval); 579 580 switch (yyn) 581 { 582 case 3: 583 #line 35 "calc_code_all.y" 584 { yyerrok ; } 585 break; 586 case 4: 587 #line 39 "calc_code_all.y" 588 { printf("%d\n",yystack.l_mark[0]);} 589 break; 590 case 5: 591 #line 41 "calc_code_all.y" 592 { regs[yystack.l_mark[-2]] = yystack.l_mark[0]; } 593 break; 594 case 6: 595 #line 45 "calc_code_all.y" 596 { yyval = yystack.l_mark[-1]; } 597 break; 598 case 7: 599 #line 47 "calc_code_all.y" 600 { yyval = yystack.l_mark[-2] + yystack.l_mark[0]; } 601 break; 602 case 8: 603 #line 49 "calc_code_all.y" 604 { yyval = yystack.l_mark[-2] - yystack.l_mark[0]; } 605 break; 606 case 9: 607 #line 51 "calc_code_all.y" 608 { yyval = yystack.l_mark[-2] * yystack.l_mark[0]; } 609 break; 610 case 10: 611 #line 53 "calc_code_all.y" 612 { yyval = yystack.l_mark[-2] / yystack.l_mark[0]; } 613 break; 614 case 11: 615 #line 55 "calc_code_all.y" 616 { yyval = yystack.l_mark[-2] % yystack.l_mark[0]; } 617 break; 618 case 12: 619 #line 57 "calc_code_all.y" 620 { yyval = yystack.l_mark[-2] & yystack.l_mark[0]; } 621 break; 622 case 13: 623 #line 59 "calc_code_all.y" 624 { yyval = yystack.l_mark[-2] | yystack.l_mark[0]; } 625 break; 626 case 14: 627 #line 61 "calc_code_all.y" 628 { yyval = - yystack.l_mark[0]; } 629 break; 630 case 15: 631 #line 63 "calc_code_all.y" 632 { yyval = regs[yystack.l_mark[0]]; } 633 break; 634 case 17: 635 #line 68 "calc_code_all.y" 636 { yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; } 637 break; 638 case 18: 639 #line 70 "calc_code_all.y" 640 { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } 641 break; 642 #line 643 "calc_code_all.tab.c" 643 } 644 yystack.s_mark -= yym; 645 yystate = *yystack.s_mark; 646 yystack.l_mark -= yym; 647 yym = yylhs[yyn]; 648 if (yystate == 0 && yym == 0) 649 { 650 #if YYDEBUG 651 if (yydebug) 652 printf("%sdebug: after reduction, shifting from state 0 to\ 653 state %d\n", YYPREFIX, YYFINAL); 654 #endif 655 yystate = YYFINAL; 656 *++yystack.s_mark = YYFINAL; 657 *++yystack.l_mark = yyval; 658 if (yychar < 0) 659 { 660 yychar = YYLEX; 661 if (yychar < 0) yychar = YYEOF; 662 #if YYDEBUG 663 if (yydebug) 664 { 665 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 666 printf("%sdebug: state %d, reading %d (%s)\n", 667 YYPREFIX, YYFINAL, yychar, yys); 668 } 669 #endif 670 } 671 if (yychar == YYEOF) goto yyaccept; 672 goto yyloop; 673 } 674 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && 675 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) 676 yystate = yytable[yyn]; 677 else 678 yystate = yydgoto[yym]; 679 #if YYDEBUG 680 if (yydebug) 681 printf("%sdebug: after reduction, shifting from state %d \ 682 to state %d\n", YYPREFIX, *yystack.s_mark, yystate); 683 #endif 684 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 685 *++yystack.s_mark = (YYINT) yystate; 686 *++yystack.l_mark = yyval; 687 goto yyloop; 688 689 yyoverflow: 690 YYERROR_CALL("yacc stack overflow"); 691 692 yyabort: 693 yyfreestack(&yystack); 694 return (1); 695 696 yyaccept: 697 yyfreestack(&yystack); 698 return (0); 699 } 700