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