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