1*e86eba8aSchristos /* $NetBSD: stdin1.calc.c,v 1.1.1.2 2021/02/20 20:30:10 christos Exp $ */
2fd0b3accSchristos
3fd0b3accSchristos /* original parser id follows */
4fd0b3accSchristos /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
5fd0b3accSchristos /* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
6fd0b3accSchristos
7fd0b3accSchristos #define YYBYACC 1
8*e86eba8aSchristos #define YYMAJOR 2
9*e86eba8aSchristos #define YYMINOR 0
10fd0b3accSchristos #define YYCHECK "yyyymmdd"
11fd0b3accSchristos
12fd0b3accSchristos #define YYEMPTY (-1)
13fd0b3accSchristos #define yyclearin (yychar = YYEMPTY)
14fd0b3accSchristos #define yyerrok (yyerrflag = 0)
15fd0b3accSchristos #define YYRECOVERING() (yyerrflag != 0)
16fd0b3accSchristos #define YYENOMEM (-2)
17fd0b3accSchristos #define YYEOF 0
18fd0b3accSchristos #undef YYBTYACC
19fd0b3accSchristos #define YYBTYACC 0
20fd0b3accSchristos #define YYDEBUGSTR YYPREFIX "debug"
21fd0b3accSchristos #define YYPREFIX "yy"
22fd0b3accSchristos
23fd0b3accSchristos #define YYPURE 0
24fd0b3accSchristos
25fd0b3accSchristos #line 2 "(null)"
26fd0b3accSchristos # include <stdio.h>
27fd0b3accSchristos # include <ctype.h>
28fd0b3accSchristos
29fd0b3accSchristos int regs[26];
30fd0b3accSchristos int base;
31fd0b3accSchristos
32fd0b3accSchristos extern int yylex(void);
33fd0b3accSchristos static void yyerror(const char *s);
34fd0b3accSchristos
35fd0b3accSchristos #line 34 "stdin1.calc.c"
36fd0b3accSchristos
37fd0b3accSchristos #if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
38fd0b3accSchristos /* Default: YYSTYPE is the semantic value type. */
39fd0b3accSchristos typedef int YYSTYPE;
40fd0b3accSchristos # define YYSTYPE_IS_DECLARED 1
41fd0b3accSchristos #endif
42fd0b3accSchristos
43fd0b3accSchristos /* compatibility with bison */
44fd0b3accSchristos #ifdef YYPARSE_PARAM
45fd0b3accSchristos /* compatibility with FreeBSD */
46fd0b3accSchristos # ifdef YYPARSE_PARAM_TYPE
47fd0b3accSchristos # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
48fd0b3accSchristos # else
49fd0b3accSchristos # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
50fd0b3accSchristos # endif
51fd0b3accSchristos #else
52fd0b3accSchristos # define YYPARSE_DECL() yyparse(void)
53fd0b3accSchristos #endif
54fd0b3accSchristos
55fd0b3accSchristos /* Parameters sent to lex. */
56fd0b3accSchristos #ifdef YYLEX_PARAM
57fd0b3accSchristos # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
58fd0b3accSchristos # define YYLEX yylex(YYLEX_PARAM)
59fd0b3accSchristos #else
60fd0b3accSchristos # define YYLEX_DECL() yylex(void)
61fd0b3accSchristos # define YYLEX yylex()
62fd0b3accSchristos #endif
63fd0b3accSchristos
64fd0b3accSchristos #if !(defined(yylex) || defined(YYSTATE))
65fd0b3accSchristos int YYLEX_DECL();
66fd0b3accSchristos #endif
67fd0b3accSchristos
68fd0b3accSchristos /* Parameters sent to yyerror. */
69fd0b3accSchristos #ifndef YYERROR_DECL
70fd0b3accSchristos #define YYERROR_DECL() yyerror(const char *s)
71fd0b3accSchristos #endif
72fd0b3accSchristos #ifndef YYERROR_CALL
73fd0b3accSchristos #define YYERROR_CALL(msg) yyerror(msg)
74fd0b3accSchristos #endif
75fd0b3accSchristos
76fd0b3accSchristos extern int YYPARSE_DECL();
77fd0b3accSchristos
78fd0b3accSchristos #define DIGIT 257
79fd0b3accSchristos #define LETTER 258
80fd0b3accSchristos #define UMINUS 259
81fd0b3accSchristos #define YYERRCODE 256
82fd0b3accSchristos typedef short YYINT;
83fd0b3accSchristos static const YYINT yylhs[] = { -1,
84fd0b3accSchristos 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
85fd0b3accSchristos 2, 2, 2, 2, 2, 2, 3, 3,
86fd0b3accSchristos };
87fd0b3accSchristos static const YYINT yylen[] = { 2,
88fd0b3accSchristos 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
89fd0b3accSchristos 3, 3, 3, 2, 1, 1, 1, 2,
90fd0b3accSchristos };
91fd0b3accSchristos static const YYINT yydefred[] = { 1,
92fd0b3accSchristos 0, 0, 17, 0, 0, 0, 0, 0, 0, 3,
93fd0b3accSchristos 0, 15, 14, 0, 2, 0, 0, 0, 0, 0,
94fd0b3accSchristos 0, 0, 18, 0, 6, 0, 0, 0, 0, 9,
95fd0b3accSchristos 10, 11,
96fd0b3accSchristos };
97fd0b3accSchristos #if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING)
98fd0b3accSchristos static const YYINT yystos[] = { 0,
99fd0b3accSchristos 261, 256, 257, 258, 45, 40, 262, 263, 264, 10,
100fd0b3accSchristos 61, 258, 263, 263, 10, 124, 38, 43, 45, 42,
101fd0b3accSchristos 47, 37, 257, 263, 41, 263, 263, 263, 263, 263,
102fd0b3accSchristos 263, 263,
103fd0b3accSchristos };
104fd0b3accSchristos #endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */
105fd0b3accSchristos static const YYINT yydgoto[] = { 1,
106fd0b3accSchristos 7, 8, 9,
107fd0b3accSchristos };
108fd0b3accSchristos static const YYINT yysindex[] = { 0,
109fd0b3accSchristos -40, -7, 0, -55, -38, -38, 1, -29, -247, 0,
110fd0b3accSchristos -38, 0, 0, 22, 0, -38, -38, -38, -38, -38,
111fd0b3accSchristos -38, -38, 0, -29, 0, 51, 60, -20, -20, 0,
112fd0b3accSchristos 0, 0,
113fd0b3accSchristos };
114fd0b3accSchristos static const YYINT yyrindex[] = { 0,
115fd0b3accSchristos 0, 0, 0, 2, 0, 0, 0, 9, -9, 0,
116fd0b3accSchristos 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
117fd0b3accSchristos 0, 0, 0, 10, 0, -6, 14, 5, 13, 0,
118fd0b3accSchristos 0, 0,
119fd0b3accSchristos };
120fd0b3accSchristos #if YYBTYACC
121fd0b3accSchristos static const YYINT yycindex[] = { 0,
122fd0b3accSchristos 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
123fd0b3accSchristos 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
124fd0b3accSchristos 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
125fd0b3accSchristos 0, 0,
126fd0b3accSchristos };
127fd0b3accSchristos #endif
128fd0b3accSchristos static const YYINT yygindex[] = { 0,
129fd0b3accSchristos 0, 65, 0,
130fd0b3accSchristos };
131fd0b3accSchristos #define YYTABLESIZE 220
132fd0b3accSchristos static const YYINT yytable[] = { 6,
133fd0b3accSchristos 16, 6, 10, 13, 5, 11, 5, 22, 17, 23,
134fd0b3accSchristos 15, 15, 20, 18, 7, 19, 22, 21, 4, 5,
135fd0b3accSchristos 0, 20, 8, 12, 0, 0, 21, 16, 16, 0,
136fd0b3accSchristos 0, 16, 16, 16, 13, 16, 0, 16, 15, 15,
137fd0b3accSchristos 0, 0, 7, 15, 15, 7, 15, 7, 15, 7,
138fd0b3accSchristos 8, 12, 0, 8, 12, 8, 0, 8, 22, 17,
139fd0b3accSchristos 0, 0, 25, 20, 18, 0, 19, 0, 21, 13,
140fd0b3accSchristos 14, 0, 0, 0, 0, 24, 0, 0, 0, 0,
141fd0b3accSchristos 26, 27, 28, 29, 30, 31, 32, 22, 17, 0,
142fd0b3accSchristos 0, 0, 20, 18, 16, 19, 22, 21, 0, 0,
143fd0b3accSchristos 0, 20, 18, 0, 19, 0, 21, 0, 0, 0,
144fd0b3accSchristos 0, 0, 0, 0, 16, 0, 0, 13, 0, 0,
145fd0b3accSchristos 0, 0, 0, 0, 0, 15, 0, 0, 7, 0,
146fd0b3accSchristos 0, 0, 0, 0, 0, 0, 8, 12, 0, 0,
147fd0b3accSchristos 0, 0, 0, 0, 0, 16, 0, 0, 0, 0,
148fd0b3accSchristos 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
149fd0b3accSchristos 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
150fd0b3accSchristos 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
151fd0b3accSchristos 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
152fd0b3accSchristos 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
153fd0b3accSchristos 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
154fd0b3accSchristos 0, 0, 0, 0, 0, 2, 3, 4, 3, 12,
155fd0b3accSchristos };
156fd0b3accSchristos static const YYINT yycheck[] = { 40,
157fd0b3accSchristos 10, 40, 10, 10, 45, 61, 45, 37, 38, 257,
158fd0b3accSchristos 10, 10, 42, 43, 10, 45, 37, 47, 10, 10,
159fd0b3accSchristos -1, 42, 10, 10, -1, -1, 47, 37, 38, -1,
160fd0b3accSchristos -1, 41, 42, 43, 41, 45, -1, 47, 37, 38,
161fd0b3accSchristos -1, -1, 38, 42, 43, 41, 45, 43, 47, 45,
162fd0b3accSchristos 38, 38, -1, 41, 41, 43, -1, 45, 37, 38,
163fd0b3accSchristos -1, -1, 41, 42, 43, -1, 45, -1, 47, 5,
164fd0b3accSchristos 6, -1, -1, -1, -1, 11, -1, -1, -1, -1,
165fd0b3accSchristos 16, 17, 18, 19, 20, 21, 22, 37, 38, -1,
166fd0b3accSchristos -1, -1, 42, 43, 124, 45, 37, 47, -1, -1,
167fd0b3accSchristos -1, 42, 43, -1, 45, -1, 47, -1, -1, -1,
168fd0b3accSchristos -1, -1, -1, -1, 124, -1, -1, 124, -1, -1,
169fd0b3accSchristos -1, -1, -1, -1, -1, 124, -1, -1, 124, -1,
170fd0b3accSchristos -1, -1, -1, -1, -1, -1, 124, 124, -1, -1,
171fd0b3accSchristos -1, -1, -1, -1, -1, 124, -1, -1, -1, -1,
172fd0b3accSchristos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
173fd0b3accSchristos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
174fd0b3accSchristos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
175fd0b3accSchristos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
176fd0b3accSchristos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
177fd0b3accSchristos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
178fd0b3accSchristos -1, -1, -1, -1, -1, 256, 257, 258, 257, 258,
179fd0b3accSchristos };
180fd0b3accSchristos #if YYBTYACC
181fd0b3accSchristos static const YYINT yyctable[] = { -1,
182fd0b3accSchristos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
183fd0b3accSchristos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
184fd0b3accSchristos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
185fd0b3accSchristos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
186fd0b3accSchristos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
187fd0b3accSchristos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
188fd0b3accSchristos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
189fd0b3accSchristos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
190fd0b3accSchristos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
191fd0b3accSchristos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
192fd0b3accSchristos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
193fd0b3accSchristos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
194fd0b3accSchristos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
195fd0b3accSchristos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
196fd0b3accSchristos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
197fd0b3accSchristos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
198fd0b3accSchristos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
199fd0b3accSchristos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
200fd0b3accSchristos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
201fd0b3accSchristos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
202fd0b3accSchristos -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
203fd0b3accSchristos -1, -1, -1, -1, -1, -1, -1, -1, -1,
204fd0b3accSchristos };
205fd0b3accSchristos #endif
206fd0b3accSchristos #define YYFINAL 1
207fd0b3accSchristos #ifndef YYDEBUG
208fd0b3accSchristos #define YYDEBUG 0
209fd0b3accSchristos #endif
210fd0b3accSchristos #define YYMAXTOKEN 259
211fd0b3accSchristos #define YYUNDFTOKEN 265
212fd0b3accSchristos #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
213fd0b3accSchristos #if YYDEBUG
214fd0b3accSchristos static const char *const yyname[] = {
215fd0b3accSchristos
216fd0b3accSchristos "$end",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,0,0,0,
217fd0b3accSchristos 0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,0,0,0,
218fd0b3accSchristos 0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
219fd0b3accSchristos 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,0,0,0,
220fd0b3accSchristos 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
221fd0b3accSchristos 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
222fd0b3accSchristos 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
223fd0b3accSchristos 0,0,"error","DIGIT","LETTER","UMINUS","$accept","list","stat","expr","number",
224fd0b3accSchristos "illegal-symbol",
225fd0b3accSchristos };
226fd0b3accSchristos static const char *const yyrule[] = {
227fd0b3accSchristos "$accept : list",
228fd0b3accSchristos "list :",
229fd0b3accSchristos "list : list stat '\\n'",
230fd0b3accSchristos "list : list error '\\n'",
231fd0b3accSchristos "stat : expr",
232fd0b3accSchristos "stat : LETTER '=' expr",
233fd0b3accSchristos "expr : '(' expr ')'",
234fd0b3accSchristos "expr : expr '+' expr",
235fd0b3accSchristos "expr : expr '-' expr",
236fd0b3accSchristos "expr : expr '*' expr",
237fd0b3accSchristos "expr : expr '/' expr",
238fd0b3accSchristos "expr : expr '%' expr",
239fd0b3accSchristos "expr : expr '&' expr",
240fd0b3accSchristos "expr : expr '|' expr",
241fd0b3accSchristos "expr : '-' expr",
242fd0b3accSchristos "expr : LETTER",
243fd0b3accSchristos "expr : number",
244fd0b3accSchristos "number : DIGIT",
245fd0b3accSchristos "number : number DIGIT",
246fd0b3accSchristos
247fd0b3accSchristos };
248fd0b3accSchristos #endif
249fd0b3accSchristos
250fd0b3accSchristos #if YYDEBUG
251fd0b3accSchristos int yydebug;
252fd0b3accSchristos #endif
253fd0b3accSchristos
254fd0b3accSchristos int yyerrflag;
255fd0b3accSchristos int yychar;
256fd0b3accSchristos YYSTYPE yyval;
257fd0b3accSchristos YYSTYPE yylval;
258fd0b3accSchristos int yynerrs;
259fd0b3accSchristos
260fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
261fd0b3accSchristos YYLTYPE yyloc; /* position returned by actions */
262fd0b3accSchristos YYLTYPE yylloc; /* position from the lexer */
263fd0b3accSchristos #endif
264fd0b3accSchristos
265fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
266fd0b3accSchristos #ifndef YYLLOC_DEFAULT
267fd0b3accSchristos #define YYLLOC_DEFAULT(loc, rhs, n) \
268fd0b3accSchristos do \
269fd0b3accSchristos { \
270fd0b3accSchristos if (n == 0) \
271fd0b3accSchristos { \
272fd0b3accSchristos (loc).first_line = YYRHSLOC(rhs, 0).last_line; \
273fd0b3accSchristos (loc).first_column = YYRHSLOC(rhs, 0).last_column; \
274fd0b3accSchristos (loc).last_line = YYRHSLOC(rhs, 0).last_line; \
275fd0b3accSchristos (loc).last_column = YYRHSLOC(rhs, 0).last_column; \
276fd0b3accSchristos } \
277fd0b3accSchristos else \
278fd0b3accSchristos { \
279fd0b3accSchristos (loc).first_line = YYRHSLOC(rhs, 1).first_line; \
280fd0b3accSchristos (loc).first_column = YYRHSLOC(rhs, 1).first_column; \
281fd0b3accSchristos (loc).last_line = YYRHSLOC(rhs, n).last_line; \
282fd0b3accSchristos (loc).last_column = YYRHSLOC(rhs, n).last_column; \
283fd0b3accSchristos } \
284fd0b3accSchristos } while (0)
285fd0b3accSchristos #endif /* YYLLOC_DEFAULT */
286fd0b3accSchristos #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
287fd0b3accSchristos #if YYBTYACC
288fd0b3accSchristos
289fd0b3accSchristos #ifndef YYLVQUEUEGROWTH
290fd0b3accSchristos #define YYLVQUEUEGROWTH 32
291fd0b3accSchristos #endif
292fd0b3accSchristos #endif /* YYBTYACC */
293fd0b3accSchristos
294fd0b3accSchristos /* define the initial stack-sizes */
295fd0b3accSchristos #ifdef YYSTACKSIZE
296fd0b3accSchristos #undef YYMAXDEPTH
297fd0b3accSchristos #define YYMAXDEPTH YYSTACKSIZE
298fd0b3accSchristos #else
299fd0b3accSchristos #ifdef YYMAXDEPTH
300fd0b3accSchristos #define YYSTACKSIZE YYMAXDEPTH
301fd0b3accSchristos #else
302fd0b3accSchristos #define YYSTACKSIZE 10000
303fd0b3accSchristos #define YYMAXDEPTH 10000
304fd0b3accSchristos #endif
305fd0b3accSchristos #endif
306fd0b3accSchristos
307fd0b3accSchristos #ifndef YYINITSTACKSIZE
308fd0b3accSchristos #define YYINITSTACKSIZE 200
309fd0b3accSchristos #endif
310fd0b3accSchristos
311fd0b3accSchristos typedef struct {
312fd0b3accSchristos unsigned stacksize;
313fd0b3accSchristos YYINT *s_base;
314fd0b3accSchristos YYINT *s_mark;
315fd0b3accSchristos YYINT *s_last;
316fd0b3accSchristos YYSTYPE *l_base;
317fd0b3accSchristos YYSTYPE *l_mark;
318fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
319fd0b3accSchristos YYLTYPE *p_base;
320fd0b3accSchristos YYLTYPE *p_mark;
321fd0b3accSchristos #endif
322fd0b3accSchristos } YYSTACKDATA;
323fd0b3accSchristos #if YYBTYACC
324fd0b3accSchristos
325fd0b3accSchristos struct YYParseState_s
326fd0b3accSchristos {
327fd0b3accSchristos struct YYParseState_s *save; /* Previously saved parser state */
328fd0b3accSchristos YYSTACKDATA yystack; /* saved parser stack */
329fd0b3accSchristos int state; /* saved parser state */
330fd0b3accSchristos int errflag; /* saved error recovery status */
331fd0b3accSchristos int lexeme; /* saved index of the conflict lexeme in the lexical queue */
332fd0b3accSchristos YYINT ctry; /* saved index in yyctable[] for this conflict */
333fd0b3accSchristos };
334fd0b3accSchristos typedef struct YYParseState_s YYParseState;
335fd0b3accSchristos #endif /* YYBTYACC */
336fd0b3accSchristos /* variables for the parser stack */
337fd0b3accSchristos static YYSTACKDATA yystack;
338fd0b3accSchristos #if YYBTYACC
339fd0b3accSchristos
340fd0b3accSchristos /* Current parser state */
341fd0b3accSchristos static YYParseState *yyps = 0;
342fd0b3accSchristos
343fd0b3accSchristos /* yypath != NULL: do the full parse, starting at *yypath parser state. */
344fd0b3accSchristos static YYParseState *yypath = 0;
345fd0b3accSchristos
346fd0b3accSchristos /* Base of the lexical value queue */
347fd0b3accSchristos static YYSTYPE *yylvals = 0;
348fd0b3accSchristos
349fd0b3accSchristos /* Current position at lexical value queue */
350fd0b3accSchristos static YYSTYPE *yylvp = 0;
351fd0b3accSchristos
352fd0b3accSchristos /* End position of lexical value queue */
353fd0b3accSchristos static YYSTYPE *yylve = 0;
354fd0b3accSchristos
355fd0b3accSchristos /* The last allocated position at the lexical value queue */
356fd0b3accSchristos static YYSTYPE *yylvlim = 0;
357fd0b3accSchristos
358fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
359fd0b3accSchristos /* Base of the lexical position queue */
360fd0b3accSchristos static YYLTYPE *yylpsns = 0;
361fd0b3accSchristos
362fd0b3accSchristos /* Current position at lexical position queue */
363fd0b3accSchristos static YYLTYPE *yylpp = 0;
364fd0b3accSchristos
365fd0b3accSchristos /* End position of lexical position queue */
366fd0b3accSchristos static YYLTYPE *yylpe = 0;
367fd0b3accSchristos
368fd0b3accSchristos /* The last allocated position at the lexical position queue */
369fd0b3accSchristos static YYLTYPE *yylplim = 0;
370fd0b3accSchristos #endif
371fd0b3accSchristos
372fd0b3accSchristos /* Current position at lexical token queue */
373fd0b3accSchristos static YYINT *yylexp = 0;
374fd0b3accSchristos
375fd0b3accSchristos static YYINT *yylexemes = 0;
376fd0b3accSchristos #endif /* YYBTYACC */
377fd0b3accSchristos #line 66 "(null)"
378fd0b3accSchristos /* start of programs */
379fd0b3accSchristos
380fd0b3accSchristos int
main(void)381fd0b3accSchristos main (void)
382fd0b3accSchristos {
383fd0b3accSchristos while(!feof(stdin)) {
384fd0b3accSchristos yyparse();
385fd0b3accSchristos }
386fd0b3accSchristos return 0;
387fd0b3accSchristos }
388fd0b3accSchristos
389fd0b3accSchristos static void
yyerror(const char * s)390fd0b3accSchristos yyerror(const char *s)
391fd0b3accSchristos {
392fd0b3accSchristos fprintf(stderr, "%s\n", s);
393fd0b3accSchristos }
394fd0b3accSchristos
395fd0b3accSchristos int
yylex(void)396fd0b3accSchristos yylex(void)
397fd0b3accSchristos {
398fd0b3accSchristos /* lexical analysis routine */
399fd0b3accSchristos /* returns LETTER for a lower case letter, yylval = 0 through 25 */
400fd0b3accSchristos /* return DIGIT for a digit, yylval = 0 through 9 */
401fd0b3accSchristos /* all other characters are returned immediately */
402fd0b3accSchristos
403fd0b3accSchristos int c;
404fd0b3accSchristos
405fd0b3accSchristos while( (c=getchar()) == ' ' ) { /* skip blanks */ }
406fd0b3accSchristos
407fd0b3accSchristos /* c is now nonblank */
408fd0b3accSchristos
409fd0b3accSchristos if( islower( c )) {
410fd0b3accSchristos yylval = c - 'a';
411fd0b3accSchristos return ( LETTER );
412fd0b3accSchristos }
413fd0b3accSchristos if( isdigit( c )) {
414fd0b3accSchristos yylval = c - '0';
415fd0b3accSchristos return ( DIGIT );
416fd0b3accSchristos }
417fd0b3accSchristos return( c );
418fd0b3accSchristos }
419fd0b3accSchristos #line 418 "stdin1.calc.c"
420fd0b3accSchristos
421fd0b3accSchristos /* For use in generated program */
422fd0b3accSchristos #define yydepth (int)(yystack.s_mark - yystack.s_base)
423fd0b3accSchristos #if YYBTYACC
424fd0b3accSchristos #define yytrial (yyps->save)
425fd0b3accSchristos #endif /* YYBTYACC */
426fd0b3accSchristos
427fd0b3accSchristos #if YYDEBUG
428fd0b3accSchristos #include <stdio.h> /* needed for printf */
429fd0b3accSchristos #endif
430fd0b3accSchristos
431fd0b3accSchristos #include <stdlib.h> /* needed for malloc, etc */
432fd0b3accSchristos #include <string.h> /* needed for memset */
433fd0b3accSchristos
434fd0b3accSchristos /* allocate initial stack or double stack size, up to YYMAXDEPTH */
yygrowstack(YYSTACKDATA * data)435fd0b3accSchristos static int yygrowstack(YYSTACKDATA *data)
436fd0b3accSchristos {
437fd0b3accSchristos int i;
438fd0b3accSchristos unsigned newsize;
439fd0b3accSchristos YYINT *newss;
440fd0b3accSchristos YYSTYPE *newvs;
441fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
442fd0b3accSchristos YYLTYPE *newps;
443fd0b3accSchristos #endif
444fd0b3accSchristos
445fd0b3accSchristos if ((newsize = data->stacksize) == 0)
446fd0b3accSchristos newsize = YYINITSTACKSIZE;
447fd0b3accSchristos else if (newsize >= YYMAXDEPTH)
448fd0b3accSchristos return YYENOMEM;
449fd0b3accSchristos else if ((newsize *= 2) > YYMAXDEPTH)
450fd0b3accSchristos newsize = YYMAXDEPTH;
451fd0b3accSchristos
452fd0b3accSchristos i = (int) (data->s_mark - data->s_base);
453fd0b3accSchristos newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
454fd0b3accSchristos if (newss == 0)
455fd0b3accSchristos return YYENOMEM;
456fd0b3accSchristos
457fd0b3accSchristos data->s_base = newss;
458fd0b3accSchristos data->s_mark = newss + i;
459fd0b3accSchristos
460fd0b3accSchristos newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
461fd0b3accSchristos if (newvs == 0)
462fd0b3accSchristos return YYENOMEM;
463fd0b3accSchristos
464fd0b3accSchristos data->l_base = newvs;
465fd0b3accSchristos data->l_mark = newvs + i;
466fd0b3accSchristos
467fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
468fd0b3accSchristos newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
469fd0b3accSchristos if (newps == 0)
470fd0b3accSchristos return YYENOMEM;
471fd0b3accSchristos
472fd0b3accSchristos data->p_base = newps;
473fd0b3accSchristos data->p_mark = newps + i;
474fd0b3accSchristos #endif
475fd0b3accSchristos
476fd0b3accSchristos data->stacksize = newsize;
477fd0b3accSchristos data->s_last = data->s_base + newsize - 1;
478fd0b3accSchristos
479fd0b3accSchristos #if YYDEBUG
480fd0b3accSchristos if (yydebug)
481fd0b3accSchristos fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
482fd0b3accSchristos #endif
483fd0b3accSchristos return 0;
484fd0b3accSchristos }
485fd0b3accSchristos
486fd0b3accSchristos #if YYPURE || defined(YY_NO_LEAKS)
yyfreestack(YYSTACKDATA * data)487fd0b3accSchristos static void yyfreestack(YYSTACKDATA *data)
488fd0b3accSchristos {
489fd0b3accSchristos free(data->s_base);
490fd0b3accSchristos free(data->l_base);
491fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
492fd0b3accSchristos free(data->p_base);
493fd0b3accSchristos #endif
494fd0b3accSchristos memset(data, 0, sizeof(*data));
495fd0b3accSchristos }
496fd0b3accSchristos #else
497fd0b3accSchristos #define yyfreestack(data) /* nothing */
498fd0b3accSchristos #endif /* YYPURE || defined(YY_NO_LEAKS) */
499fd0b3accSchristos #if YYBTYACC
500fd0b3accSchristos
501fd0b3accSchristos static YYParseState *
yyNewState(unsigned size)502fd0b3accSchristos yyNewState(unsigned size)
503fd0b3accSchristos {
504fd0b3accSchristos YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
505fd0b3accSchristos if (p == NULL) return NULL;
506fd0b3accSchristos
507fd0b3accSchristos p->yystack.stacksize = size;
508fd0b3accSchristos if (size == 0)
509fd0b3accSchristos {
510fd0b3accSchristos p->yystack.s_base = NULL;
511fd0b3accSchristos p->yystack.l_base = NULL;
512fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
513fd0b3accSchristos p->yystack.p_base = NULL;
514fd0b3accSchristos #endif
515fd0b3accSchristos return p;
516fd0b3accSchristos }
517fd0b3accSchristos p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT));
518fd0b3accSchristos if (p->yystack.s_base == NULL) return NULL;
519fd0b3accSchristos p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
520fd0b3accSchristos if (p->yystack.l_base == NULL) return NULL;
521fd0b3accSchristos memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
522fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
523fd0b3accSchristos p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
524fd0b3accSchristos if (p->yystack.p_base == NULL) return NULL;
525fd0b3accSchristos memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
526fd0b3accSchristos #endif
527fd0b3accSchristos
528fd0b3accSchristos return p;
529fd0b3accSchristos }
530fd0b3accSchristos
531fd0b3accSchristos static void
yyFreeState(YYParseState * p)532fd0b3accSchristos yyFreeState(YYParseState *p)
533fd0b3accSchristos {
534fd0b3accSchristos yyfreestack(&p->yystack);
535fd0b3accSchristos free(p);
536fd0b3accSchristos }
537fd0b3accSchristos #endif /* YYBTYACC */
538fd0b3accSchristos
539fd0b3accSchristos #define YYABORT goto yyabort
540fd0b3accSchristos #define YYREJECT goto yyabort
541fd0b3accSchristos #define YYACCEPT goto yyaccept
542fd0b3accSchristos #define YYERROR goto yyerrlab
543fd0b3accSchristos #if YYBTYACC
544fd0b3accSchristos #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
545fd0b3accSchristos #define YYVALID_NESTED do { if (yyps->save && \
546fd0b3accSchristos yyps->save->save == 0) goto yyvalid; } while(0)
547fd0b3accSchristos #endif /* YYBTYACC */
548fd0b3accSchristos
549fd0b3accSchristos int
YYPARSE_DECL()550fd0b3accSchristos YYPARSE_DECL()
551fd0b3accSchristos {
552fd0b3accSchristos int yym, yyn, yystate, yyresult;
553fd0b3accSchristos #if YYBTYACC
554fd0b3accSchristos int yynewerrflag;
555fd0b3accSchristos YYParseState *yyerrctx = NULL;
556fd0b3accSchristos #endif /* YYBTYACC */
557fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
558fd0b3accSchristos YYLTYPE yyerror_loc_range[3]; /* position of error start/end (0 unused) */
559fd0b3accSchristos #endif
560fd0b3accSchristos #if YYDEBUG
561fd0b3accSchristos const char *yys;
562fd0b3accSchristos
563fd0b3accSchristos if ((yys = getenv("YYDEBUG")) != 0)
564fd0b3accSchristos {
565fd0b3accSchristos yyn = *yys;
566fd0b3accSchristos if (yyn >= '0' && yyn <= '9')
567fd0b3accSchristos yydebug = yyn - '0';
568fd0b3accSchristos }
569fd0b3accSchristos if (yydebug)
570fd0b3accSchristos fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
571fd0b3accSchristos #endif
572fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
573fd0b3accSchristos memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
574fd0b3accSchristos #endif
575fd0b3accSchristos
576fd0b3accSchristos #if YYBTYACC
577fd0b3accSchristos yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
578fd0b3accSchristos yyps->save = 0;
579fd0b3accSchristos #endif /* YYBTYACC */
580fd0b3accSchristos yym = 0;
581fd0b3accSchristos yyn = 0;
582fd0b3accSchristos yynerrs = 0;
583fd0b3accSchristos yyerrflag = 0;
584fd0b3accSchristos yychar = YYEMPTY;
585fd0b3accSchristos yystate = 0;
586fd0b3accSchristos
587fd0b3accSchristos #if YYPURE
588fd0b3accSchristos memset(&yystack, 0, sizeof(yystack));
589fd0b3accSchristos #endif
590fd0b3accSchristos
591fd0b3accSchristos if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
592fd0b3accSchristos yystack.s_mark = yystack.s_base;
593fd0b3accSchristos yystack.l_mark = yystack.l_base;
594fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
595fd0b3accSchristos yystack.p_mark = yystack.p_base;
596fd0b3accSchristos #endif
597fd0b3accSchristos yystate = 0;
598fd0b3accSchristos *yystack.s_mark = 0;
599fd0b3accSchristos
600fd0b3accSchristos yyloop:
601fd0b3accSchristos if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
602fd0b3accSchristos if (yychar < 0)
603fd0b3accSchristos {
604fd0b3accSchristos #if YYBTYACC
605fd0b3accSchristos do {
606fd0b3accSchristos if (yylvp < yylve)
607fd0b3accSchristos {
608fd0b3accSchristos /* we're currently re-reading tokens */
609fd0b3accSchristos yylval = *yylvp++;
610fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
611fd0b3accSchristos yylloc = *yylpp++;
612fd0b3accSchristos #endif
613fd0b3accSchristos yychar = *yylexp++;
614fd0b3accSchristos break;
615fd0b3accSchristos }
616fd0b3accSchristos if (yyps->save)
617fd0b3accSchristos {
618fd0b3accSchristos /* in trial mode; save scanner results for future parse attempts */
619fd0b3accSchristos if (yylvp == yylvlim)
620fd0b3accSchristos { /* Enlarge lexical value queue */
621fd0b3accSchristos size_t p = (size_t) (yylvp - yylvals);
622fd0b3accSchristos size_t s = (size_t) (yylvlim - yylvals);
623fd0b3accSchristos
624fd0b3accSchristos s += YYLVQUEUEGROWTH;
625fd0b3accSchristos if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
626fd0b3accSchristos if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
627fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
628fd0b3accSchristos if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
629fd0b3accSchristos #endif
630fd0b3accSchristos yylvp = yylve = yylvals + p;
631fd0b3accSchristos yylvlim = yylvals + s;
632fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
633fd0b3accSchristos yylpp = yylpe = yylpsns + p;
634fd0b3accSchristos yylplim = yylpsns + s;
635fd0b3accSchristos #endif
636fd0b3accSchristos yylexp = yylexemes + p;
637fd0b3accSchristos }
638fd0b3accSchristos *yylexp = (YYINT) YYLEX;
639fd0b3accSchristos *yylvp++ = yylval;
640fd0b3accSchristos yylve++;
641fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
642fd0b3accSchristos *yylpp++ = yylloc;
643fd0b3accSchristos yylpe++;
644fd0b3accSchristos #endif
645fd0b3accSchristos yychar = *yylexp++;
646fd0b3accSchristos break;
647fd0b3accSchristos }
648fd0b3accSchristos /* normal operation, no conflict encountered */
649fd0b3accSchristos #endif /* YYBTYACC */
650fd0b3accSchristos yychar = YYLEX;
651fd0b3accSchristos #if YYBTYACC
652fd0b3accSchristos } while (0);
653fd0b3accSchristos #endif /* YYBTYACC */
654fd0b3accSchristos if (yychar < 0) yychar = YYEOF;
655fd0b3accSchristos #if YYDEBUG
656fd0b3accSchristos if (yydebug)
657fd0b3accSchristos {
658fd0b3accSchristos if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
659fd0b3accSchristos fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
660fd0b3accSchristos YYDEBUGSTR, yydepth, yystate, yychar, yys);
661fd0b3accSchristos #ifdef YYSTYPE_TOSTRING
662fd0b3accSchristos #if YYBTYACC
663fd0b3accSchristos if (!yytrial)
664fd0b3accSchristos #endif /* YYBTYACC */
665fd0b3accSchristos fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
666fd0b3accSchristos #endif
667fd0b3accSchristos fputc('\n', stderr);
668fd0b3accSchristos }
669fd0b3accSchristos #endif
670fd0b3accSchristos }
671fd0b3accSchristos #if YYBTYACC
672fd0b3accSchristos
673fd0b3accSchristos /* Do we have a conflict? */
674fd0b3accSchristos if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
675fd0b3accSchristos yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
676fd0b3accSchristos {
677fd0b3accSchristos YYINT ctry;
678fd0b3accSchristos
679fd0b3accSchristos if (yypath)
680fd0b3accSchristos {
681fd0b3accSchristos YYParseState *save;
682fd0b3accSchristos #if YYDEBUG
683fd0b3accSchristos if (yydebug)
684fd0b3accSchristos fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
685fd0b3accSchristos YYDEBUGSTR, yydepth, yystate);
686fd0b3accSchristos #endif
687fd0b3accSchristos /* Switch to the next conflict context */
688fd0b3accSchristos save = yypath;
689fd0b3accSchristos yypath = save->save;
690fd0b3accSchristos save->save = NULL;
691fd0b3accSchristos ctry = save->ctry;
692fd0b3accSchristos if (save->state != yystate) YYABORT;
693fd0b3accSchristos yyFreeState(save);
694fd0b3accSchristos
695fd0b3accSchristos }
696fd0b3accSchristos else
697fd0b3accSchristos {
698fd0b3accSchristos
699fd0b3accSchristos /* Unresolved conflict - start/continue trial parse */
700fd0b3accSchristos YYParseState *save;
701fd0b3accSchristos #if YYDEBUG
702fd0b3accSchristos if (yydebug)
703fd0b3accSchristos {
704fd0b3accSchristos fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
705fd0b3accSchristos if (yyps->save)
706fd0b3accSchristos fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
707fd0b3accSchristos else
708fd0b3accSchristos fputs("Starting trial parse.\n", stderr);
709fd0b3accSchristos }
710fd0b3accSchristos #endif
711fd0b3accSchristos save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
712fd0b3accSchristos if (save == NULL) goto yyenomem;
713fd0b3accSchristos save->save = yyps->save;
714fd0b3accSchristos save->state = yystate;
715fd0b3accSchristos save->errflag = yyerrflag;
716fd0b3accSchristos save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
717fd0b3accSchristos memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
718fd0b3accSchristos save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
719fd0b3accSchristos memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
720fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
721fd0b3accSchristos save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
722fd0b3accSchristos memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
723fd0b3accSchristos #endif
724fd0b3accSchristos ctry = yytable[yyn];
725fd0b3accSchristos if (yyctable[ctry] == -1)
726fd0b3accSchristos {
727fd0b3accSchristos #if YYDEBUG
728fd0b3accSchristos if (yydebug && yychar >= YYEOF)
729fd0b3accSchristos fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
730fd0b3accSchristos #endif
731fd0b3accSchristos ctry++;
732fd0b3accSchristos }
733fd0b3accSchristos save->ctry = ctry;
734fd0b3accSchristos if (yyps->save == NULL)
735fd0b3accSchristos {
736fd0b3accSchristos /* If this is a first conflict in the stack, start saving lexemes */
737fd0b3accSchristos if (!yylexemes)
738fd0b3accSchristos {
739fd0b3accSchristos yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
740fd0b3accSchristos if (yylexemes == NULL) goto yyenomem;
741fd0b3accSchristos yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
742fd0b3accSchristos if (yylvals == NULL) goto yyenomem;
743fd0b3accSchristos yylvlim = yylvals + YYLVQUEUEGROWTH;
744fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
745fd0b3accSchristos yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
746fd0b3accSchristos if (yylpsns == NULL) goto yyenomem;
747fd0b3accSchristos yylplim = yylpsns + YYLVQUEUEGROWTH;
748fd0b3accSchristos #endif
749fd0b3accSchristos }
750fd0b3accSchristos if (yylvp == yylve)
751fd0b3accSchristos {
752fd0b3accSchristos yylvp = yylve = yylvals;
753fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
754fd0b3accSchristos yylpp = yylpe = yylpsns;
755fd0b3accSchristos #endif
756fd0b3accSchristos yylexp = yylexemes;
757fd0b3accSchristos if (yychar >= YYEOF)
758fd0b3accSchristos {
759fd0b3accSchristos *yylve++ = yylval;
760fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
761fd0b3accSchristos *yylpe++ = yylloc;
762fd0b3accSchristos #endif
763fd0b3accSchristos *yylexp = (YYINT) yychar;
764fd0b3accSchristos yychar = YYEMPTY;
765fd0b3accSchristos }
766fd0b3accSchristos }
767fd0b3accSchristos }
768fd0b3accSchristos if (yychar >= YYEOF)
769fd0b3accSchristos {
770fd0b3accSchristos yylvp--;
771fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
772fd0b3accSchristos yylpp--;
773fd0b3accSchristos #endif
774fd0b3accSchristos yylexp--;
775fd0b3accSchristos yychar = YYEMPTY;
776fd0b3accSchristos }
777fd0b3accSchristos save->lexeme = (int) (yylvp - yylvals);
778fd0b3accSchristos yyps->save = save;
779fd0b3accSchristos }
780fd0b3accSchristos if (yytable[yyn] == ctry)
781fd0b3accSchristos {
782fd0b3accSchristos #if YYDEBUG
783fd0b3accSchristos if (yydebug)
784fd0b3accSchristos fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
785fd0b3accSchristos YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
786fd0b3accSchristos #endif
787fd0b3accSchristos if (yychar < 0)
788fd0b3accSchristos {
789fd0b3accSchristos yylvp++;
790fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
791fd0b3accSchristos yylpp++;
792fd0b3accSchristos #endif
793fd0b3accSchristos yylexp++;
794fd0b3accSchristos }
795fd0b3accSchristos if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
796fd0b3accSchristos goto yyoverflow;
797fd0b3accSchristos yystate = yyctable[ctry];
798fd0b3accSchristos *++yystack.s_mark = (YYINT) yystate;
799fd0b3accSchristos *++yystack.l_mark = yylval;
800fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
801fd0b3accSchristos *++yystack.p_mark = yylloc;
802fd0b3accSchristos #endif
803fd0b3accSchristos yychar = YYEMPTY;
804fd0b3accSchristos if (yyerrflag > 0) --yyerrflag;
805fd0b3accSchristos goto yyloop;
806fd0b3accSchristos }
807fd0b3accSchristos else
808fd0b3accSchristos {
809fd0b3accSchristos yyn = yyctable[ctry];
810fd0b3accSchristos goto yyreduce;
811fd0b3accSchristos }
812fd0b3accSchristos } /* End of code dealing with conflicts */
813fd0b3accSchristos #endif /* YYBTYACC */
814fd0b3accSchristos if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
815fd0b3accSchristos yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
816fd0b3accSchristos {
817fd0b3accSchristos #if YYDEBUG
818fd0b3accSchristos if (yydebug)
819fd0b3accSchristos fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
820fd0b3accSchristos YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
821fd0b3accSchristos #endif
822fd0b3accSchristos if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
823fd0b3accSchristos yystate = yytable[yyn];
824fd0b3accSchristos *++yystack.s_mark = yytable[yyn];
825fd0b3accSchristos *++yystack.l_mark = yylval;
826fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
827fd0b3accSchristos *++yystack.p_mark = yylloc;
828fd0b3accSchristos #endif
829fd0b3accSchristos yychar = YYEMPTY;
830fd0b3accSchristos if (yyerrflag > 0) --yyerrflag;
831fd0b3accSchristos goto yyloop;
832fd0b3accSchristos }
833fd0b3accSchristos if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
834fd0b3accSchristos yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
835fd0b3accSchristos {
836fd0b3accSchristos yyn = yytable[yyn];
837fd0b3accSchristos goto yyreduce;
838fd0b3accSchristos }
839fd0b3accSchristos if (yyerrflag != 0) goto yyinrecovery;
840fd0b3accSchristos #if YYBTYACC
841fd0b3accSchristos
842fd0b3accSchristos yynewerrflag = 1;
843fd0b3accSchristos goto yyerrhandler;
844fd0b3accSchristos goto yyerrlab; /* redundant goto avoids 'unused label' warning */
845fd0b3accSchristos
846fd0b3accSchristos yyerrlab:
847fd0b3accSchristos /* explicit YYERROR from an action -- pop the rhs of the rule reduced
848fd0b3accSchristos * before looking for error recovery */
849fd0b3accSchristos yystack.s_mark -= yym;
850fd0b3accSchristos yystate = *yystack.s_mark;
851fd0b3accSchristos yystack.l_mark -= yym;
852fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
853fd0b3accSchristos yystack.p_mark -= yym;
854fd0b3accSchristos #endif
855fd0b3accSchristos
856fd0b3accSchristos yynewerrflag = 0;
857fd0b3accSchristos yyerrhandler:
858fd0b3accSchristos while (yyps->save)
859fd0b3accSchristos {
860fd0b3accSchristos int ctry;
861fd0b3accSchristos YYParseState *save = yyps->save;
862fd0b3accSchristos #if YYDEBUG
863fd0b3accSchristos if (yydebug)
864fd0b3accSchristos fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
865fd0b3accSchristos YYDEBUGSTR, yydepth, yystate, yyps->save->state,
866fd0b3accSchristos (int)(yylvp - yylvals - yyps->save->lexeme));
867fd0b3accSchristos #endif
868fd0b3accSchristos /* Memorize most forward-looking error state in case it's really an error. */
869fd0b3accSchristos if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
870fd0b3accSchristos {
871fd0b3accSchristos /* Free old saved error context state */
872fd0b3accSchristos if (yyerrctx) yyFreeState(yyerrctx);
873fd0b3accSchristos /* Create and fill out new saved error context state */
874fd0b3accSchristos yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
875fd0b3accSchristos if (yyerrctx == NULL) goto yyenomem;
876fd0b3accSchristos yyerrctx->save = yyps->save;
877fd0b3accSchristos yyerrctx->state = yystate;
878fd0b3accSchristos yyerrctx->errflag = yyerrflag;
879fd0b3accSchristos yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
880fd0b3accSchristos memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
881fd0b3accSchristos yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
882fd0b3accSchristos memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
883fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
884fd0b3accSchristos yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
885fd0b3accSchristos memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
886fd0b3accSchristos #endif
887fd0b3accSchristos yyerrctx->lexeme = (int) (yylvp - yylvals);
888fd0b3accSchristos }
889fd0b3accSchristos yylvp = yylvals + save->lexeme;
890fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
891fd0b3accSchristos yylpp = yylpsns + save->lexeme;
892fd0b3accSchristos #endif
893fd0b3accSchristos yylexp = yylexemes + save->lexeme;
894fd0b3accSchristos yychar = YYEMPTY;
895fd0b3accSchristos yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
896fd0b3accSchristos memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
897fd0b3accSchristos yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
898fd0b3accSchristos memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
899fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
900fd0b3accSchristos yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
901fd0b3accSchristos memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
902fd0b3accSchristos #endif
903fd0b3accSchristos ctry = ++save->ctry;
904fd0b3accSchristos yystate = save->state;
905fd0b3accSchristos /* We tried shift, try reduce now */
906fd0b3accSchristos if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
907fd0b3accSchristos yyps->save = save->save;
908fd0b3accSchristos save->save = NULL;
909fd0b3accSchristos yyFreeState(save);
910fd0b3accSchristos
911fd0b3accSchristos /* Nothing left on the stack -- error */
912fd0b3accSchristos if (!yyps->save)
913fd0b3accSchristos {
914fd0b3accSchristos #if YYDEBUG
915fd0b3accSchristos if (yydebug)
916fd0b3accSchristos fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
917fd0b3accSchristos YYPREFIX, yydepth);
918fd0b3accSchristos #endif
919fd0b3accSchristos /* Restore state as it was in the most forward-advanced error */
920fd0b3accSchristos yylvp = yylvals + yyerrctx->lexeme;
921fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
922fd0b3accSchristos yylpp = yylpsns + yyerrctx->lexeme;
923fd0b3accSchristos #endif
924fd0b3accSchristos yylexp = yylexemes + yyerrctx->lexeme;
925fd0b3accSchristos yychar = yylexp[-1];
926fd0b3accSchristos yylval = yylvp[-1];
927fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
928fd0b3accSchristos yylloc = yylpp[-1];
929fd0b3accSchristos #endif
930fd0b3accSchristos yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
931fd0b3accSchristos memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
932fd0b3accSchristos yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
933fd0b3accSchristos memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
934fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
935fd0b3accSchristos yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
936fd0b3accSchristos memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
937fd0b3accSchristos #endif
938fd0b3accSchristos yystate = yyerrctx->state;
939fd0b3accSchristos yyFreeState(yyerrctx);
940fd0b3accSchristos yyerrctx = NULL;
941fd0b3accSchristos }
942fd0b3accSchristos yynewerrflag = 1;
943fd0b3accSchristos }
944fd0b3accSchristos if (yynewerrflag == 0) goto yyinrecovery;
945fd0b3accSchristos #endif /* YYBTYACC */
946fd0b3accSchristos
947fd0b3accSchristos YYERROR_CALL("syntax error");
948fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
949fd0b3accSchristos yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
950fd0b3accSchristos #endif
951fd0b3accSchristos
952fd0b3accSchristos #if !YYBTYACC
953fd0b3accSchristos goto yyerrlab; /* redundant goto avoids 'unused label' warning */
954fd0b3accSchristos yyerrlab:
955fd0b3accSchristos #endif
956fd0b3accSchristos ++yynerrs;
957fd0b3accSchristos
958fd0b3accSchristos yyinrecovery:
959fd0b3accSchristos if (yyerrflag < 3)
960fd0b3accSchristos {
961fd0b3accSchristos yyerrflag = 3;
962fd0b3accSchristos for (;;)
963fd0b3accSchristos {
964fd0b3accSchristos if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
965fd0b3accSchristos yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
966fd0b3accSchristos {
967fd0b3accSchristos #if YYDEBUG
968fd0b3accSchristos if (yydebug)
969fd0b3accSchristos fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
970fd0b3accSchristos YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
971fd0b3accSchristos #endif
972fd0b3accSchristos if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
973fd0b3accSchristos yystate = yytable[yyn];
974fd0b3accSchristos *++yystack.s_mark = yytable[yyn];
975fd0b3accSchristos *++yystack.l_mark = yylval;
976fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
977fd0b3accSchristos /* lookahead position is error end position */
978fd0b3accSchristos yyerror_loc_range[2] = yylloc;
979fd0b3accSchristos YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
980fd0b3accSchristos *++yystack.p_mark = yyloc;
981fd0b3accSchristos #endif
982fd0b3accSchristos goto yyloop;
983fd0b3accSchristos }
984fd0b3accSchristos else
985fd0b3accSchristos {
986fd0b3accSchristos #if YYDEBUG
987fd0b3accSchristos if (yydebug)
988fd0b3accSchristos fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
989fd0b3accSchristos YYDEBUGSTR, yydepth, *yystack.s_mark);
990fd0b3accSchristos #endif
991fd0b3accSchristos if (yystack.s_mark <= yystack.s_base) goto yyabort;
992fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
993fd0b3accSchristos /* the current TOS position is the error start position */
994fd0b3accSchristos yyerror_loc_range[1] = *yystack.p_mark;
995fd0b3accSchristos #endif
996fd0b3accSchristos #if defined(YYDESTRUCT_CALL)
997fd0b3accSchristos #if YYBTYACC
998fd0b3accSchristos if (!yytrial)
999fd0b3accSchristos #endif /* YYBTYACC */
1000fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1001fd0b3accSchristos YYDESTRUCT_CALL("error: discarding state",
1002fd0b3accSchristos yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
1003fd0b3accSchristos #else
1004fd0b3accSchristos YYDESTRUCT_CALL("error: discarding state",
1005fd0b3accSchristos yystos[*yystack.s_mark], yystack.l_mark);
1006fd0b3accSchristos #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1007fd0b3accSchristos #endif /* defined(YYDESTRUCT_CALL) */
1008fd0b3accSchristos --yystack.s_mark;
1009fd0b3accSchristos --yystack.l_mark;
1010fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1011fd0b3accSchristos --yystack.p_mark;
1012fd0b3accSchristos #endif
1013fd0b3accSchristos }
1014fd0b3accSchristos }
1015fd0b3accSchristos }
1016fd0b3accSchristos else
1017fd0b3accSchristos {
1018fd0b3accSchristos if (yychar == YYEOF) goto yyabort;
1019fd0b3accSchristos #if YYDEBUG
1020fd0b3accSchristos if (yydebug)
1021fd0b3accSchristos {
1022fd0b3accSchristos if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1023fd0b3accSchristos fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
1024fd0b3accSchristos YYDEBUGSTR, yydepth, yystate, yychar, yys);
1025fd0b3accSchristos }
1026fd0b3accSchristos #endif
1027fd0b3accSchristos #if defined(YYDESTRUCT_CALL)
1028fd0b3accSchristos #if YYBTYACC
1029fd0b3accSchristos if (!yytrial)
1030fd0b3accSchristos #endif /* YYBTYACC */
1031fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1032fd0b3accSchristos YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
1033fd0b3accSchristos #else
1034fd0b3accSchristos YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
1035fd0b3accSchristos #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1036fd0b3accSchristos #endif /* defined(YYDESTRUCT_CALL) */
1037fd0b3accSchristos yychar = YYEMPTY;
1038fd0b3accSchristos goto yyloop;
1039fd0b3accSchristos }
1040fd0b3accSchristos
1041fd0b3accSchristos yyreduce:
1042fd0b3accSchristos yym = yylen[yyn];
1043fd0b3accSchristos #if YYDEBUG
1044fd0b3accSchristos if (yydebug)
1045fd0b3accSchristos {
1046fd0b3accSchristos fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1047fd0b3accSchristos YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1048fd0b3accSchristos #ifdef YYSTYPE_TOSTRING
1049fd0b3accSchristos #if YYBTYACC
1050fd0b3accSchristos if (!yytrial)
1051fd0b3accSchristos #endif /* YYBTYACC */
1052fd0b3accSchristos if (yym > 0)
1053fd0b3accSchristos {
1054fd0b3accSchristos int i;
1055fd0b3accSchristos fputc('<', stderr);
1056fd0b3accSchristos for (i = yym; i > 0; i--)
1057fd0b3accSchristos {
1058fd0b3accSchristos if (i != yym) fputs(", ", stderr);
1059fd0b3accSchristos fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1060fd0b3accSchristos yystack.l_mark[1-i]), stderr);
1061fd0b3accSchristos }
1062fd0b3accSchristos fputc('>', stderr);
1063fd0b3accSchristos }
1064fd0b3accSchristos #endif
1065fd0b3accSchristos fputc('\n', stderr);
1066fd0b3accSchristos }
1067fd0b3accSchristos #endif
1068fd0b3accSchristos if (yym > 0)
1069fd0b3accSchristos yyval = yystack.l_mark[1-yym];
1070fd0b3accSchristos else
1071fd0b3accSchristos memset(&yyval, 0, sizeof yyval);
1072fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1073fd0b3accSchristos
1074fd0b3accSchristos /* Perform position reduction */
1075fd0b3accSchristos memset(&yyloc, 0, sizeof(yyloc));
1076fd0b3accSchristos #if YYBTYACC
1077fd0b3accSchristos if (!yytrial)
1078fd0b3accSchristos #endif /* YYBTYACC */
1079fd0b3accSchristos {
1080fd0b3accSchristos YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
1081fd0b3accSchristos /* just in case YYERROR is invoked within the action, save
1082fd0b3accSchristos the start of the rhs as the error start position */
1083fd0b3accSchristos yyerror_loc_range[1] = yystack.p_mark[1-yym];
1084fd0b3accSchristos }
1085fd0b3accSchristos #endif
1086fd0b3accSchristos
1087fd0b3accSchristos switch (yyn)
1088fd0b3accSchristos {
1089fd0b3accSchristos case 3:
1090fd0b3accSchristos #line 28 "(null)"
1091fd0b3accSchristos { yyerrok ; }
1092fd0b3accSchristos break;
1093fd0b3accSchristos case 4:
1094fd0b3accSchristos #line 32 "(null)"
1095fd0b3accSchristos { printf("%d\n",yystack.l_mark[0]);}
1096fd0b3accSchristos break;
1097fd0b3accSchristos case 5:
1098fd0b3accSchristos #line 34 "(null)"
1099fd0b3accSchristos { regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
1100fd0b3accSchristos break;
1101fd0b3accSchristos case 6:
1102fd0b3accSchristos #line 38 "(null)"
1103fd0b3accSchristos { yyval = yystack.l_mark[-1]; }
1104fd0b3accSchristos break;
1105fd0b3accSchristos case 7:
1106fd0b3accSchristos #line 40 "(null)"
1107fd0b3accSchristos { yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
1108fd0b3accSchristos break;
1109fd0b3accSchristos case 8:
1110fd0b3accSchristos #line 42 "(null)"
1111fd0b3accSchristos { yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
1112fd0b3accSchristos break;
1113fd0b3accSchristos case 9:
1114fd0b3accSchristos #line 44 "(null)"
1115fd0b3accSchristos { yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
1116fd0b3accSchristos break;
1117fd0b3accSchristos case 10:
1118fd0b3accSchristos #line 46 "(null)"
1119fd0b3accSchristos { yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
1120fd0b3accSchristos break;
1121fd0b3accSchristos case 11:
1122fd0b3accSchristos #line 48 "(null)"
1123fd0b3accSchristos { yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
1124fd0b3accSchristos break;
1125fd0b3accSchristos case 12:
1126fd0b3accSchristos #line 50 "(null)"
1127fd0b3accSchristos { yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
1128fd0b3accSchristos break;
1129fd0b3accSchristos case 13:
1130fd0b3accSchristos #line 52 "(null)"
1131fd0b3accSchristos { yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
1132fd0b3accSchristos break;
1133fd0b3accSchristos case 14:
1134fd0b3accSchristos #line 54 "(null)"
1135fd0b3accSchristos { yyval = - yystack.l_mark[0]; }
1136fd0b3accSchristos break;
1137fd0b3accSchristos case 15:
1138fd0b3accSchristos #line 56 "(null)"
1139fd0b3accSchristos { yyval = regs[yystack.l_mark[0]]; }
1140fd0b3accSchristos break;
1141fd0b3accSchristos case 17:
1142fd0b3accSchristos #line 61 "(null)"
1143fd0b3accSchristos { yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; }
1144fd0b3accSchristos break;
1145fd0b3accSchristos case 18:
1146fd0b3accSchristos #line 63 "(null)"
1147fd0b3accSchristos { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
1148fd0b3accSchristos break;
1149fd0b3accSchristos #line 1148 "stdin1.calc.c"
1150fd0b3accSchristos default:
1151fd0b3accSchristos break;
1152fd0b3accSchristos }
1153fd0b3accSchristos yystack.s_mark -= yym;
1154fd0b3accSchristos yystate = *yystack.s_mark;
1155fd0b3accSchristos yystack.l_mark -= yym;
1156fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1157fd0b3accSchristos yystack.p_mark -= yym;
1158fd0b3accSchristos #endif
1159fd0b3accSchristos yym = yylhs[yyn];
1160fd0b3accSchristos if (yystate == 0 && yym == 0)
1161fd0b3accSchristos {
1162fd0b3accSchristos #if YYDEBUG
1163fd0b3accSchristos if (yydebug)
1164fd0b3accSchristos {
1165fd0b3accSchristos fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1166fd0b3accSchristos #ifdef YYSTYPE_TOSTRING
1167fd0b3accSchristos #if YYBTYACC
1168fd0b3accSchristos if (!yytrial)
1169fd0b3accSchristos #endif /* YYBTYACC */
1170fd0b3accSchristos fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
1171fd0b3accSchristos #endif
1172fd0b3accSchristos fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
1173fd0b3accSchristos }
1174fd0b3accSchristos #endif
1175fd0b3accSchristos yystate = YYFINAL;
1176fd0b3accSchristos *++yystack.s_mark = YYFINAL;
1177fd0b3accSchristos *++yystack.l_mark = yyval;
1178fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1179fd0b3accSchristos *++yystack.p_mark = yyloc;
1180fd0b3accSchristos #endif
1181fd0b3accSchristos if (yychar < 0)
1182fd0b3accSchristos {
1183fd0b3accSchristos #if YYBTYACC
1184fd0b3accSchristos do {
1185fd0b3accSchristos if (yylvp < yylve)
1186fd0b3accSchristos {
1187fd0b3accSchristos /* we're currently re-reading tokens */
1188fd0b3accSchristos yylval = *yylvp++;
1189fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1190fd0b3accSchristos yylloc = *yylpp++;
1191fd0b3accSchristos #endif
1192fd0b3accSchristos yychar = *yylexp++;
1193fd0b3accSchristos break;
1194fd0b3accSchristos }
1195fd0b3accSchristos if (yyps->save)
1196fd0b3accSchristos {
1197fd0b3accSchristos /* in trial mode; save scanner results for future parse attempts */
1198fd0b3accSchristos if (yylvp == yylvlim)
1199fd0b3accSchristos { /* Enlarge lexical value queue */
1200fd0b3accSchristos size_t p = (size_t) (yylvp - yylvals);
1201fd0b3accSchristos size_t s = (size_t) (yylvlim - yylvals);
1202fd0b3accSchristos
1203fd0b3accSchristos s += YYLVQUEUEGROWTH;
1204fd0b3accSchristos if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
1205fd0b3accSchristos goto yyenomem;
1206fd0b3accSchristos if ((yylvals = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
1207fd0b3accSchristos goto yyenomem;
1208fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1209fd0b3accSchristos if ((yylpsns = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
1210fd0b3accSchristos goto yyenomem;
1211fd0b3accSchristos #endif
1212fd0b3accSchristos yylvp = yylve = yylvals + p;
1213fd0b3accSchristos yylvlim = yylvals + s;
1214fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1215fd0b3accSchristos yylpp = yylpe = yylpsns + p;
1216fd0b3accSchristos yylplim = yylpsns + s;
1217fd0b3accSchristos #endif
1218fd0b3accSchristos yylexp = yylexemes + p;
1219fd0b3accSchristos }
1220fd0b3accSchristos *yylexp = (YYINT) YYLEX;
1221fd0b3accSchristos *yylvp++ = yylval;
1222fd0b3accSchristos yylve++;
1223fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1224fd0b3accSchristos *yylpp++ = yylloc;
1225fd0b3accSchristos yylpe++;
1226fd0b3accSchristos #endif
1227fd0b3accSchristos yychar = *yylexp++;
1228fd0b3accSchristos break;
1229fd0b3accSchristos }
1230fd0b3accSchristos /* normal operation, no conflict encountered */
1231fd0b3accSchristos #endif /* YYBTYACC */
1232fd0b3accSchristos yychar = YYLEX;
1233fd0b3accSchristos #if YYBTYACC
1234fd0b3accSchristos } while (0);
1235fd0b3accSchristos #endif /* YYBTYACC */
1236fd0b3accSchristos if (yychar < 0) yychar = YYEOF;
1237fd0b3accSchristos #if YYDEBUG
1238fd0b3accSchristos if (yydebug)
1239fd0b3accSchristos {
1240fd0b3accSchristos if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1241fd0b3accSchristos fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
1242fd0b3accSchristos YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
1243fd0b3accSchristos }
1244fd0b3accSchristos #endif
1245fd0b3accSchristos }
1246fd0b3accSchristos if (yychar == YYEOF) goto yyaccept;
1247fd0b3accSchristos goto yyloop;
1248fd0b3accSchristos }
1249fd0b3accSchristos if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1250fd0b3accSchristos yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1251fd0b3accSchristos yystate = yytable[yyn];
1252fd0b3accSchristos else
1253fd0b3accSchristos yystate = yydgoto[yym];
1254fd0b3accSchristos #if YYDEBUG
1255fd0b3accSchristos if (yydebug)
1256fd0b3accSchristos {
1257fd0b3accSchristos fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
1258fd0b3accSchristos #ifdef YYSTYPE_TOSTRING
1259fd0b3accSchristos #if YYBTYACC
1260fd0b3accSchristos if (!yytrial)
1261fd0b3accSchristos #endif /* YYBTYACC */
1262fd0b3accSchristos fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
1263fd0b3accSchristos #endif
1264fd0b3accSchristos fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
1265fd0b3accSchristos }
1266fd0b3accSchristos #endif
1267fd0b3accSchristos if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1268fd0b3accSchristos *++yystack.s_mark = (YYINT) yystate;
1269fd0b3accSchristos *++yystack.l_mark = yyval;
1270fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1271fd0b3accSchristos *++yystack.p_mark = yyloc;
1272fd0b3accSchristos #endif
1273fd0b3accSchristos goto yyloop;
1274fd0b3accSchristos #if YYBTYACC
1275fd0b3accSchristos
1276fd0b3accSchristos /* Reduction declares that this path is valid. Set yypath and do a full parse */
1277fd0b3accSchristos yyvalid:
1278fd0b3accSchristos if (yypath) YYABORT;
1279fd0b3accSchristos while (yyps->save)
1280fd0b3accSchristos {
1281fd0b3accSchristos YYParseState *save = yyps->save;
1282fd0b3accSchristos yyps->save = save->save;
1283fd0b3accSchristos save->save = yypath;
1284fd0b3accSchristos yypath = save;
1285fd0b3accSchristos }
1286fd0b3accSchristos #if YYDEBUG
1287fd0b3accSchristos if (yydebug)
1288fd0b3accSchristos fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
1289fd0b3accSchristos YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
1290fd0b3accSchristos #endif
1291fd0b3accSchristos if (yyerrctx)
1292fd0b3accSchristos {
1293fd0b3accSchristos yyFreeState(yyerrctx);
1294fd0b3accSchristos yyerrctx = NULL;
1295fd0b3accSchristos }
1296fd0b3accSchristos yylvp = yylvals + yypath->lexeme;
1297fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1298fd0b3accSchristos yylpp = yylpsns + yypath->lexeme;
1299fd0b3accSchristos #endif
1300fd0b3accSchristos yylexp = yylexemes + yypath->lexeme;
1301fd0b3accSchristos yychar = YYEMPTY;
1302fd0b3accSchristos yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
1303fd0b3accSchristos memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1304fd0b3accSchristos yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
1305fd0b3accSchristos memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1306fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1307fd0b3accSchristos yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
1308fd0b3accSchristos memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1309fd0b3accSchristos #endif
1310fd0b3accSchristos yystate = yypath->state;
1311fd0b3accSchristos goto yyloop;
1312fd0b3accSchristos #endif /* YYBTYACC */
1313fd0b3accSchristos
1314fd0b3accSchristos yyoverflow:
1315fd0b3accSchristos YYERROR_CALL("yacc stack overflow");
1316fd0b3accSchristos #if YYBTYACC
1317fd0b3accSchristos goto yyabort_nomem;
1318fd0b3accSchristos yyenomem:
1319fd0b3accSchristos YYERROR_CALL("memory exhausted");
1320fd0b3accSchristos yyabort_nomem:
1321fd0b3accSchristos #endif /* YYBTYACC */
1322fd0b3accSchristos yyresult = 2;
1323fd0b3accSchristos goto yyreturn;
1324fd0b3accSchristos
1325fd0b3accSchristos yyabort:
1326fd0b3accSchristos yyresult = 1;
1327fd0b3accSchristos goto yyreturn;
1328fd0b3accSchristos
1329fd0b3accSchristos yyaccept:
1330fd0b3accSchristos #if YYBTYACC
1331fd0b3accSchristos if (yyps->save) goto yyvalid;
1332fd0b3accSchristos #endif /* YYBTYACC */
1333fd0b3accSchristos yyresult = 0;
1334fd0b3accSchristos
1335fd0b3accSchristos yyreturn:
1336fd0b3accSchristos #if defined(YYDESTRUCT_CALL)
1337fd0b3accSchristos if (yychar != YYEOF && yychar != YYEMPTY)
1338fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1339fd0b3accSchristos YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
1340fd0b3accSchristos #else
1341fd0b3accSchristos YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
1342fd0b3accSchristos #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1343fd0b3accSchristos
1344fd0b3accSchristos {
1345fd0b3accSchristos YYSTYPE *pv;
1346fd0b3accSchristos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1347fd0b3accSchristos YYLTYPE *pp;
1348fd0b3accSchristos
1349fd0b3accSchristos for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
1350fd0b3accSchristos YYDESTRUCT_CALL("cleanup: discarding state",
1351fd0b3accSchristos yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
1352fd0b3accSchristos #else
1353fd0b3accSchristos for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
1354fd0b3accSchristos YYDESTRUCT_CALL("cleanup: discarding state",
1355fd0b3accSchristos yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
1356fd0b3accSchristos #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1357fd0b3accSchristos }
1358fd0b3accSchristos #endif /* defined(YYDESTRUCT_CALL) */
1359fd0b3accSchristos
1360fd0b3accSchristos #if YYBTYACC
1361fd0b3accSchristos if (yyerrctx)
1362fd0b3accSchristos {
1363fd0b3accSchristos yyFreeState(yyerrctx);
1364fd0b3accSchristos yyerrctx = NULL;
1365fd0b3accSchristos }
1366fd0b3accSchristos while (yyps)
1367fd0b3accSchristos {
1368fd0b3accSchristos YYParseState *save = yyps;
1369fd0b3accSchristos yyps = save->save;
1370fd0b3accSchristos save->save = NULL;
1371fd0b3accSchristos yyFreeState(save);
1372fd0b3accSchristos }
1373fd0b3accSchristos while (yypath)
1374fd0b3accSchristos {
1375fd0b3accSchristos YYParseState *save = yypath;
1376fd0b3accSchristos yypath = save->save;
1377fd0b3accSchristos save->save = NULL;
1378fd0b3accSchristos yyFreeState(save);
1379fd0b3accSchristos }
1380fd0b3accSchristos #endif /* YYBTYACC */
1381fd0b3accSchristos yyfreestack(&yystack);
1382fd0b3accSchristos return (yyresult);
1383fd0b3accSchristos }
1384