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