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