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