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 memset(&yyval, 0, sizeof(yyval)); 471 memset(&yylval, 0, sizeof(yylval)); 472 473 yym = 0; 474 yyn = 0; 475 yynerrs = 0; 476 yyerrflag = 0; 477 yychar = YYEMPTY; 478 yystate = 0; 479 480 #if YYPURE 481 memset(&yystack, 0, sizeof(yystack)); 482 #endif 483 484 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 485 yystack.s_mark = yystack.s_base; 486 yystack.l_mark = yystack.l_base; 487 yystate = 0; 488 *yystack.s_mark = 0; 489 490 yyloop: 491 if ((yyn = yydefred[yystate]) != 0) goto yyreduce; 492 if (yychar < 0) 493 { 494 yychar = YYLEX; 495 if (yychar < 0) yychar = YYEOF; 496 #if YYDEBUG 497 if (yydebug) 498 { 499 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 500 printf("%sdebug: state %d, reading %d (%s)\n", 501 YYPREFIX, yystate, yychar, yys); 502 } 503 #endif 504 } 505 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && 506 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) 507 { 508 #if YYDEBUG 509 if (yydebug) 510 printf("%sdebug: state %d, shifting to state %d\n", 511 YYPREFIX, yystate, yytable[yyn]); 512 #endif 513 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 514 yystate = yytable[yyn]; 515 *++yystack.s_mark = yytable[yyn]; 516 *++yystack.l_mark = yylval; 517 yychar = YYEMPTY; 518 if (yyerrflag > 0) --yyerrflag; 519 goto yyloop; 520 } 521 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && 522 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) 523 { 524 yyn = yytable[yyn]; 525 goto yyreduce; 526 } 527 if (yyerrflag != 0) goto yyinrecovery; 528 529 YYERROR_CALL("syntax error"); 530 531 goto yyerrlab; /* redundant goto avoids 'unused label' warning */ 532 yyerrlab: 533 ++yynerrs; 534 535 yyinrecovery: 536 if (yyerrflag < 3) 537 { 538 yyerrflag = 3; 539 for (;;) 540 { 541 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && 542 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) 543 { 544 #if YYDEBUG 545 if (yydebug) 546 printf("%sdebug: state %d, error recovery shifting\ 547 to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); 548 #endif 549 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 550 yystate = yytable[yyn]; 551 *++yystack.s_mark = yytable[yyn]; 552 *++yystack.l_mark = yylval; 553 goto yyloop; 554 } 555 else 556 { 557 #if YYDEBUG 558 if (yydebug) 559 printf("%sdebug: error recovery discarding state %d\n", 560 YYPREFIX, *yystack.s_mark); 561 #endif 562 if (yystack.s_mark <= yystack.s_base) goto yyabort; 563 --yystack.s_mark; 564 --yystack.l_mark; 565 } 566 } 567 } 568 else 569 { 570 if (yychar == YYEOF) goto yyabort; 571 #if YYDEBUG 572 if (yydebug) 573 { 574 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 575 printf("%sdebug: state %d, error recovery discards token %d (%s)\n", 576 YYPREFIX, yystate, yychar, yys); 577 } 578 #endif 579 yychar = YYEMPTY; 580 goto yyloop; 581 } 582 583 yyreduce: 584 #if YYDEBUG 585 if (yydebug) 586 printf("%sdebug: state %d, reducing by rule %d (%s)\n", 587 YYPREFIX, yystate, yyn, yyrule[yyn]); 588 #endif 589 yym = yylen[yyn]; 590 if (yym > 0) 591 yyval = yystack.l_mark[1-yym]; 592 else 593 memset(&yyval, 0, sizeof yyval); 594 595 switch (yyn) 596 { 597 case 3: 598 #line 66 "ok_syntax1.y" 599 { yyerrok ; } 600 break; 601 case 4: 602 #line 70 "ok_syntax1.y" 603 { printf("%d\n",yystack.l_mark[0].ival);} 604 break; 605 case 5: 606 #line 72 "ok_syntax1.y" 607 { regs[yystack.l_mark[-2].ival] = yystack.l_mark[0].ival; } 608 break; 609 case 6: 610 #line 76 "ok_syntax1.y" 611 { yyval.ival = yystack.l_mark[-1].ival; } 612 break; 613 case 7: 614 #line 78 "ok_syntax1.y" 615 { yyval.ival = yystack.l_mark[-2].ival + yystack.l_mark[0].ival; } 616 break; 617 case 8: 618 #line 80 "ok_syntax1.y" 619 { yyval.ival = yystack.l_mark[-2].ival - yystack.l_mark[0].ival; } 620 break; 621 case 9: 622 #line 82 "ok_syntax1.y" 623 { yyval.ival = yystack.l_mark[-2].ival * yystack.l_mark[0].ival; } 624 break; 625 case 10: 626 #line 84 "ok_syntax1.y" 627 { yyval.ival = yystack.l_mark[-2].ival / yystack.l_mark[0].ival; } 628 break; 629 case 11: 630 #line 86 "ok_syntax1.y" 631 { yyval.ival = yystack.l_mark[-2].ival % yystack.l_mark[0].ival; } 632 break; 633 case 12: 634 #line 88 "ok_syntax1.y" 635 { yyval.ival = yystack.l_mark[-2].ival & yystack.l_mark[0].ival; } 636 break; 637 case 13: 638 #line 90 "ok_syntax1.y" 639 { yyval.ival = yystack.l_mark[-2].ival | yystack.l_mark[0].ival; } 640 break; 641 case 14: 642 #line 92 "ok_syntax1.y" 643 { yyval.ival = - yystack.l_mark[0].ival; } 644 break; 645 case 15: 646 #line 94 "ok_syntax1.y" 647 { yyval.ival = regs[yystack.l_mark[0].ival]; } 648 break; 649 case 17: 650 #line 99 "ok_syntax1.y" 651 { yyval.ival = yystack.l_mark[0].ival; (*base) = (yystack.l_mark[0].ival==0) ? 8 : 10; } 652 break; 653 case 18: 654 #line 101 "ok_syntax1.y" 655 { yyval.ival = (*base) * yystack.l_mark[-1].ival + yystack.l_mark[0].ival; } 656 break; 657 #line 658 "ok_syntax1.tab.c" 658 } 659 yystack.s_mark -= yym; 660 yystate = *yystack.s_mark; 661 yystack.l_mark -= yym; 662 yym = yylhs[yyn]; 663 if (yystate == 0 && yym == 0) 664 { 665 #if YYDEBUG 666 if (yydebug) 667 printf("%sdebug: after reduction, shifting from state 0 to\ 668 state %d\n", YYPREFIX, YYFINAL); 669 #endif 670 yystate = YYFINAL; 671 *++yystack.s_mark = YYFINAL; 672 *++yystack.l_mark = yyval; 673 if (yychar < 0) 674 { 675 yychar = YYLEX; 676 if (yychar < 0) yychar = YYEOF; 677 #if YYDEBUG 678 if (yydebug) 679 { 680 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; 681 printf("%sdebug: state %d, reading %d (%s)\n", 682 YYPREFIX, YYFINAL, yychar, yys); 683 } 684 #endif 685 } 686 if (yychar == YYEOF) goto yyaccept; 687 goto yyloop; 688 } 689 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && 690 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) 691 yystate = yytable[yyn]; 692 else 693 yystate = yydgoto[yym]; 694 #if YYDEBUG 695 if (yydebug) 696 printf("%sdebug: after reduction, shifting from state %d \ 697 to state %d\n", YYPREFIX, *yystack.s_mark, yystate); 698 #endif 699 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; 700 *++yystack.s_mark = (YYINT) yystate; 701 *++yystack.l_mark = yyval; 702 goto yyloop; 703 704 yyoverflow: 705 YYERROR_CALL("yacc stack overflow"); 706 707 yyabort: 708 yyfreestack(&yystack); 709 return (1); 710 711 yyaccept: 712 yyfreestack(&yystack); 713 return (0); 714 } 715