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