1117260Sache#ifndef lint 2117260Sachestatic const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93"; 3117260Sache#endif 4117260Sache 5117260Sache#define YYBYACC 1 6117260Sache#define YYMAJOR 1 7117260Sache#define YYMINOR 9 8117260Sache 9117260Sache#define YYEMPTY (-1) 10117260Sache#define yyclearin (yychar = YYEMPTY) 11117260Sache#define yyerrok (yyerrflag = 0) 12117260Sache#define YYRECOVERING() (yyerrflag != 0) 13117260Sache 14117260Sache 15117260Sache#ifndef yyparse 16117260Sache#define yyparse quote_calc2_parse 17117260Sache#endif /* yyparse */ 18117260Sache 19117260Sache#ifndef yylex 20117260Sache#define yylex quote_calc2_lex 21117260Sache#endif /* yylex */ 22117260Sache 23117260Sache#ifndef yyerror 24117260Sache#define yyerror quote_calc2_error 25117260Sache#endif /* yyerror */ 26117260Sache 27117260Sache#ifndef yychar 28117260Sache#define yychar quote_calc2_char 29117260Sache#endif /* yychar */ 30117260Sache 31117260Sache#ifndef yyval 32117260Sache#define yyval quote_calc2_val 33117260Sache#endif /* yyval */ 34117260Sache 35117260Sache#ifndef yylval 36117260Sache#define yylval quote_calc2_lval 37117260Sache#endif /* yylval */ 38117260Sache 39117260Sache#ifndef yydebug 40117260Sache#define yydebug quote_calc2_debug 41117260Sache#endif /* yydebug */ 42117260Sache 43117260Sache#ifndef yynerrs 44117260Sache#define yynerrs quote_calc2_nerrs 45117260Sache#endif /* yynerrs */ 46117260Sache 47117260Sache#ifndef yyerrflag 48117260Sache#define yyerrflag quote_calc2_errflag 49117260Sache#endif /* yyerrflag */ 50117260Sache 51117260Sache#ifndef yylhs 52117260Sache#define yylhs quote_calc2_lhs 53117260Sache#endif /* yylhs */ 54117260Sache 55117260Sache#ifndef yylen 56117260Sache#define yylen quote_calc2_len 57117260Sache#endif /* yylen */ 58117260Sache 59117260Sache#ifndef yydefred 60117260Sache#define yydefred quote_calc2_defred 61117260Sache#endif /* yydefred */ 62117260Sache 63117260Sache#ifndef yydgoto 64117260Sache#define yydgoto quote_calc2_dgoto 65117260Sache#endif /* yydgoto */ 66117260Sache 67117260Sache#ifndef yysindex 68117260Sache#define yysindex quote_calc2_sindex 69117260Sache#endif /* yysindex */ 70117260Sache 71117260Sache#ifndef yyrindex 72117260Sache#define yyrindex quote_calc2_rindex 73117260Sache#endif /* yyrindex */ 74117260Sache 75117260Sache#ifndef yygindex 76117260Sache#define yygindex quote_calc2_gindex 77117260Sache#endif /* yygindex */ 78117260Sache 79117260Sache#ifndef yytable 80117260Sache#define yytable quote_calc2_table 81117260Sache#endif /* yytable */ 82117260Sache 83117260Sache#ifndef yycheck 84117260Sache#define yycheck quote_calc2_check 85#endif /* yycheck */ 86 87#ifndef yyname 88#define yyname quote_calc2_name 89#endif /* yyname */ 90 91#ifndef yyrule 92#define yyrule quote_calc2_rule 93#endif /* yyrule */ 94#define YYPREFIX "quote_calc2_" 95 96#define YYPURE 0 97 98#line 2 "quote_calc2.y" 99# include <stdio.h> 100# include <ctype.h> 101 102int regs[26]; 103int base; 104 105int yylex(void); 106static void yyerror(const char *s); 107 108#line 109 "quote_calc2.tab.c" 109 110#ifndef YYSTYPE 111typedef int YYSTYPE; 112#endif 113 114/* compatibility with bison */ 115#ifdef YYPARSE_PARAM 116/* compatibility with FreeBSD */ 117# ifdef YYPARSE_PARAM_TYPE 118# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM) 119# else 120# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM) 121# endif 122#else 123# define YYPARSE_DECL() yyparse(void) 124#endif 125 126/* Parameters sent to lex. */ 127#ifdef YYLEX_PARAM 128# define YYLEX_DECL() yylex(void *YYLEX_PARAM) 129# define YYLEX yylex(YYLEX_PARAM) 130#else 131# define YYLEX_DECL() yylex(void) 132# define YYLEX yylex() 133#endif 134 135/* Parameters sent to yyerror. */ 136#ifndef YYERROR_DECL 137#define YYERROR_DECL() yyerror(const char *s) 138#endif 139#ifndef YYERROR_CALL 140#define YYERROR_CALL(msg) yyerror(msg) 141#endif 142 143extern int YYPARSE_DECL(); 144 145#define OP_ADD 257 146#define ADD 258 147#define OP_SUB 259 148#define SUB 260 149#define OP_MUL 261 150#define MUL 262 151#define OP_DIV 263 152#define DIV 264 153#define OP_MOD 265 154#define MOD 266 155#define OP_AND 267 156#define AND 268 157#define DIGIT 269 158#define LETTER 270 159#define UMINUS 271 160#define YYERRCODE 256 161static const short quote_calc2_lhs[] = { -1, 162 0, 0, 0, 1, 1, 2, 2, 2, 2, 2, 163 2, 2, 2, 2, 2, 2, 3, 3, 164}; 165static const short quote_calc2_len[] = { 2, 166 0, 3, 3, 1, 3, 3, 3, 3, 3, 3, 167 3, 3, 3, 2, 1, 1, 1, 2, 168}; 169static const short quote_calc2_defred[] = { 1, 170 0, 0, 0, 17, 0, 0, 0, 0, 0, 3, 171 15, 0, 0, 0, 2, 0, 0, 0, 0, 0, 172 0, 0, 18, 0, 6, 0, 0, 0, 0, 0, 173 0, 0, 174}; 175static const short quote_calc2_dgoto[] = { 1, 176 7, 8, 9, 177}; 178static const short quote_calc2_sindex[] = { 0, 179 -38, 4, -36, 0, -51, -36, 6, -121, -249, 0, 180 0, -243, -36, -23, 0, -36, -36, -36, -36, -36, 181 -36, -36, 0, -121, 0, -121, -121, -121, -121, -121, 182 -121, -243, 183}; 184static const short quote_calc2_rindex[] = { 0, 185 0, 0, 0, 0, -9, 0, 0, 12, -10, 0, 186 0, -5, 0, 0, 0, 0, 0, 0, 0, 0, 187 0, 0, 0, 14, 0, -3, -2, -1, 1, 2, 188 3, -4, 189}; 190static const short quote_calc2_gindex[] = { 0, 191 0, 42, 0, 192}; 193#define YYTABLESIZE 259 194static const short quote_calc2_table[] = { 16, 195 15, 6, 22, 6, 14, 13, 7, 8, 9, 13, 196 10, 11, 12, 10, 16, 15, 17, 25, 18, 23, 197 19, 4, 20, 5, 21, 0, 0, 0, 0, 0, 198 16, 0, 0, 0, 0, 14, 13, 7, 8, 9, 199 0, 10, 11, 12, 12, 0, 0, 14, 0, 0, 200 0, 0, 0, 0, 24, 0, 0, 26, 27, 28, 201 29, 30, 31, 32, 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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 205 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 206 0, 0, 0, 16, 15, 0, 0, 0, 14, 13, 207 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 208 0, 0, 0, 0, 0, 0, 16, 0, 17, 0, 209 18, 0, 19, 0, 20, 0, 21, 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, 0, 0, 0, 216 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 217 0, 3, 0, 3, 0, 0, 0, 0, 0, 0, 218 4, 5, 4, 11, 16, 0, 17, 0, 18, 0, 219 19, 0, 20, 0, 21, 0, 0, 16, 15, 16, 220 15, 16, 15, 16, 15, 16, 15, 16, 15, 221}; 222static const short quote_calc2_check[] = { 10, 223 10, 40, 124, 40, 10, 10, 10, 10, 10, 61, 224 10, 10, 10, 10, 258, 10, 260, 41, 262, 269, 225 264, 10, 266, 10, 268, -1, -1, -1, -1, -1, 226 41, -1, -1, -1, -1, 41, 41, 41, 41, 41, 227 -1, 41, 41, 41, 3, -1, -1, 6, -1, -1, 228 -1, -1, -1, -1, 13, -1, -1, 16, 17, 18, 229 19, 20, 21, 22, -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 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 233 124, -1, -1, -1, -1, -1, -1, -1, -1, -1, 234 -1, -1, -1, 124, 124, -1, -1, -1, 124, 124, 235 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 236 -1, -1, -1, -1, -1, -1, 258, -1, 260, -1, 237 262, -1, 264, -1, 266, -1, 268, -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, -1, -1, -1, 244 -1, -1, -1, -1, -1, -1, -1, 256, -1, -1, 245 -1, 260, -1, 260, -1, -1, -1, -1, -1, -1, 246 269, 270, 269, 270, 258, -1, 260, -1, 262, -1, 247 264, -1, 266, -1, 268, -1, -1, 258, 258, 260, 248 260, 262, 262, 264, 264, 266, 266, 268, 268, 249}; 250#define YYFINAL 1 251#ifndef YYDEBUG 252#define YYDEBUG 0 253#endif 254#define YYMAXTOKEN 271 255#if YYDEBUG 256static const char *yyname[] = { 257 258"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, 2590,0,0,0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0, 2600,0,0,0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2610,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0, 2620,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2630,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2640,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2650,0,0,0,0,0,"OP_ADD","\"ADD\"","OP_SUB","\"SUB\"","OP_MUL","\"MUL\"","OP_DIV", 266"\"DIV\"","OP_MOD","\"MOD\"","OP_AND","\"AND\"","DIGIT","LETTER","UMINUS", 267}; 268static const char *yyrule[] = { 269"$accept : list", 270"list :", 271"list : list stat '\\n'", 272"list : list error '\\n'", 273"stat : expr", 274"stat : LETTER '=' expr", 275"expr : '(' expr ')'", 276"expr : expr \"ADD\" expr", 277"expr : expr \"SUB\" expr", 278"expr : expr \"MUL\" expr", 279"expr : expr \"DIV\" expr", 280"expr : expr \"MOD\" expr", 281"expr : expr \"AND\" expr", 282"expr : expr '|' expr", 283"expr : \"SUB\" expr", 284"expr : LETTER", 285"expr : number", 286"number : DIGIT", 287"number : number DIGIT", 288 289}; 290#endif 291 292int yydebug; 293int yynerrs; 294 295int yyerrflag; 296int yychar; 297YYSTYPE yyval; 298YYSTYPE yylval; 299 300/* define the initial stack-sizes */ 301#ifdef YYSTACKSIZE 302#undef YYMAXDEPTH 303#define YYMAXDEPTH YYSTACKSIZE 304#else 305#ifdef YYMAXDEPTH 306#define YYSTACKSIZE YYMAXDEPTH 307#else 308#define YYSTACKSIZE 500 309#define YYMAXDEPTH 500 310#endif 311#endif 312 313#define YYINITSTACKSIZE 500 314 315typedef struct { 316 unsigned stacksize; 317 short *s_base; 318 short *s_mark; 319 short *s_last; 320 YYSTYPE *l_base; 321 YYSTYPE *l_mark; 322} YYSTACKDATA; 323/* variables for the parser stack */ 324static YYSTACKDATA yystack; 325#line 73 "quote_calc2.y" 326 /* start of programs */ 327 328int 329main (void) 330{ 331 while(!feof(stdin)) { 332 yyparse(); 333 } 334 return 0; 335} 336 337static void 338yyerror(const char *s) 339{ 340 fprintf(stderr, "%s\n", s); 341} 342 343int 344yylex(void) { 345 /* lexical analysis routine */ 346 /* returns LETTER for a lower case letter, yylval = 0 through 25 */ 347 /* return DIGIT for a digit, yylval = 0 through 9 */ 348 /* all other characters are returned immediately */ 349 350 int c; 351 352 while( (c=getchar()) == ' ' ) { /* skip blanks */ } 353 354 /* c is now nonblank */ 355 356 if( islower( c )) { 357 yylval = c - 'a'; 358 return ( LETTER ); 359 } 360 if( isdigit( c )) { 361 yylval = c - '0'; 362 return ( DIGIT ); 363 } 364 return( c ); 365} 366#line 367 "quote_calc2.tab.c" 367 368#if YYDEBUG 369#include <stdio.h> /* needed for printf */ 370#endif 371 372#include <stdlib.h> /* needed for malloc, etc */ 373#include <string.h> /* needed for memset */ 374 375/* allocate initial stack or double stack size, up to YYMAXDEPTH */ 376static int yygrowstack(YYSTACKDATA *data) 377{ 378 int i; 379 unsigned newsize; 380 short *newss; 381 YYSTYPE *newvs; 382 383 if ((newsize = data->stacksize) == 0) 384 newsize = YYINITSTACKSIZE; 385 else if (newsize >= YYMAXDEPTH) 386 return -1; 387 else if ((newsize *= 2) > YYMAXDEPTH) 388 newsize = YYMAXDEPTH; 389 390 i = (int) (data->s_mark - data->s_base); 391 newss = (short *)realloc(data->s_base, newsize * sizeof(*newss)); 392 if (newss == 0) 393 return -1; 394 395 data->s_base = newss; 396 data->s_mark = newss + i; 397 398 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)); 399 if (newvs == 0) 400 return -1; 401 402 data->l_base = newvs; 403 data->l_mark = newvs + i; 404 405 data->stacksize = newsize; 406 data->s_last = data->s_base + newsize - 1; 407 return 0; 408} 409 410#if YYPURE || defined(YY_NO_LEAKS) 411static void yyfreestack(YYSTACKDATA *data) 412{ 413 free(data->s_base); 414 free(data->l_base); 415 memset(data, 0, sizeof(*data)); 416} 417#else 418#define yyfreestack(data) /* nothing */ 419#endif 420 421#define YYABORT goto yyabort 422#define YYREJECT goto yyabort 423#define YYACCEPT goto yyaccept 424#define YYERROR goto yyerrlab 425 426int 427YYPARSE_DECL() 428{ 429 int yym, yyn, yystate; 430#if YYDEBUG 431 const char *yys; 432 433 if ((yys = getenv("YYDEBUG")) != 0) 434 { 435 yyn = *yys; 436 if (yyn >= '0' && yyn <= '9') 437 yydebug = yyn - '0'; 438 } 439#endif 440 441 yynerrs = 0; 442 yyerrflag = 0; 443 yychar = YYEMPTY; 444 yystate = 0; 445 446#if YYPURE 447 memset(&yystack, 0, sizeof(yystack)); 448#endif 449 450 if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow; 451 yystack.s_mark = yystack.s_base; 452 yystack.l_mark = yystack.l_base; 453 yystate = 0; 454 *yystack.s_mark = 0; 455 456yyloop: 457 if ((yyn = yydefred[yystate]) != 0) goto yyreduce; 458 if (yychar < 0) 459 { 460 if ((yychar = YYLEX) < 0) yychar = 0; 461#if YYDEBUG 462 if (yydebug) 463 { 464 yys = 0; 465 if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; 466 if (!yys) yys = "illegal-symbol"; 467 printf("%sdebug: state %d, reading %d (%s)\n", 468 YYPREFIX, yystate, yychar, yys); 469 } 470#endif 471 } 472 if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 && 473 yyn <= YYTABLESIZE && yycheck[yyn] == yychar) 474 { 475#if YYDEBUG 476 if (yydebug) 477 printf("%sdebug: state %d, shifting to state %d\n", 478 YYPREFIX, yystate, yytable[yyn]); 479#endif 480 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack)) 481 { 482 goto yyoverflow; 483 } 484 yystate = yytable[yyn]; 485 *++yystack.s_mark = yytable[yyn]; 486 *++yystack.l_mark = yylval; 487 yychar = YYEMPTY; 488 if (yyerrflag > 0) --yyerrflag; 489 goto yyloop; 490 } 491 if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && 492 yyn <= YYTABLESIZE && yycheck[yyn] == yychar) 493 { 494 yyn = yytable[yyn]; 495 goto yyreduce; 496 } 497 if (yyerrflag) goto yyinrecovery; 498 499 yyerror("syntax error"); 500 501 goto yyerrlab; 502 503yyerrlab: 504 ++yynerrs; 505 506yyinrecovery: 507 if (yyerrflag < 3) 508 { 509 yyerrflag = 3; 510 for (;;) 511 { 512 if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 && 513 yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) 514 { 515#if YYDEBUG 516 if (yydebug) 517 printf("%sdebug: state %d, error recovery shifting\ 518 to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); 519#endif 520 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack)) 521 { 522 goto yyoverflow; 523 } 524 yystate = yytable[yyn]; 525 *++yystack.s_mark = yytable[yyn]; 526 *++yystack.l_mark = yylval; 527 goto yyloop; 528 } 529 else 530 { 531#if YYDEBUG 532 if (yydebug) 533 printf("%sdebug: error recovery discarding state %d\n", 534 YYPREFIX, *yystack.s_mark); 535#endif 536 if (yystack.s_mark <= yystack.s_base) goto yyabort; 537 --yystack.s_mark; 538 --yystack.l_mark; 539 } 540 } 541 } 542 else 543 { 544 if (yychar == 0) goto yyabort; 545#if YYDEBUG 546 if (yydebug) 547 { 548 yys = 0; 549 if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; 550 if (!yys) yys = "illegal-symbol"; 551 printf("%sdebug: state %d, error recovery discards token %d (%s)\n", 552 YYPREFIX, yystate, yychar, yys); 553 } 554#endif 555 yychar = YYEMPTY; 556 goto yyloop; 557 } 558 559yyreduce: 560#if YYDEBUG 561 if (yydebug) 562 printf("%sdebug: state %d, reducing by rule %d (%s)\n", 563 YYPREFIX, yystate, yyn, yyrule[yyn]); 564#endif 565 yym = yylen[yyn]; 566 if (yym) 567 yyval = yystack.l_mark[1-yym]; 568 else 569 memset(&yyval, 0, sizeof yyval); 570 switch (yyn) 571 { 572case 3: 573#line 35 "quote_calc2.y" 574 { yyerrok ; } 575break; 576case 4: 577#line 39 "quote_calc2.y" 578 { printf("%d\n",yystack.l_mark[0]);} 579break; 580case 5: 581#line 41 "quote_calc2.y" 582 { regs[yystack.l_mark[-2]] = yystack.l_mark[0]; } 583break; 584case 6: 585#line 45 "quote_calc2.y" 586 { yyval = yystack.l_mark[-1]; } 587break; 588case 7: 589#line 47 "quote_calc2.y" 590 { yyval = yystack.l_mark[-2] + yystack.l_mark[0]; } 591break; 592case 8: 593#line 49 "quote_calc2.y" 594 { yyval = yystack.l_mark[-2] - yystack.l_mark[0]; } 595break; 596case 9: 597#line 51 "quote_calc2.y" 598 { yyval = yystack.l_mark[-2] * yystack.l_mark[0]; } 599break; 600case 10: 601#line 53 "quote_calc2.y" 602 { yyval = yystack.l_mark[-2] / yystack.l_mark[0]; } 603break; 604case 11: 605#line 55 "quote_calc2.y" 606 { yyval = yystack.l_mark[-2] % yystack.l_mark[0]; } 607break; 608case 12: 609#line 57 "quote_calc2.y" 610 { yyval = yystack.l_mark[-2] & yystack.l_mark[0]; } 611break; 612case 13: 613#line 59 "quote_calc2.y" 614 { yyval = yystack.l_mark[-2] | yystack.l_mark[0]; } 615break; 616case 14: 617#line 61 "quote_calc2.y" 618 { yyval = - yystack.l_mark[0]; } 619break; 620case 15: 621#line 63 "quote_calc2.y" 622 { yyval = regs[yystack.l_mark[0]]; } 623break; 624case 17: 625#line 68 "quote_calc2.y" 626 { yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; } 627break; 628case 18: 629#line 70 "quote_calc2.y" 630 { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; } 631break; 632#line 633 "quote_calc2.tab.c" 633 } 634 yystack.s_mark -= yym; 635 yystate = *yystack.s_mark; 636 yystack.l_mark -= yym; 637 yym = yylhs[yyn]; 638 if (yystate == 0 && yym == 0) 639 { 640#if YYDEBUG 641 if (yydebug) 642 printf("%sdebug: after reduction, shifting from state 0 to\ 643 state %d\n", YYPREFIX, YYFINAL); 644#endif 645 yystate = YYFINAL; 646 *++yystack.s_mark = YYFINAL; 647 *++yystack.l_mark = yyval; 648 if (yychar < 0) 649 { 650 if ((yychar = YYLEX) < 0) yychar = 0; 651#if YYDEBUG 652 if (yydebug) 653 { 654 yys = 0; 655 if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; 656 if (!yys) yys = "illegal-symbol"; 657 printf("%sdebug: state %d, reading %d (%s)\n", 658 YYPREFIX, YYFINAL, yychar, yys); 659 } 660#endif 661 } 662 if (yychar == 0) goto yyaccept; 663 goto yyloop; 664 } 665 if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && 666 yyn <= YYTABLESIZE && yycheck[yyn] == yystate) 667 yystate = yytable[yyn]; 668 else 669 yystate = yydgoto[yym]; 670#if YYDEBUG 671 if (yydebug) 672 printf("%sdebug: after reduction, shifting from state %d \ 673to state %d\n", YYPREFIX, *yystack.s_mark, yystate); 674#endif 675 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack)) 676 { 677 goto yyoverflow; 678 } 679 *++yystack.s_mark = (short) yystate; 680 *++yystack.l_mark = yyval; 681 goto yyloop; 682 683yyoverflow: 684 yyerror("yacc stack overflow"); 685 686yyabort: 687 yyfreestack(&yystack); 688 return (1); 689 690yyaccept: 691 yyfreestack(&yystack); 692 return (0); 693} 694