1 #if defined(__STDC__) || defined(__cplusplus)
2 #define YYCONST const
3 #define YYPARAMS(x) x
4 #define YYDEFUN(name, arglist, args) name(args)
5 #define YYAND ,
6 #define YYPTR void *
7 #else
8 #define YYCONST
9 #define YYPARAMS(x) ()
10 #define YYDEFUN(name, arglist, args) name arglist args;
11 #define YYAND ;
12 #define YYPTR char *
13 #endif
14 #ifndef lint
15 YYCONST static char yysccsid[] = "@(#)yaccpar	1.8 (Berkeley +Cygnus.28) 01/20/91";
16 #endif
17 #define YYBYACC 1
18 #ifndef YYDONT_INCLUDE_STDIO
19 #include <stdio.h>
20 #endif
21 //#ifdef __cplusplus TA <tim@ngus.net> stdlib.h applies to C too
22 #include <stdlib.h> /* for malloc/realloc/free */
23 //#endif
24 #line 2 "lburg/gram.y"
25 #include <stdio.h>
26 #include "lburg.h"
27 /*lint -e616 -e527 -e652 -esym(552,yynerrs) -esym(563,yynewstate,yyerrlab) */
28 static int yylineno = 0;
29 #line 8 "lburg/gram.y"
30 typedef union {
31 	int n;
32 	char *string;
33 	Tree tree;
34 } YYSTYPE;
35 #line 37 "y.tab.c"
36 #define TERMINAL 257
37 #define START 258
38 #define PPERCENT 259
39 #define ID 260
40 #define TEMPLATE 261
41 #define CODE 262
42 #define INT 263
43 #define YYERRCODE 256
44 static YYCONST short yylhs[] = {                                        -1,
45     0,    0,    4,    4,    6,    6,    6,    6,    7,    7,
46     5,    5,    5,    5,    1,    3,    3,    3,    2,
47 };
48 static YYCONST short yylen[] = {                                         2,
49     3,    1,    0,    2,    3,    3,    1,    2,    0,    4,
50     0,    7,    2,    3,    1,    1,    4,    6,    1,
51 };
52 static YYCONST short yydefred[] = {                                      3,
53     0,    0,    0,    9,    0,   11,    7,    4,    8,    0,
54    15,    0,    0,    0,    5,    6,    0,   13,    0,    0,
55    14,    0,   10,    0,    0,    0,    0,    0,   19,    0,
56    17,    0,   12,    0,   18,
57 };
58 static YYCONST short yydgoto[] = {                                       1,
59    12,   30,   25,    2,   13,    8,   10,
60 };
61 static YYCONST short yysindex[] = {                                      0,
62     0,   -4,   -2,    0, -250,    0,    0,    0,    0,   -9,
63     0,    1,  -10,  -49,    0,    0,    3,    0,  -44, -248,
64     0, -244,    0,  -22, -242, -244, -245,  -37,    0,   10,
65     0, -244,    0,  -20,    0,
66 };
67 static YYCONST short yyrindex[] = {                                      0,
68     0,   22,    0,    0,    0,    0,    0,    0,    0,    0,
69     0,    0,   23,    0,    0,    0,    0,    0,    0,    0,
70     0,    0,    0,  -39,    0,    0,    0,    0,    0,    0,
71     0,    0,    0,    0,    0,
72 };
73 static YYCONST short yygindex[] = {                                      0,
74    11,    0,  -23,    0,    0,    0,    0,
75 };
76 #define YYTABLESIZE 255
77 static YYCONST short yytable[] = {                                      18,
78    15,   16,   28,   31,   16,    7,   32,    9,   34,   11,
79    16,   20,   21,   22,   23,   24,   29,   26,   27,   33,
80    35,    2,    1,   19,    0,    0,    0,    0,    0,    0,
81     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
82     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
83     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
84     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
85     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
86     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
87     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
88     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
89     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
90     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
91     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
92     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
93     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
94     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
95     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
96     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
97     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
98     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
99     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
100     0,   16,    0,    0,    0,    0,    0,    0,    0,    0,
101     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
102     0,    0,    0,    0,    0,   17,    0,    0,    0,   11,
103    14,    3,    4,    5,    6,
104 };
105 static YYCONST short yycheck[] = {                                      10,
106    10,   41,   26,   41,   44,   10,   44,   10,   32,  260,
107    10,   61,   10,   58,  263,  260,  262,   40,  261,   10,
108    41,    0,    0,   13,   -1,   -1,   -1,   -1,   -1,   -1,
109    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
110    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
111    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
112    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
113    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
114    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
115    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
116    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
117    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
118    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
119    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
120    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
121    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
122    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
123    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
124    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
125    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
126    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
127    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
128    -1,  261,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
129    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
130    -1,   -1,   -1,   -1,   -1,  256,   -1,   -1,   -1,  260,
131   260,  256,  257,  258,  259,
132 };
133 #define YYFINAL 1
134 #ifndef YYDEBUG
135 #define YYDEBUG 0
136 #endif
137 #define YYMAXTOKEN 263
138 #if YYDEBUG
139 static YYCONST char *YYCONST yyname[] = {
140 "end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
141 0,0,0,0,0,0,0,0,0,"'('","')'",0,0,"','",0,0,0,0,0,0,0,0,0,0,0,0,0,"':'",0,0,
142 "'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
143 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
144 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
145 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
146 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
147 "TERMINAL","START","PPERCENT","ID","TEMPLATE","CODE","INT",
148 };
149 static YYCONST char *YYCONST yyrule[] = {
150 "$accept : spec",
151 "spec : decls PPERCENT rules",
152 "spec : decls",
153 "decls :",
154 "decls : decls decl",
155 "decl : TERMINAL blist '\\n'",
156 "decl : START nonterm '\\n'",
157 "decl : '\\n'",
158 "decl : error '\\n'",
159 "blist :",
160 "blist : blist ID '=' INT",
161 "rules :",
162 "rules : rules nonterm ':' tree TEMPLATE cost '\\n'",
163 "rules : rules '\\n'",
164 "rules : rules error '\\n'",
165 "nonterm : ID",
166 "tree : ID",
167 "tree : ID '(' tree ')'",
168 "tree : ID '(' tree ',' tree ')'",
169 "cost : CODE",
170 };
171 #endif
172 #define YYLEX yylex()
173 #define YYEMPTY -1
174 #define yyclearin (yychar=(YYEMPTY))
175 #define yyerrok (yyerrflag=0)
176 #ifndef YYINITDEPTH
177 #define YYINITDEPTH 200
178 #endif
179 #ifdef YYSTACKSIZE
180 #ifndef YYMAXDEPTH
181 #define YYMAXDEPTH YYSTACKSIZE
182 #endif
183 #else
184 #ifdef YYMAXDEPTH
185 #define YYSTACKSIZE YYMAXDEPTH
186 #else
187 #define YYSTACKSIZE 500
188 #define YYMAXDEPTH 500
189 #endif
190 #endif
191 #ifndef YYMAXSTACKSIZE
192 #define YYMAXSTACKSIZE 10000
193 #endif
194 int yydebug;
195 int yynerrs;
196 int yyerrflag;
197 int yychar;
198 YYSTYPE yyval;
199 YYSTYPE yylval;
200 static short *yyss;
201 static YYSTYPE *yyvs;
202 static int yystacksize;
203 #define yyfree(x) free(x)
204 extern int yylex();
205 
206 static YYPTR
207 YYDEFUN (yymalloc, (bytes), unsigned bytes)
208 {
209     YYPTR ptr = (YYPTR) malloc (bytes);
210     if (ptr != 0) return (ptr);
211     yyerror ("yyparse: memory exhausted");
212     return (0);
213 }
214 
215 static YYPTR
216 YYDEFUN (yyrealloc, (old, bytes), YYPTR old YYAND unsigned bytes)
217 {
218     YYPTR ptr = (YYPTR) realloc (old, bytes);
219     if (ptr != 0) return (ptr);
220     yyerror ("yyparse: memory exhausted");
221     return (0);
222 }
223 
224 static int
225 #ifdef __GNUC__
226 inline
227 #endif
yygrow()228 yygrow ()
229 {
230 #if YYDEBUG
231     int old_stacksize = yystacksize;
232 #endif
233     short *new_yyss;
234     YYSTYPE *new_yyvs;
235 
236     if (yystacksize == YYMAXSTACKSIZE)
237         return (1);
238     yystacksize += (yystacksize + 1 ) / 2;
239     if (yystacksize > YYMAXSTACKSIZE)
240         yystacksize = YYMAXSTACKSIZE;
241 #if YYDEBUG
242     if (yydebug)
243         printf("yydebug: growing stack size from %d to %d\n",
244                old_stacksize, yystacksize);
245 #endif
246     new_yyss = (short *) yyrealloc ((char *)yyss, yystacksize * sizeof (short));
247     if (new_yyss == 0)
248         return (1);
249     new_yyvs = (YYSTYPE *) yyrealloc ((char *)yyvs, yystacksize * sizeof (YYSTYPE));
250     if (new_yyvs == 0)
251     {
252         yyfree (new_yyss);
253         return (1);
254     }
255     yyss = new_yyss;
256     yyvs = new_yyvs;
257     return (0);
258 }
259 #line 60 "lburg/gram.y"
260 #include <assert.h>
261 #include <stdarg.h>
262 #include <ctype.h>
263 #include <string.h>
264 #include <limits.h>
265 
266 int errcnt = 0;
267 FILE *infp = NULL;
268 FILE *outfp = NULL;
269 static char buf[BUFSIZ], *bp = buf;
270 static int ppercent = 0;
271 static int code = 0;
272 
get(void)273 static int get(void) {
274 	if (*bp == 0) {
275 		bp = buf;
276 		*bp = 0;
277 		if (fgets(buf, sizeof buf, infp) == NULL)
278 			return EOF;
279 		yylineno++;
280 		while (buf[0] == '%' && buf[1] == '{' && buf[2] == '\n') {
281 			for (;;) {
282 				if (fgets(buf, sizeof buf, infp) == NULL) {
283 					yywarn("unterminated %{...%}\n");
284 					return EOF;
285 				}
286 				yylineno++;
287 				if (strcmp(buf, "%}\n") == 0)
288 					break;
289 				fputs(buf, outfp);
290 			}
291 			if (fgets(buf, sizeof buf, infp) == NULL)
292 				return EOF;
293 			yylineno++;
294 		}
295 	}
296 	return *bp++;
297 }
298 
yyerror(char * fmt,...)299 void yyerror(char *fmt, ...) {
300 	va_list ap;
301 
302 	va_start(ap, fmt);
303 	if (yylineno > 0)
304 		fprintf(stderr, "line %d: ", yylineno);
305 	vfprintf(stderr, fmt, ap);
306 	if (fmt[strlen(fmt)-1] != '\n')
307 		 fprintf(stderr, "\n");
308 	errcnt++;
309 	va_end(ap);
310 }
311 
yylex(void)312 int yylex(void) {
313 	int c;
314 
315 	if (code) {
316 		char *p;
317 		bp += strspn(bp, " \t\f");
318 		p = strchr(bp, '\n');
319 		if (p == NULL)
320 			p = strchr(bp, '\n');
321 		while (p > bp && isspace(p[-1]))
322 			p--;
323 		yylval.string = alloc(p - bp + 1);
324 		strncpy(yylval.string, bp, p - bp);
325 		yylval.string[p - bp] = 0;
326 		bp = p;
327 		code--;
328 		return CODE;
329 	}
330 	while ((c = get()) != EOF) {
331 		switch (c) {
332 		case ' ': case '\f': case '\t':
333 			continue;
334 		case '\n':
335 		case '(': case ')': case ',':
336 		case ':': case '=':
337 			return c;
338 		}
339 		if (c == '%' && *bp == '%') {
340 			bp++;
341 			return ppercent++ ? 0 : PPERCENT;
342 		} else if (c == '%' && strncmp(bp, "term", 4) == 0
343 		&& isspace(bp[4])) {
344 			bp += 4;
345 			return TERMINAL;
346 		} else if (c == '%' && strncmp(bp, "start", 5) == 0
347 		&& isspace(bp[5])) {
348 			bp += 5;
349 			return START;
350 		} else if (c == '"') {
351 			char *p = strchr(bp, '"');
352 			if (p == NULL) {
353 				yyerror("missing \" in assembler template\n");
354 				p = strchr(bp, '\n');
355 				if (p == NULL)
356 					p = strchr(bp, '\0');
357 			}
358 			assert(p);
359 			yylval.string = alloc(p - bp + 1);
360 			strncpy(yylval.string, bp, p - bp);
361 			yylval.string[p - bp] = 0;
362 			bp = *p == '"' ? p + 1 : p;
363 			code++;
364 			return TEMPLATE;
365 		} else if (isdigit(c)) {
366 			int n = 0;
367 			do {
368 				int d = c - '0';
369 				if (n > (INT_MAX - d)/10)
370 					yyerror("integer greater than %d\n", INT_MAX);
371 				else
372 					n = 10*n + d;
373 				c = get();
374 			} while (c != EOF && isdigit(c));
375 			bp--;
376 			yylval.n = n;
377 			return INT;
378 		} else if (isalpha(c)) {
379 			char *p = bp - 1;
380 			while (isalpha(*bp) || isdigit(*bp) || *bp == '_')
381 				bp++;
382 			yylval.string = alloc(bp - p + 1);
383 			strncpy(yylval.string, p, bp - p);
384 			yylval.string[bp - p] = 0;
385 			return ID;
386 		} else if (isprint(c))
387 			yyerror("invalid character `%c'\n", c);
388 		else
389 			yyerror("invalid character `\\%03o'\n", (unsigned char)c);
390 	}
391 	return 0;
392 }
393 
yywarn(char * fmt,...)394 void yywarn(char *fmt, ...) {
395 	va_list ap;
396 
397 	va_start(ap, fmt);
398 	if (yylineno > 0)
399 		fprintf(stderr, "line %d: ", yylineno);
400 	fprintf(stderr, "warning: ");
401 	vfprintf(stderr, fmt, ap);
402 }
403 #line 403 "y.tab.c"
404 #define YYABORT goto yyabort
405 #define YYACCEPT goto yyaccept
406 #define YYERROR goto yyerrlab
407 
408 #if YYDEBUG
409 #ifdef __cplusplus
410 extern "C" char *getenv();
411 #else
412 extern char *getenv();
413 #endif
414 #endif
415 
416 int
yyparse()417 yyparse()
418 {
419     register int yym, yyn, yystate;
420     register YYSTYPE *yyvsp;
421     register short *yyssp;
422     short *yysse;
423 #if YYDEBUG
424     register YYCONST char *yys;
425 
426     if (yys = getenv("YYDEBUG"))
427     {
428         yyn = *yys;
429         if (yyn >= '0' && yyn <= '9')
430             yydebug = yyn - '0';
431     }
432 #endif
433 
434     yynerrs = 0;
435     yyerrflag = 0;
436     yychar = (-1);
437 
438     if (yyss == 0)
439     {
440         yyss = (short *) yymalloc (YYSTACKSIZE * sizeof (short));
441         if (yyss == 0)
442           goto yyabort;
443         yyvs = (YYSTYPE *) yymalloc (YYSTACKSIZE * sizeof (YYSTYPE));
444         if (yyvs == 0)
445         {
446             yyfree (yyss);
447             goto yyabort;
448         }
449         yystacksize = YYSTACKSIZE;
450     }
451     yysse = yyss + yystacksize - 1;
452     yyssp = yyss;
453     yyvsp = yyvs;
454     *yyssp = yystate = 0;
455     goto yyloop;
456 
457 yypush_lex:
458     yyval = yylval;
459     yystate = yytable[yyn];
460 yypush:
461     if (yyssp >= yysse)
462     {
463         int depth = yyssp - yyss;
464         if (yygrow() != 0)
465              goto yyoverflow;
466         yysse = yyss + yystacksize -1;
467         yyssp = depth + yyss;
468         yyvsp = depth + yyvs;
469     }
470     *++yyssp = yystate;
471     *++yyvsp = yyval;
472 
473 yyloop:
474     if ((yyn = yydefred[yystate])) goto yyreduce;
475     yyn = yysindex[yystate];
476     if (yychar < 0)
477     {
478         if ((yychar = yylex()) < 0) yychar = 0;
479 #if YYDEBUG
480         if (yydebug)
481         {
482             yys = 0;
483             if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
484             if (!yys) yys = "illegal-symbol";
485             printf("yydebug: state %d, reading %d (%s)\n", yystate,
486                     yychar, yys);
487         }
488 #endif
489     }
490     if (yyn != 0
491         && ((yyn += yychar), ((unsigned)yyn <= (unsigned)YYTABLESIZE))
492         && yycheck[yyn] == yychar)
493     {
494 #if YYDEBUG
495         if (yydebug)
496             printf("yydebug: state %d, shifting to state %d\n",
497                     yystate, yytable[yyn]);
498 #endif
499         if (yyerrflag > 0)  --yyerrflag;
500         yychar = (-1);
501         goto yypush_lex;
502     }
503     yyn = yyrindex[yystate];
504     if (yyn != 0
505         && ((yyn += yychar), ((unsigned)yyn <= (unsigned)YYTABLESIZE))
506         && yycheck[yyn] == yychar)
507     {
508         yyn = yytable[yyn];
509         goto yyreduce;
510     }
511     if (yyerrflag) goto yyinrecovery;
512 #ifdef lint
513     goto yynewerror;
514 yynewerror:
515 #endif
516     yyerror("syntax error");
517 #ifdef lint
518     goto yyerrlab;
519 yyerrlab:
520 #endif
521     ++yynerrs;
522 yyinrecovery:
523     if (yyerrflag < 3)
524     {
525         yyerrflag = 3;
526         for (;;)
527         {
528             yyn = yysindex[*yyssp];
529             if (yyn != 0
530                 && ((yyn += YYERRCODE), ((unsigned)yyn <= (unsigned)YYTABLESIZE))
531                 && yycheck[yyn] == YYERRCODE)
532             {
533 #if YYDEBUG
534                 if (yydebug)
535                     printf("yydebug: state %d, error recovery shifting\
536  to state %d\n", *yyssp, yytable[yyn]);
537 #endif
538                 goto yypush_lex;
539             }
540             else
541             {
542 #if YYDEBUG
543                 if (yydebug)
544                     printf("yydebug: error recovery discarding state %d\n",
545                             *yyssp);
546 #endif
547                 if (yyssp <= yyss) goto yyabort;
548                 --yyssp;
549                 --yyvsp;
550             }
551         }
552     }
553     else
554     {
555         if (yychar == 0) goto yyabort;
556 #if YYDEBUG
557         if (yydebug)
558         {
559             yys = 0;
560             if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
561             if (!yys) yys = "illegal-symbol";
562             printf("yydebug: state %d, error recovery discards token %d (%s)\n",
563                     yystate, yychar, yys);
564         }
565 #endif
566         yychar = (-1);
567         goto yyloop;
568     }
569 yyreduce:
570 #if YYDEBUG
571     if (yydebug)
572         printf("yydebug: state %d, reducing by rule %d (%s)\n",
573                 yystate, yyn, yyrule[yyn]);
574 #endif
575     yym = yylen[yyn];
576     yyval = yyvsp[1-yym];
577     switch (yyn)
578     {
579 case 1:
580 #line 22 "lburg/gram.y"
581 { yylineno = 0; }
582 break;
583 case 2:
584 #line 23 "lburg/gram.y"
585 { yylineno = 0; }
586 break;
587 case 6:
588 #line 31 "lburg/gram.y"
589 {
590 		if (nonterm(yyvsp[-1].string)->number != 1)
591 			yyerror("redeclaration of the start symbol\n");
592 		}
593 break;
594 case 8:
595 #line 36 "lburg/gram.y"
596 { yyerrok; }
597 break;
598 case 10:
599 #line 40 "lburg/gram.y"
600 { term(yyvsp[-2].string, yyvsp[0].n); }
601 break;
602 case 12:
603 #line 44 "lburg/gram.y"
604 { rule(yyvsp[-5].string, yyvsp[-3].tree, yyvsp[-2].string, yyvsp[-1].string); }
605 break;
606 case 14:
607 #line 46 "lburg/gram.y"
608 { yyerrok; }
609 break;
610 case 15:
611 #line 49 "lburg/gram.y"
612 { nonterm(yyval.string = yyvsp[0].string); }
613 break;
614 case 16:
615 #line 52 "lburg/gram.y"
616 { yyval.tree = tree(yyvsp[0].string,  0,  0); }
617 break;
618 case 17:
619 #line 53 "lburg/gram.y"
620 { yyval.tree = tree(yyvsp[-3].string, yyvsp[-1].tree,  0); }
621 break;
622 case 18:
623 #line 54 "lburg/gram.y"
624 { yyval.tree = tree(yyvsp[-5].string, yyvsp[-3].tree, yyvsp[-1].tree); }
625 break;
626 case 19:
627 #line 57 "lburg/gram.y"
628 { if (*yyvsp[0].string == 0) yyval.string = "0"; }
629 break;
630 #line 630 "y.tab.c"
631     }
632     yyssp -= yym;
633     yyvsp -= yym;
634     yym = yylhs[yyn];
635     yystate = *yyssp;
636     if (yystate == 0 && yym == 0)
637     {
638 #if YYDEBUG
639         if (yydebug)
640             printf("yydebug: after reduction, shifting from state 0 to\
641  state %d\n", YYFINAL);
642 #endif
643         yystate = YYFINAL;
644         *++yyssp = YYFINAL;
645         *++yyvsp = yyval;
646         if (yychar < 0)
647         {
648             if ((yychar = yylex()) < 0) yychar = 0;
649 #if YYDEBUG
650             if (yydebug)
651             {
652                 yys = 0;
653                 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
654                 if (!yys) yys = "illegal-symbol";
655                 printf("yydebug: state %d, reading %d (%s)\n",
656                         YYFINAL, yychar, yys);
657             }
658 #endif
659         }
660         if (yychar == 0) goto yyaccept;
661         goto yyloop;
662     }
663     yyn = yygindex[yym];
664 	 if (yyn != 0
665         && ((yyn += yystate), ((unsigned)yyn <= (unsigned)YYTABLESIZE))
666         && yycheck[yyn] == yystate)
667         yystate = yytable[yyn];
668     else
669         yystate = yydgoto[yym];
670 #if YYDEBUG
671     if (yydebug)
672         printf("yydebug: after reduction, shifting from state %d \
673 to state %d\n", *yyssp, yystate);
674 #endif
675     goto yypush;
676 yyoverflow:
677     yyerror("yacc stack overflow");
678 yyabort:
679     return (1);
680 yyaccept:
681     return (0);
682 }
683