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