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