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