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 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-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_calc2_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_calc2_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_calc2_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_calc2_dgoto[] = { 1, 175 7, 8, 9, 176 }; 177 static const YYINT quote_calc2_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_calc2_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_calc2_gindex[] = { 0, 190 0, 42, 0, 191 }; 192 #define YYTABLESIZE 259 193 static const YYINT quote_calc2_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_calc2_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_calc2_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\"","OP_SUB","\"SUB\"","OP_MUL","\"MUL\"","OP_DIV", 267 "\"DIV\"","OP_MOD","\"MOD\"","OP_AND","\"AND\"","DIGIT","LETTER","UMINUS",0,0,0, 268 0,0,"illegal-symbol", 269 }; 270 static const char *const quote_calc2_rule[] = { 271 "$accept : list", 272 "list :", 273 "list : list stat '\\n'", 274 "list : list error '\\n'", 275 "stat : expr", 276 "stat : LETTER '=' expr", 277 "expr : '(' expr ')'", 278 "expr : expr \"ADD\" expr", 279 "expr : expr \"SUB\" expr", 280 "expr : expr \"MUL\" expr", 281 "expr : expr \"DIV\" expr", 282 "expr : expr \"MOD\" expr", 283 "expr : expr \"AND\" expr", 284 "expr : expr '|' expr", 285 "expr : \"SUB\" expr", 286 "expr : LETTER", 287 "expr : number", 288 "number : DIGIT", 289 "number : number DIGIT", 290 291 }; 292 #endif 293 294 #if YYDEBUG 295 int yydebug; 296 #endif 297 298 int yyerrflag; 299 int yychar; 300 YYSTYPE yyval; 301 YYSTYPE yylval; 302 int yynerrs; 303 304 /* define the initial stack-sizes */ 305 #ifdef YYSTACKSIZE 306 #undef YYMAXDEPTH 307 #define YYMAXDEPTH YYSTACKSIZE 308 #else 309 #ifdef YYMAXDEPTH 310 #define YYSTACKSIZE YYMAXDEPTH 311 #else 312 #define YYSTACKSIZE 10000 313 #define YYMAXDEPTH 10000 314 #endif 315 #endif 316 317 #define YYINITSTACKSIZE 200 318 319 typedef struct { 320 unsigned stacksize; 321 YYINT *s_base; 322 YYINT *s_mark; 323 YYINT *s_last; 324 YYSTYPE *l_base; 325 YYSTYPE *l_mark; 326 } YYSTACKDATA; 327 /* variables for the parser stack */ 328 static YYSTACKDATA yystack; 329 #line 73 "quote_calc2.y" 330 /* start of programs */ 331 332 int 333 main (void) 334 { 335 while(!feof(stdin)) { 336 yyparse(); 337 } 338 return 0; 339 } 340 341 static void 342 yyerror(const char *s) 343 { 344 fprintf(stderr, "%s\n", s); 345 } 346 347 int 348 yylex(void) { 349 /* lexical analysis routine */ 350 /* returns LETTER for a lower case letter, yylval = 0 through 25 */ 351 /* return DIGIT for a digit, yylval = 0 through 9 */ 352 /* all other characters are returned immediately */ 353 354 int c; 355 356 while( (c=getchar()) == ' ' ) { /* skip blanks */ } 357 358 /* c is now nonblank */ 359 360 if( islower( c )) { 361 yylval = c - 'a'; 362 return ( LETTER ); 363 } 364 if( isdigit( c )) { 365 yylval = c - '0'; 366 return ( DIGIT ); 367 } 368 return( c ); 369 } 370 #line 371 "quote_calc2-s.tab.c" 371 372 #if YYDEBUG 373 #include <stdio.h> /* needed for printf */ 374 #endif 375 376 #include <stdlib.h> /* needed for malloc, etc */ 377 #include <string.h> /* needed for memset */ 378 379 /* allocate initial stack or double stack size, up to YYMAXDEPTH */ 380 static int yygrowstack(YYSTACKDATA *data) 381 { 382 int i; 383 unsigned newsize; 384 YYINT *newss; 385 YYSTYPE *newvs; 386 387 if ((newsize = data->stacksize) == 0) 388 newsize = YYINITSTACKSIZE; 389 else if (newsize >= YYMAXDEPTH) 390 return YYENOMEM; 391 else if ((newsize *= 2) > YYMAXDEPTH) 392 newsize = YYMAXDEPTH; 393 394 i = (int) (data->s_mark - data->s_base); 395 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss)); 396 if (newss == NULL) 397 return YYENOMEM; 398 399 data->s_base = newss; 400 data->s_mark = newss + i; 401 402 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)); 403 if (newvs == NULL) 404 return YYENOMEM; 405 406 data->l_base = newvs; 407 data->l_mark = newvs + i; 408 409 data->stacksize = newsize; 410 data->s_last = data->s_base + newsize - 1; 411 return 0; 412 } 413 414 #if YYPURE || defined(YY_NO_LEAKS) 415 static void yyfreestack(YYSTACKDATA *data) 416 { 417 free(data->s_base); 418 free(data->l_base); 419 memset(data, 0, sizeof(*data)); 420 } 421 #else 422 #define yyfreestack(data) /* nothing */ 423 #endif 424 425 #define YYABORT goto yyabort 426 #define YYREJECT goto yyabort 427 #define YYACCEPT goto yyaccept 428 #define YYERROR goto yyerrlab 429 430 int 431 YYPARSE_DECL() 432 { 433 int yym, yyn, yystate; 434 #if YYDEBUG 435 const char *yys; 436 437 if ((yys = getenv("YYDEBUG")) != NULL) 438 { 439 yyn = *yys; 440 if (yyn >= '0' && yyn <= '9') 441 yydebug = yyn - '0'; 442 } 443 #endif 444 445 /* yym is set below */ 446 /* yyn is set below */ 447 yynerrs = 0; 448 yyerrflag = 0; 449 yychar = YYEMPTY; 450 yystate = 0; 451 452 #if YYPURE 453 memset(&yystack, 0, sizeof(yystack)); 454 #endif 455 456 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 457 yystack.s_mark = yystack.s_base; 458 yystack.l_mark = yystack.l_base; 459 yystate = 0; 460 *yystack.s_mark = 0; 461 462 yyloop: 463 if ((yyn = yydefred[yystate]) != 0) goto yyreduce; 464 if (yychar < 0) 465 { 466 yychar = YYLEX; 467 if (yychar < 0) yychar = YYEOF; 468 #if YYDEBUG 469 if (yydebug) 470 { 471 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 472 printf("%sdebug: state %d, reading %d (%s)\n", 473 YYPREFIX, yystate, yychar, yys); 474 } 475 #endif 476 } 477 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && 478 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) 479 { 480 #if YYDEBUG 481 if (yydebug) 482 printf("%sdebug: state %d, shifting to state %d\n", 483 YYPREFIX, yystate, yytable[yyn]); 484 #endif 485 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 486 yystate = yytable[yyn]; 487 *++yystack.s_mark = yytable[yyn]; 488 *++yystack.l_mark = yylval; 489 yychar = YYEMPTY; 490 if (yyerrflag > 0) --yyerrflag; 491 goto yyloop; 492 } 493 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && 494 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) 495 { 496 yyn = yytable[yyn]; 497 goto yyreduce; 498 } 499 if (yyerrflag != 0) goto yyinrecovery; 500 501 YYERROR_CALL("syntax error"); 502 503 goto yyerrlab; /* redundant goto avoids 'unused label' warning */ 504 yyerrlab: 505 ++yynerrs; 506 507 yyinrecovery: 508 if (yyerrflag < 3) 509 { 510 yyerrflag = 3; 511 for (;;) 512 { 513 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && 514 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) 515 { 516 #if YYDEBUG 517 if (yydebug) 518 printf("%sdebug: state %d, error recovery shifting\ 519 to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); 520 #endif 521 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 522 yystate = yytable[yyn]; 523 *++yystack.s_mark = yytable[yyn]; 524 *++yystack.l_mark = yylval; 525 goto yyloop; 526 } 527 else 528 { 529 #if YYDEBUG 530 if (yydebug) 531 printf("%sdebug: error recovery discarding state %d\n", 532 YYPREFIX, *yystack.s_mark); 533 #endif 534 if (yystack.s_mark <= yystack.s_base) goto yyabort; 535 --yystack.s_mark; 536 --yystack.l_mark; 537 } 538 } 539 } 540 else 541 { 542 if (yychar == YYEOF) goto yyabort; 543 #if YYDEBUG 544 if (yydebug) 545 { 546 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 547 printf("%sdebug: state %d, error recovery discards token %d (%s)\n", 548 YYPREFIX, yystate, yychar, yys); 549 } 550 #endif 551 yychar = YYEMPTY; 552 goto yyloop; 553 } 554 555 yyreduce: 556 #if YYDEBUG 557 if (yydebug) 558 printf("%sdebug: state %d, reducing by rule %d (%s)\n", 559 YYPREFIX, yystate, yyn, yyrule[yyn]); 560 #endif 561 yym = yylen[yyn]; 562 if (yym > 0) 563 yyval = yystack.l_mark[1-yym]; 564 else 565 memset(&yyval, 0, sizeof yyval); 566 567 switch (yyn) 568 { 569 case 3: 570 #line 35 "quote_calc2.y" 571 { yyerrok ; } 572 #line 573 "quote_calc2-s.tab.c" 573 break; 574 case 4: 575 #line 39 "quote_calc2.y" 576 { printf("%d\n",yystack.l_mark[0]);} 577 #line 578 "quote_calc2-s.tab.c" 578 break; 579 case 5: 580 #line 41 "quote_calc2.y" 581 { regs[yystack.l_mark[-2]] = yystack.l_mark[0]; } 582 #line 583 "quote_calc2-s.tab.c" 583 break; 584 case 6: 585 #line 45 "quote_calc2.y" 586 { yyval = yystack.l_mark[-1]; } 587 #line 588 "quote_calc2-s.tab.c" 588 break; 589 case 7: 590 #line 47 "quote_calc2.y" 591 { yyval = yystack.l_mark[-2] + yystack.l_mark[0]; } 592 #line 593 "quote_calc2-s.tab.c" 593 break; 594 case 8: 595 #line 49 "quote_calc2.y" 596 { yyval = yystack.l_mark[-2] - yystack.l_mark[0]; } 597 #line 598 "quote_calc2-s.tab.c" 598 break; 599 case 9: 600 #line 51 "quote_calc2.y" 601 { yyval = yystack.l_mark[-2] * yystack.l_mark[0]; } 602 #line 603 "quote_calc2-s.tab.c" 603 break; 604 case 10: 605 #line 53 "quote_calc2.y" 606 { yyval = yystack.l_mark[-2] / yystack.l_mark[0]; } 607 #line 608 "quote_calc2-s.tab.c" 608 break; 609 case 11: 610 #line 55 "quote_calc2.y" 611 { yyval = yystack.l_mark[-2] % yystack.l_mark[0]; } 612 #line 613 "quote_calc2-s.tab.c" 613 break; 614 case 12: 615 #line 57 "quote_calc2.y" 616 { yyval = yystack.l_mark[-2] & yystack.l_mark[0]; } 617 #line 618 "quote_calc2-s.tab.c" 618 break; 619 case 13: 620 #line 59 "quote_calc2.y" 621 { yyval = yystack.l_mark[-2] | yystack.l_mark[0]; } 622 #line 623 "quote_calc2-s.tab.c" 623 break; 624 case 14: 625 #line 61 "quote_calc2.y" 626 { yyval = - yystack.l_mark[0]; } 627 #line 628 "quote_calc2-s.tab.c" 628 break; 629 case 15: 630 #line 63 "quote_calc2.y" 631 { yyval = regs[yystack.l_mark[0]]; } 632 #line 633 "quote_calc2-s.tab.c" 633 break; 634 case 17: 635 #line 68 "quote_calc2.y" 636 { yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; } 637 #line 638 "quote_calc2-s.tab.c" 638 break; 639 case 18: 640 #line 70 "quote_calc2.y" 641 { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } 642 #line 643 "quote_calc2-s.tab.c" 643 break; 644 #line 645 "quote_calc2-s.tab.c" 645 } 646 yystack.s_mark -= yym; 647 yystate = *yystack.s_mark; 648 yystack.l_mark -= yym; 649 yym = yylhs[yyn]; 650 if (yystate == 0 && yym == 0) 651 { 652 #if YYDEBUG 653 if (yydebug) 654 printf("%sdebug: after reduction, shifting from state 0 to\ 655 state %d\n", YYPREFIX, YYFINAL); 656 #endif 657 yystate = YYFINAL; 658 *++yystack.s_mark = YYFINAL; 659 *++yystack.l_mark = yyval; 660 if (yychar < 0) 661 { 662 yychar = YYLEX; 663 if (yychar < 0) yychar = YYEOF; 664 #if YYDEBUG 665 if (yydebug) 666 { 667 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 668 printf("%sdebug: state %d, reading %d (%s)\n", 669 YYPREFIX, YYFINAL, yychar, yys); 670 } 671 #endif 672 } 673 if (yychar == YYEOF) goto yyaccept; 674 goto yyloop; 675 } 676 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && 677 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) 678 yystate = yytable[yyn]; 679 else 680 yystate = yydgoto[yym]; 681 #if YYDEBUG 682 if (yydebug) 683 printf("%sdebug: after reduction, shifting from state %d \ 684 to state %d\n", YYPREFIX, *yystack.s_mark, yystate); 685 #endif 686 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 687 *++yystack.s_mark = (YYINT) yystate; 688 *++yystack.l_mark = yyval; 689 goto yyloop; 690 691 yyoverflow: 692 YYERROR_CALL("yacc stack overflow"); 693 694 yyabort: 695 yyfreestack(&yystack); 696 return (1); 697 698 yyaccept: 699 yyfreestack(&yystack); 700 return (0); 701 } 702