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