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