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')
327 memset(&yystack, 0, sizeof(yystack));
330 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
331 yystack.s_mark = yystack.s_base;
332 yystack.l_mark = yystack.l_base;
337 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
340 if ((yychar = YYLEX) < 0) yychar = YYEOF;
344 yys = yyname[YYTRANSLATE(yychar)];
345 printf("%sdebug: state %d, reading %d (%s)\n",
346 YYPREFIX, yystate, yychar, yys);
350 if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
351 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
355 printf("%sdebug: state %d, shifting to state %d\n",
356 YYPREFIX, yystate, yytable[yyn]);
358 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
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]) && (yyn += yychar) >= 0 &&
370 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
375 if (yyerrflag) goto yyinrecovery;
377 YYERROR_CALL("syntax error");
390 if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
391 yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
395 printf("%sdebug: state %d, error recovery shifting\
396 to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
398 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
402 yystate = yytable[yyn];
403 *++yystack.s_mark = yytable[yyn];
404 *++yystack.l_mark = yylval;
411 printf("%sdebug: error recovery discarding state %d\n",
412 YYPREFIX, *yystack.s_mark);
414 if (yystack.s_mark <= yystack.s_base) goto yyabort;
422 if (yychar == YYEOF) goto yyabort;
426 yys = yyname[YYTRANSLATE(yychar)];
427 printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
428 YYPREFIX, yystate, yychar, yys);
438 printf("%sdebug: state %d, reducing by rule %d (%s)\n",
439 YYPREFIX, yystate, yyn, yyrule[yyn]);
443 yyval = yystack.l_mark[1-yym];
445 memset(&yyval, 0, sizeof yyval);
449 #line 12 "err_syntax20.y"
450 { yystack.l_mark[-1].rechk = 3; }
452 #line 453 "err_syntax20.tab.c"
454 yystack.s_mark -= yym;
455 yystate = *yystack.s_mark;
456 yystack.l_mark -= yym;
458 if (yystate == 0 && yym == 0)
462 printf("%sdebug: after reduction, shifting from state 0 to\
463 state %d\n", YYPREFIX, YYFINAL);
466 *++yystack.s_mark = YYFINAL;
467 *++yystack.l_mark = yyval;
470 if ((yychar = YYLEX) < 0) yychar = YYEOF;
474 yys = yyname[YYTRANSLATE(yychar)];
475 printf("%sdebug: state %d, reading %d (%s)\n",
476 YYPREFIX, YYFINAL, yychar, yys);
480 if (yychar == YYEOF) goto yyaccept;
483 if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
484 yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
485 yystate = yytable[yyn];
487 yystate = yydgoto[yym];
490 printf("%sdebug: after reduction, shifting from state %d \
491 to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
493 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
497 *++yystack.s_mark = (YYINT) yystate;
498 *++yystack.l_mark = yyval;
502 YYERROR_CALL("yacc stack overflow");
505 yyfreestack(&yystack);
509 yyfreestack(&yystack);