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