1 /* original parser id follows */
2 /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
3 /* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
8 #define YYCHECK "yyyymmdd"
11 #define yyclearin (yychar = YYEMPTY)
12 #define yyerrok (yyerrflag = 0)
13 #define YYRECOVERING() (yyerrflag != 0)
18 #define yyparse err_syntax20_parse
22 #define yylex err_syntax20_lex
26 #define yyerror err_syntax20_error
30 #define yychar err_syntax20_char
34 #define yyval err_syntax20_val
38 #define yylval err_syntax20_lval
42 #define yydebug err_syntax20_debug
46 #define yynerrs err_syntax20_nerrs
50 #define yyerrflag err_syntax20_errflag
51 #endif /* yyerrflag */
54 #define yylhs err_syntax20_lhs
58 #define yylen err_syntax20_len
62 #define yydefred err_syntax20_defred
66 #define yydgoto err_syntax20_dgoto
70 #define yysindex err_syntax20_sindex
74 #define yyrindex err_syntax20_rindex
78 #define yygindex err_syntax20_gindex
82 #define yytable err_syntax20_table
86 #define yycheck err_syntax20_check
90 #define yyname err_syntax20_name
94 #define yyrule err_syntax20_rule
96 #define YYPREFIX "err_syntax20_"
100 #line 2 "err_syntax20.y"
102 static void yyerror(const char *);
103 #line 104 "err_syntax20.tab.c"
105 /* compatibility with bison */
107 /* compatibility with FreeBSD */
108 # ifdef YYPARSE_PARAM_TYPE
109 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
111 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
114 # define YYPARSE_DECL() yyparse(void)
117 /* Parameters sent to lex. */
119 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
120 # define YYLEX yylex(YYLEX_PARAM)
122 # define YYLEX_DECL() yylex(void)
123 # define YYLEX yylex()
126 /* Parameters sent to yyerror. */
128 #define YYERROR_DECL() yyerror(const char *s)
131 #define YYERROR_CALL(msg) yyerror(msg)
134 extern int YYPARSE_DECL();
137 #define YYERRCODE 256
139 static const YYINT err_syntax20_lhs[] = { -1,
142 static const YYINT err_syntax20_len[] = { 2,
145 static const YYINT err_syntax20_defred[] = { 0,
148 static const YYINT err_syntax20_dgoto[] = { 2,
150 static const YYINT err_syntax20_sindex[] = { -40,
153 static const YYINT err_syntax20_rindex[] = { 0,
156 static const YYINT err_syntax20_gindex[] = { 0,
158 #define YYTABLESIZE 2
159 static const YYINT err_syntax20_table[] = { 1,
162 static const YYINT err_syntax20_check[] = { 40,
169 #define YYMAXTOKEN 257
170 #define YYUNDFTOKEN 260
171 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
173 static const char *const err_syntax20_name[] = {
175 "end-of-file",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,
176 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,
177 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
178 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
179 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
180 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
181 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,"recur",0,0,
184 static const char *const err_syntax20_rule[] = {
186 "expr : '(' recur ')'",
199 /* define the initial stack-sizes */
202 #define YYMAXDEPTH YYSTACKSIZE
205 #define YYSTACKSIZE YYMAXDEPTH
207 #define YYSTACKSIZE 10000
208 #define YYMAXDEPTH 10000
212 #define YYINITSTACKSIZE 200
222 /* variables for the parser stack */
223 static YYSTACKDATA yystack;
224 #line 16 "err_syntax20.y"
231 printf("yyparse() = %d\n", yyparse());
242 yyerror(const char* s)
246 #line 247 "err_syntax20.tab.c"
249 #include <stdio.h> /* needed for printf */
252 #include <stdlib.h> /* needed for malloc, etc */
253 #include <string.h> /* needed for memset */
255 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
256 static int yygrowstack(YYSTACKDATA *data)
263 if ((newsize = data->stacksize) == 0)
264 newsize = YYINITSTACKSIZE;
265 else if (newsize >= YYMAXDEPTH)
267 else if ((newsize *= 2) > YYMAXDEPTH)
268 newsize = YYMAXDEPTH;
270 i = (int) (data->s_mark - data->s_base);
271 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
275 data->s_base = newss;
276 data->s_mark = newss + i;
278 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
282 data->l_base = newvs;
283 data->l_mark = newvs + i;
285 data->stacksize = newsize;
286 data->s_last = data->s_base + newsize - 1;
290 #if YYPURE || defined(YY_NO_LEAKS)
291 static void yyfreestack(YYSTACKDATA *data)
295 memset(data, 0, sizeof(*data));
298 #define yyfreestack(data) /* nothing */
301 #define YYABORT goto yyabort
302 #define YYREJECT goto yyabort
303 #define YYACCEPT goto yyaccept
304 #define YYERROR goto yyerrlab
309 int yym, yyn, yystate;
313 if ((yys = getenv("YYDEBUG")) != 0)
316 if (yyn >= '0' && yyn <= '9')
329 memset(&yystack, 0, sizeof(yystack));
332 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
333 yystack.s_mark = yystack.s_base;
334 yystack.l_mark = yystack.l_base;
339 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
343 if (yychar < 0) yychar = YYEOF;
347 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
348 printf("%sdebug: state %d, reading %d (%s)\n",
349 YYPREFIX, yystate, yychar, yys);
353 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
354 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
358 printf("%sdebug: state %d, shifting to state %d\n",
359 YYPREFIX, yystate, yytable[yyn]);
361 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
362 yystate = yytable[yyn];
363 *++yystack.s_mark = yytable[yyn];
364 *++yystack.l_mark = yylval;
366 if (yyerrflag > 0) --yyerrflag;
369 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
370 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
375 if (yyerrflag != 0) goto yyinrecovery;
377 YYERROR_CALL("syntax error");
379 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
389 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
390 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
394 printf("%sdebug: state %d, error recovery shifting\
395 to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
397 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
398 yystate = yytable[yyn];
399 *++yystack.s_mark = yytable[yyn];
400 *++yystack.l_mark = yylval;
407 printf("%sdebug: error recovery discarding state %d\n",
408 YYPREFIX, *yystack.s_mark);
410 if (yystack.s_mark <= yystack.s_base) goto yyabort;
418 if (yychar == YYEOF) goto yyabort;
422 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
423 printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
424 YYPREFIX, yystate, yychar, yys);
434 printf("%sdebug: state %d, reducing by rule %d (%s)\n",
435 YYPREFIX, yystate, yyn, yyrule[yyn]);
439 yyval = yystack.l_mark[1-yym];
441 memset(&yyval, 0, sizeof yyval);
446 #line 12 "err_syntax20.y"
447 { yystack.l_mark[-1].rechk = 3; }
449 #line 450 "err_syntax20.tab.c"
451 yystack.s_mark -= yym;
452 yystate = *yystack.s_mark;
453 yystack.l_mark -= yym;
455 if (yystate == 0 && yym == 0)
459 printf("%sdebug: after reduction, shifting from state 0 to\
460 state %d\n", YYPREFIX, YYFINAL);
463 *++yystack.s_mark = YYFINAL;
464 *++yystack.l_mark = yyval;
468 if (yychar < 0) yychar = YYEOF;
472 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
473 printf("%sdebug: state %d, reading %d (%s)\n",
474 YYPREFIX, YYFINAL, yychar, yys);
478 if (yychar == YYEOF) goto yyaccept;
481 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
482 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
483 yystate = yytable[yyn];
485 yystate = yydgoto[yym];
488 printf("%sdebug: after reduction, shifting from state %d \
489 to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
491 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
492 *++yystack.s_mark = (YYINT) yystate;
493 *++yystack.l_mark = yyval;
497 YYERROR_CALL("yacc stack overflow");
500 yyfreestack(&yystack);
504 yyfreestack(&yystack);