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