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_syntax18_parse
22 #define yylex err_syntax18_lex
26 #define yyerror err_syntax18_error
30 #define yychar err_syntax18_char
34 #define yyval err_syntax18_val
38 #define yylval err_syntax18_lval
42 #define yydebug err_syntax18_debug
46 #define yynerrs err_syntax18_nerrs
50 #define yyerrflag err_syntax18_errflag
51 #endif /* yyerrflag */
54 #define yylhs err_syntax18_lhs
58 #define yylen err_syntax18_len
62 #define yydefred err_syntax18_defred
66 #define yydgoto err_syntax18_dgoto
70 #define yysindex err_syntax18_sindex
74 #define yyrindex err_syntax18_rindex
78 #define yygindex err_syntax18_gindex
82 #define yytable err_syntax18_table
86 #define yycheck err_syntax18_check
90 #define yyname err_syntax18_name
94 #define yyrule err_syntax18_rule
96 #define YYPREFIX "err_syntax18_"
100 #line 2 "err_syntax18.y"
102 static void yyerror(const char *);
103 #line 104 "err_syntax18.tab.c"
105 #if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
106 /* Default: YYSTYPE is the semantic value type. */
108 # define YYSTYPE_IS_DECLARED 1
111 /* compatibility with bison */
113 /* compatibility with FreeBSD */
114 # ifdef YYPARSE_PARAM_TYPE
115 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
117 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
120 # define YYPARSE_DECL() yyparse(void)
123 /* Parameters sent to lex. */
125 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
126 # define YYLEX yylex(YYLEX_PARAM)
128 # define YYLEX_DECL() yylex(void)
129 # define YYLEX yylex()
132 /* Parameters sent to yyerror. */
134 #define YYERROR_DECL() yyerror(const char *s)
137 #define YYERROR_CALL(msg) yyerror(msg)
140 extern int YYPARSE_DECL();
142 #define YYERRCODE 256
144 static const YYINT err_syntax18_lhs[] = { -1,
147 static const YYINT err_syntax18_len[] = { 2,
150 static const YYINT err_syntax18_defred[] = { 0,
153 static const YYINT err_syntax18_dgoto[] = { 2,
155 static const YYINT err_syntax18_sindex[] = { -40,
158 static const YYINT err_syntax18_rindex[] = { 0,
161 static const YYINT err_syntax18_gindex[] = { 2,
163 #define YYTABLESIZE 3
164 static const YYINT err_syntax18_table[] = { 1,
167 static const YYINT err_syntax18_check[] = { 40,
174 #define YYMAXTOKEN 256
175 #define YYUNDFTOKEN 259
176 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
178 static const char *const err_syntax18_name[] = {
180 "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,
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,0,0,0,0,0,0,0,
182 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,
183 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,
184 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,
185 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,
186 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,"illegal-symbol",
188 static const char *const err_syntax18_rule[] = {
190 "expr : '(' expr ')'",
203 /* define the initial stack-sizes */
206 #define YYMAXDEPTH YYSTACKSIZE
209 #define YYSTACKSIZE YYMAXDEPTH
211 #define YYSTACKSIZE 10000
212 #define YYMAXDEPTH 10000
216 #define YYINITSTACKSIZE 200
226 /* variables for the parser stack */
227 static YYSTACKDATA yystack;
228 #line 13 "err_syntax18.y"
235 printf("yyparse() = %d\n", yyparse());
246 yyerror(const char* s)
250 #line 251 "err_syntax18.tab.c"
253 #include <stdio.h> /* needed for printf */
256 #include <stdlib.h> /* needed for malloc, etc */
257 #include <string.h> /* needed for memset */
259 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
260 static int yygrowstack(YYSTACKDATA *data)
267 if ((newsize = data->stacksize) == 0)
268 newsize = YYINITSTACKSIZE;
269 else if (newsize >= YYMAXDEPTH)
271 else if ((newsize *= 2) > YYMAXDEPTH)
272 newsize = YYMAXDEPTH;
274 i = (int) (data->s_mark - data->s_base);
275 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
279 data->s_base = newss;
280 data->s_mark = newss + i;
282 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
286 data->l_base = newvs;
287 data->l_mark = newvs + i;
289 data->stacksize = newsize;
290 data->s_last = data->s_base + newsize - 1;
294 #if YYPURE || defined(YY_NO_LEAKS)
295 static void yyfreestack(YYSTACKDATA *data)
299 memset(data, 0, sizeof(*data));
302 #define yyfreestack(data) /* nothing */
305 #define YYABORT goto yyabort
306 #define YYREJECT goto yyabort
307 #define YYACCEPT goto yyaccept
308 #define YYERROR goto yyerrlab
313 int yym, yyn, yystate;
317 if ((yys = getenv("YYDEBUG")) != 0)
320 if (yyn >= '0' && yyn <= '9')
331 memset(&yystack, 0, sizeof(yystack));
334 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
335 yystack.s_mark = yystack.s_base;
336 yystack.l_mark = yystack.l_base;
341 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
344 if ((yychar = YYLEX) < 0) yychar = YYEOF;
348 yys = yyname[YYTRANSLATE(yychar)];
349 printf("%sdebug: state %d, reading %d (%s)\n",
350 YYPREFIX, yystate, yychar, yys);
354 if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
355 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
359 printf("%sdebug: state %d, shifting to state %d\n",
360 YYPREFIX, yystate, yytable[yyn]);
362 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
366 yystate = yytable[yyn];
367 *++yystack.s_mark = yytable[yyn];
368 *++yystack.l_mark = yylval;
370 if (yyerrflag > 0) --yyerrflag;
373 if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
374 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
379 if (yyerrflag) goto yyinrecovery;
381 YYERROR_CALL("syntax error");
394 if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
395 yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
399 printf("%sdebug: state %d, error recovery shifting\
400 to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
402 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
406 yystate = yytable[yyn];
407 *++yystack.s_mark = yytable[yyn];
408 *++yystack.l_mark = yylval;
415 printf("%sdebug: error recovery discarding state %d\n",
416 YYPREFIX, *yystack.s_mark);
418 if (yystack.s_mark <= yystack.s_base) goto yyabort;
426 if (yychar == YYEOF) goto yyabort;
430 yys = yyname[YYTRANSLATE(yychar)];
431 printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
432 YYPREFIX, yystate, yychar, yys);
442 printf("%sdebug: state %d, reducing by rule %d (%s)\n",
443 YYPREFIX, yystate, yyn, yyrule[yyn]);
447 yyval = yystack.l_mark[1-yym];
449 memset(&yyval, 0, sizeof yyval);
453 #line 9 "err_syntax18.y"
454 { yyval = yystack.l_mark[1]; }
456 #line 457 "err_syntax18.tab.c"
458 yystack.s_mark -= yym;
459 yystate = *yystack.s_mark;
460 yystack.l_mark -= yym;
462 if (yystate == 0 && yym == 0)
466 printf("%sdebug: after reduction, shifting from state 0 to\
467 state %d\n", YYPREFIX, YYFINAL);
470 *++yystack.s_mark = YYFINAL;
471 *++yystack.l_mark = yyval;
474 if ((yychar = YYLEX) < 0) yychar = YYEOF;
478 yys = yyname[YYTRANSLATE(yychar)];
479 printf("%sdebug: state %d, reading %d (%s)\n",
480 YYPREFIX, YYFINAL, yychar, yys);
484 if (yychar == YYEOF) goto yyaccept;
487 if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
488 yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
489 yystate = yytable[yyn];
491 yystate = yydgoto[yym];
494 printf("%sdebug: after reduction, shifting from state %d \
495 to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
497 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
501 *++yystack.s_mark = (YYINT) yystate;
502 *++yystack.l_mark = yyval;
506 YYERROR_CALL("yacc stack overflow");
509 yyfreestack(&yystack);
513 yyfreestack(&yystack);