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