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