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