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