2 static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
7 #define yyclearin (yychar=(-1))
8 #define yyerrok (yyerrflag=0)
9 #define YYRECOVERING (yyerrflag!=0)
11 #line 2 "../common/parser.y"
16 #define __EXTERN_C__ 1
19 #if defined(__cplusplus) || defined(__STDC__)
20 #if defined(__cplusplus) && defined(__EXTERN_C__)
27 int yyback(int *, int);
30 /* You may need to put /DLEX_SCANNER in your makefile
31 * if you're using LEX!
34 /* int yyoutput(int); */
40 #if defined(__cplusplus) || defined(__STDC__)
41 #if defined(__cplusplus) && defined(__EXTERN_C__)
45 #line 37 "../common/parser.y"
48 /* struct pexpr *expr; */
61 #define CLOSE_SQUARE 10
66 0, 0, 1, 1, 1, 2, 2, 2, 3, 3,
67 3, 4, 4, 5, 5, 5, 5, 5, 5, 5,
70 0, 2, 2, 2, 2, 4, 2, 3, 0, 1,
71 3, 3, 1, 1, 1, 1, 3, 3, 5, 1,
73 short yydefred[] = { 1,
74 0, 0, 0, 0, 2, 0, 5, 3, 0, 0,
75 0, 15, 7, 20, 0, 0, 13, 4, 0, 0,
76 0, 0, 8, 0, 6, 0, 18, 0, 12, 11,
79 short yydgoto[] = { 1,
82 short yysindex[] = { 0,
83 -2, 9, 2, 1, 0, 10, 0, 0, 11, -5,
84 17, 0, 0, 0, 14, -1, 0, 0, 33, 38,
85 41, 16, 0, 11, 0, 29, 0, 40, 0, 0,
88 short yyrindex[] = { 0,
89 0, 0, 0, 0, 0, 0, 0, 0, 42, 21,
90 24, 0, 0, 0, 0, 30, 0, 0, 0, 0,
91 0, 0, 0, 31, 0, 27, 0, 24, 0, 0,
94 short yygindex[] = { 0,
97 #define YYTABLESIZE 254
98 short yytable[] = { 3,
99 19, 10, 11, 12, 24, 9, 4, 20, 21, 4,
100 13, 10, 11, 12, 8, 30, 10, 28, 12, 4,
101 9, 7, 18, 23, 4, 16, 16, 22, 14, 14,
102 16, 17, 17, 14, 10, 9, 17, 25, 26, 10,
103 9, 27, 31, 9, 32, 6, 9, 29, 0, 0,
104 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
105 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
106 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
107 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
108 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
109 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
110 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
111 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
112 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
113 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
114 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
115 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
116 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
117 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
118 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
119 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
120 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
121 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
122 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
123 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
126 short yycheck[] = { 2,
127 9, 1, 2, 3, 6, 4, 9, 13, 14, 9,
128 10, 1, 2, 3, 13, 24, 1, 2, 3, 9,
129 4, 13, 13, 10, 9, 5, 6, 11, 5, 6,
130 10, 5, 6, 10, 5, 5, 10, 5, 1, 10,
131 10, 1, 14, 4, 1, 1, 5, 22, -1, -1,
132 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
133 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
134 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
135 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
136 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
137 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
138 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
139 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
140 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
141 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
142 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
143 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
144 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
145 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
146 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
147 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
148 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
149 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
150 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
151 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
158 #define YYMAXTOKEN 14
161 "end-of-file","INTEGER","WORD","STRING","OPEN","CLOSE","COMMA","NEWLINE",
162 "ERROR","OPEN_SQUARE","CLOSE_SQUARE","EQUALS",0,"PERIOD","EXP",
165 "$accept : commands",
167 "commands : commands command",
168 "command : WORD PERIOD",
169 "command : expr PERIOD",
170 "command : error PERIOD",
171 "expr : WORD OPEN arglist CLOSE",
172 "expr : OPEN_SQUARE CLOSE_SQUARE",
173 "expr : OPEN_SQUARE arglist CLOSE_SQUARE",
176 "arglist : arg COMMA arglist",
177 "arg : WORD EQUALS arg1",
182 "arg1 : INTEGER PERIOD INTEGER",
183 "arg1 : INTEGER EXP INTEGER",
184 "arg1 : INTEGER PERIOD INTEGER EXP INTEGER",
190 #define YYMAXDEPTH YYSTACKSIZE
193 #define YYSTACKSIZE YYMAXDEPTH
195 #define YYSTACKSIZE 500
196 #define YYMAXDEPTH 500
207 short yyss[YYSTACKSIZE];
208 YYSTYPE yyvs[YYSTACKSIZE];
209 #define yystacksize YYSTACKSIZE
210 #line 119 "../common/parser.y"
212 #include "../common/lex_yy.c"
222 /* Ansi prototype. If this doesn't work for you... uncomment
226 void yyerror(char *s)
232 * Unfortunately, my DOS version of FLEX
233 * requires yywrap to be #def'ed, whereas
234 * the UNIX flex expects a proper function.
237 /* Not sure if __SC__ is the appropriate thing
246 #else if !defined(__alpha) && !defined(__ultrix)
247 int yywrap() { return 1; }
251 #define YYABORT goto yyabort
252 #define YYREJECT goto yyabort
253 #define YYACCEPT goto yyaccept
254 #define YYERROR goto yyerrlab
258 register int yym, yyn, yystate;
261 extern char *getenv();
263 if (yys = getenv("YYDEBUG"))
266 if (yyn >= '0' && yyn <= '9')
277 *yyssp = yystate = 0;
280 if (yyn = yydefred[yystate]) goto yyreduce;
283 if ((yychar = yylex()) < 0) yychar = 0;
288 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
289 if (!yys) yys = "illegal-symbol";
290 printf("%sdebug: state %d, reading %d (%s)\n",
291 YYPREFIX, yystate, yychar, yys);
295 if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
296 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
300 printf("%sdebug: state %d, shifting to state %d\n",
301 YYPREFIX, yystate, yytable[yyn]);
303 if (yyssp >= yyss + yystacksize - 1)
307 *++yyssp = yystate = yytable[yyn];
310 if (yyerrflag > 0) --yyerrflag;
313 if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
314 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
319 if (yyerrflag) goto yyinrecovery;
324 yyerror("syntax error");
336 if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
337 yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
341 printf("%sdebug: state %d, error recovery shifting\
342 to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
344 if (yyssp >= yyss + yystacksize - 1)
348 *++yyssp = yystate = yytable[yyn];
356 printf("%sdebug: error recovery discarding state %d\n",
359 if (yyssp <= yyss) goto yyabort;
367 if (yychar == 0) goto yyabort;
372 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
373 if (!yys) yys = "illegal-symbol";
374 printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
375 YYPREFIX, yystate, yychar, yys);
384 printf("%sdebug: state %d, reducing by rule %d (%s)\n",
385 YYPREFIX, yystate, yyn, yyrule[yyn]);
388 yyval = yyvsp[1-yym];
392 #line 69 "../common/parser.y"
393 {process_command(proio_cons(make_word(yyvsp[-1].s), NULL)); free(yyvsp[-1].s);}
396 #line 71 "../common/parser.y"
397 {process_command(yyvsp[-1].s);}
400 #line 73 "../common/parser.y"
401 {syntax_error("Unrecognized command.");}
404 #line 77 "../common/parser.y"
405 {yyval.s = proio_cons(make_word(yyvsp[-3].s), yyvsp[-1].s); free(yyvsp[-3].s);}
408 #line 79 "../common/parser.y"
409 {yyval.s = proio_cons(NULL, NULL);}
412 #line 81 "../common/parser.y"
413 {yyval.s = yyvsp[-1].s; }
416 #line 85 "../common/parser.y"
420 #line 87 "../common/parser.y"
421 {yyval.s = proio_cons(yyvsp[0].s, NULL);}
424 #line 90 "../common/parser.y"
425 {yyval.s = proio_cons(yyvsp[-2].s, yyvsp[0].s);}
428 #line 94 "../common/parser.y"
429 {yyval.s = proio_cons(make_word("="), proio_cons(make_word(yyvsp[-2].s), proio_cons(yyvsp[0].s, NULL)));
433 #line 97 "../common/parser.y"
434 {yyval.s = yyvsp[0].s; }
437 #line 100 "../common/parser.y"
438 {yyval.s = make_word(yyvsp[0].s); free(yyvsp[0].s);}
441 #line 102 "../common/parser.y"
442 {yyval.s = make_string(yyvsp[0].s); free(yyvsp[0].s);}
445 #line 104 "../common/parser.y"
446 {yyval.s = make_integer(yyvsp[0].s); free(yyvsp[0].s);}
449 #line 106 "../common/parser.y"
450 {yyval.s = make_real(yyvsp[-2].s, yyvsp[0].s); free(yyvsp[-2].s); free(yyvsp[0].s); }
453 #line 108 "../common/parser.y"
454 {yyval.s = make_exp(yyvsp[-2].s, yyvsp[0].s); free(yyvsp[-2].s); free(yyvsp[0].s); }
457 #line 111 "../common/parser.y"
458 {yyval.s = make_exp2(yyvsp[-4].s, yyvsp[-2].s, yyvsp[0].s); free(yyvsp[-4].s); free(yyvsp[-2].s);
462 #line 115 "../common/parser.y"
463 {yyval.s = yyvsp[0].s;}
471 if (yystate == 0 && yym == 0)
475 printf("%sdebug: after reduction, shifting from state 0 to\
476 state %d\n", YYPREFIX, YYFINAL);
483 if ((yychar = yylex()) < 0) yychar = 0;
488 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
489 if (!yys) yys = "illegal-symbol";
490 printf("%sdebug: state %d, reading %d (%s)\n",
491 YYPREFIX, YYFINAL, yychar, yys);
495 if (yychar == 0) goto yyaccept;
498 if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
499 yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
500 yystate = yytable[yyn];
502 yystate = yydgoto[yym];
505 printf("%sdebug: after reduction, shifting from state %d \
506 to state %d\n", YYPREFIX, *yyssp, yystate);
508 if (yyssp >= yyss + yystacksize - 1)
516 yyerror("yacc stack overflow");