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')
333 memset(&yystack, 0, sizeof(yystack));
336 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
337 yystack.s_mark = yystack.s_base;
338 yystack.l_mark = yystack.l_base;
343 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
347 if (yychar < 0) yychar = YYEOF;
351 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
352 printf("%sdebug: state %d, reading %d (%s)\n",
353 YYPREFIX, yystate, yychar, yys);
357 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
358 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
362 printf("%sdebug: state %d, shifting to state %d\n",
363 YYPREFIX, yystate, yytable[yyn]);
365 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
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]) != 0) && (yyn += yychar) >= 0 &&
374 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
379 if (yyerrflag != 0) goto yyinrecovery;
381 YYERROR_CALL("syntax error");
383 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
393 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
394 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
398 printf("%sdebug: state %d, error recovery shifting\
399 to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
401 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
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 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
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);
450 #line 9 "err_syntax18.y"
451 { yyval = yystack.l_mark[1]; }
453 #line 454 "err_syntax18.tab.c"
455 yystack.s_mark -= yym;
456 yystate = *yystack.s_mark;
457 yystack.l_mark -= yym;
459 if (yystate == 0 && yym == 0)
463 printf("%sdebug: after reduction, shifting from state 0 to\
464 state %d\n", YYPREFIX, YYFINAL);
467 *++yystack.s_mark = YYFINAL;
468 *++yystack.l_mark = yyval;
472 if (yychar < 0) yychar = YYEOF;
476 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
477 printf("%sdebug: state %d, reading %d (%s)\n",
478 YYPREFIX, YYFINAL, yychar, yys);
482 if (yychar == YYEOF) goto yyaccept;
485 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
486 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
487 yystate = yytable[yyn];
489 yystate = yydgoto[yym];
492 printf("%sdebug: after reduction, shifting from state %d \
493 to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
495 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
496 *++yystack.s_mark = (YYINT) yystate;
497 *++yystack.l_mark = yyval;
501 YYERROR_CALL("yacc stack overflow");
504 yyfreestack(&yystack);
508 yyfreestack(&yystack);