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