Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

gram.c

Go to the documentation of this file.
00001 #if defined(__STDC__) || defined(__cplusplus)
00002 #define YYCONST const
00003 #define YYPARAMS(x) x
00004 #define YYDEFUN(name, arglist, args) name(args)
00005 #define YYAND ,
00006 #define YYPTR void *
00007 #else
00008 #define YYCONST
00009 #define YYPARAMS(x) ()
00010 #define YYDEFUN(name, arglist, args) name arglist args;
00011 #define YYAND ;
00012 #define YYPTR char *
00013 #endif
00014 #ifndef lint
00015 YYCONST static char yysccsid[] = "@(#)yaccpar   1.8 (Berkeley +Cygnus.28) 01/20/91";
00016 #endif
00017 #define YYBYACC 1
00018 #ifndef YYDONT_INCLUDE_STDIO
00019 #include <stdio.h>
00020 #endif
00021 #ifdef __cplusplus
00022 #include <stdlib.h> /* for malloc/realloc/free */
00023 #endif
00024 #line 2 "lburg/gram.y"
00025 #include <stdio.h>
00026 #include "lburg.h"
00027 /*lint -e616 -e527 -e652 -esym(552,yynerrs) -esym(563,yynewstate,yyerrlab) */
00028 static int yylineno = 0;
00029 #line 8 "lburg/gram.y"
00030 typedef union {
00031     int n;
00032     char *string;
00033     Tree tree;
00034 } YYSTYPE;
00035 #line 37 "y.tab.c"
00036 #define TERMINAL 257
00037 #define START 258
00038 #define PPERCENT 259
00039 #define ID 260
00040 #define TEMPLATE 261
00041 #define CODE 262
00042 #define INT 263
00043 #define YYERRCODE 256
00044 static YYCONST short yylhs[] = {                                        -1,
00045     0,    0,    4,    4,    6,    6,    6,    6,    7,    7,
00046     5,    5,    5,    5,    1,    3,    3,    3,    2,
00047 };
00048 static YYCONST short yylen[] = {                                         2,
00049     3,    1,    0,    2,    3,    3,    1,    2,    0,    4,
00050     0,    7,    2,    3,    1,    1,    4,    6,    1,
00051 };
00052 static YYCONST short yydefred[] = {                                      3,
00053     0,    0,    0,    9,    0,   11,    7,    4,    8,    0,
00054    15,    0,    0,    0,    5,    6,    0,   13,    0,    0,
00055    14,    0,   10,    0,    0,    0,    0,    0,   19,    0,
00056    17,    0,   12,    0,   18,
00057 };
00058 static YYCONST short yydgoto[] = {                                       1,
00059    12,   30,   25,    2,   13,    8,   10,
00060 };
00061 static YYCONST short yysindex[] = {                                      0,
00062     0,   -4,   -2,    0, -250,    0,    0,    0,    0,   -9,
00063     0,    1,  -10,  -49,    0,    0,    3,    0,  -44, -248,
00064     0, -244,    0,  -22, -242, -244, -245,  -37,    0,   10,
00065     0, -244,    0,  -20,    0,
00066 };
00067 static YYCONST short yyrindex[] = {                                      0,
00068     0,   22,    0,    0,    0,    0,    0,    0,    0,    0,
00069     0,    0,   23,    0,    0,    0,    0,    0,    0,    0,
00070     0,    0,    0,  -39,    0,    0,    0,    0,    0,    0,
00071     0,    0,    0,    0,    0,
00072 };
00073 static YYCONST short yygindex[] = {                                      0,
00074    11,    0,  -23,    0,    0,    0,    0,
00075 };
00076 #define YYTABLESIZE 255
00077 static YYCONST short yytable[] = {                                      18,
00078    15,   16,   28,   31,   16,    7,   32,    9,   34,   11,
00079    16,   20,   21,   22,   23,   24,   29,   26,   27,   33,
00080    35,    2,    1,   19,    0,    0,    0,    0,    0,    0,
00081     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00082     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00083     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00084     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00085     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00086     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00087     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00088     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00089     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00090     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00091     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00092     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00093     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00094     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00095     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00096     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00097     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00098     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00099     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00100     0,   16,    0,    0,    0,    0,    0,    0,    0,    0,
00101     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00102     0,    0,    0,    0,    0,   17,    0,    0,    0,   11,
00103    14,    3,    4,    5,    6,
00104 };
00105 static YYCONST short yycheck[] = {                                      10,
00106    10,   41,   26,   41,   44,   10,   44,   10,   32,  260,
00107    10,   61,   10,   58,  263,  260,  262,   40,  261,   10,
00108    41,    0,    0,   13,   -1,   -1,   -1,   -1,   -1,   -1,
00109    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00110    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00111    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00112    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00113    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00114    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00115    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00116    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00117    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00118    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00119    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00120    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00121    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00122    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00123    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00124    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00125    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00126    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00127    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00128    -1,  261,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00129    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
00130    -1,   -1,   -1,   -1,   -1,  256,   -1,   -1,   -1,  260,
00131   260,  256,  257,  258,  259,
00132 };
00133 #define YYFINAL 1
00134 #ifndef YYDEBUG
00135 #define YYDEBUG 0
00136 #endif
00137 #define YYMAXTOKEN 263
00138 #if YYDEBUG
00139 static YYCONST char *YYCONST yyname[] = {
00140 "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,
00141 0,0,0,0,0,0,0,0,0,"'('","')'",0,0,"','",0,0,0,0,0,0,0,0,0,0,0,0,0,"':'",0,0,
00142 "'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
00143 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
00144 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
00145 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
00146 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
00147 "TERMINAL","START","PPERCENT","ID","TEMPLATE","CODE","INT",
00148 };
00149 static YYCONST char *YYCONST yyrule[] = {
00150 "$accept : spec",
00151 "spec : decls PPERCENT rules",
00152 "spec : decls",
00153 "decls :",
00154 "decls : decls decl",
00155 "decl : TERMINAL blist '\\n'",
00156 "decl : START nonterm '\\n'",
00157 "decl : '\\n'",
00158 "decl : error '\\n'",
00159 "blist :",
00160 "blist : blist ID '=' INT",
00161 "rules :",
00162 "rules : rules nonterm ':' tree TEMPLATE cost '\\n'",
00163 "rules : rules '\\n'",
00164 "rules : rules error '\\n'",
00165 "nonterm : ID",
00166 "tree : ID",
00167 "tree : ID '(' tree ')'",
00168 "tree : ID '(' tree ',' tree ')'",
00169 "cost : CODE",
00170 };
00171 #endif
00172 #define YYLEX yylex()
00173 #define YYEMPTY -1
00174 #define yyclearin (yychar=(YYEMPTY))
00175 #define yyerrok (yyerrflag=0)
00176 #ifndef YYINITDEPTH
00177 #define YYINITDEPTH 200
00178 #endif
00179 #ifdef YYSTACKSIZE
00180 #ifndef YYMAXDEPTH
00181 #define YYMAXDEPTH YYSTACKSIZE
00182 #endif
00183 #else
00184 #ifdef YYMAXDEPTH
00185 #define YYSTACKSIZE YYMAXDEPTH
00186 #else
00187 #define YYSTACKSIZE 500
00188 #define YYMAXDEPTH 500
00189 #endif
00190 #endif
00191 #ifndef YYMAXSTACKSIZE
00192 #define YYMAXSTACKSIZE 10000
00193 #endif
00194 int yydebug;
00195 int yynerrs;
00196 int yyerrflag;
00197 int yychar;
00198 YYSTYPE yyval;
00199 YYSTYPE yylval;
00200 static short *yyss;
00201 static YYSTYPE *yyvs;
00202 static int yystacksize;
00203 #define yyfree(x) free(x)
00204 extern int yylex();
00205 
00206 static YYPTR
00207 YYDEFUN (yymalloc, (bytes), unsigned bytes)
00208 {
00209     YYPTR ptr = (YYPTR) malloc (bytes);
00210     if (ptr != 0) return (ptr);
00211     yyerror ("yyparse: memory exhausted");
00212     return (0);
00213 }
00214 
00215 static YYPTR
00216 YYDEFUN (yyrealloc, (old, bytes), YYPTR old YYAND unsigned bytes)
00217 {
00218     YYPTR ptr = (YYPTR) realloc (old, bytes);
00219     if (ptr != 0) return (ptr);
00220     yyerror ("yyparse: memory exhausted");
00221     return (0);
00222 }
00223 
00224 static int
00225 #ifdef __GNUC__
00226 inline
00227 #endif
00228 yygrow ()
00229 {
00230     int old_stacksize = yystacksize;
00231     short *new_yyss;
00232     YYSTYPE *new_yyvs;
00233 
00234     if (yystacksize == YYMAXSTACKSIZE)
00235         return (1);
00236     yystacksize += (yystacksize + 1 ) / 2;
00237     if (yystacksize > YYMAXSTACKSIZE)
00238         yystacksize = YYMAXSTACKSIZE;
00239 #if YYDEBUG
00240     if (yydebug)
00241         printf("yydebug: growing stack size from %d to %d\n",
00242                old_stacksize, yystacksize);
00243 #endif
00244     new_yyss = (short *) yyrealloc ((char *)yyss, yystacksize * sizeof (short));
00245     if (new_yyss == 0)
00246         return (1);
00247     new_yyvs = (YYSTYPE *) yyrealloc ((char *)yyvs, yystacksize * sizeof (YYSTYPE));
00248     if (new_yyvs == 0)
00249     {
00250         yyfree (new_yyss);
00251         return (1);
00252     }
00253     yyss = new_yyss;
00254     yyvs = new_yyvs;
00255     return (0);
00256 }
00257 #line 60 "lburg/gram.y"
00258 #include <assert.h>
00259 #include <stdarg.h>
00260 #include <ctype.h>
00261 #include <string.h>
00262 #include <limits.h>
00263 
00264 int errcnt = 0;
00265 FILE *infp = NULL;
00266 FILE *outfp = NULL;
00267 static char buf[BUFSIZ], *bp = buf;
00268 static int ppercent = 0;
00269 static int code = 0;
00270 
00271 static int get(void) {
00272     if (*bp == 0) {
00273         bp = buf;
00274         *bp = 0;
00275         if (fgets(buf, sizeof buf, infp) == NULL)
00276             return EOF;
00277         yylineno++;
00278         while (buf[0] == '%' && buf[1] == '{' && buf[2] == '\n') {
00279             for (;;) {
00280                 if (fgets(buf, sizeof buf, infp) == NULL) {
00281                     yywarn("unterminated %{...%}\n");
00282                     return EOF;
00283                 }
00284                 yylineno++;
00285                 if (strcmp(buf, "%}\n") == 0)
00286                     break;
00287                 fputs(buf, outfp);
00288             }
00289             if (fgets(buf, sizeof buf, infp) == NULL)
00290                 return EOF;
00291             yylineno++;
00292         }
00293     }
00294     return *bp++;
00295 }
00296 
00297 void yyerror(char *fmt, ...) {
00298     va_list ap;
00299 
00300     va_start(ap, fmt);
00301     if (yylineno > 0)
00302         fprintf(stderr, "line %d: ", yylineno);
00303     vfprintf(stderr, fmt, ap);
00304     if (fmt[strlen(fmt)-1] != '\n')
00305          fprintf(stderr, "\n");
00306     errcnt++;
00307     va_end(ap);
00308 }
00309 
00310 int yylex(void) {
00311     int c;
00312 
00313     if (code) {
00314         char *p;
00315         bp += strspn(bp, " \t\f");
00316         p = strchr(bp, '\n');
00317         if (p == NULL)
00318             p = strchr(bp, '\n');
00319         while (p > bp && isspace(p[-1]))
00320             p--;
00321         yylval.string = alloc(p - bp + 1);
00322         strncpy(yylval.string, bp, p - bp);
00323         yylval.string[p - bp] = 0;
00324         bp = p;
00325         code--;
00326         return CODE;
00327     }
00328     while ((c = get()) != EOF) {
00329         switch (c) {
00330         case ' ': case '\f': case '\t':
00331             continue;
00332         case '\n':
00333         case '(': case ')': case ',':
00334         case ':': case '=':
00335             return c;
00336         }
00337         if (c == '%' && *bp == '%') {
00338             bp++;
00339             return ppercent++ ? 0 : PPERCENT;
00340         } else if (c == '%' && strncmp(bp, "term", 4) == 0
00341         && isspace(bp[4])) {
00342             bp += 4;
00343             return TERMINAL;
00344         } else if (c == '%' && strncmp(bp, "start", 5) == 0
00345         && isspace(bp[5])) {
00346             bp += 5;
00347             return START;
00348         } else if (c == '"') {
00349             char *p = strchr(bp, '"');
00350             if (p == NULL) {
00351                 yyerror("missing \" in assembler template\n");
00352                 p = strchr(bp, '\n');
00353                 if (p == NULL)
00354                     p = strchr(bp, '\0');
00355             }
00356             assert(p);
00357             yylval.string = alloc(p - bp + 1);
00358             strncpy(yylval.string, bp, p - bp);
00359             yylval.string[p - bp] = 0;
00360             bp = *p == '"' ? p + 1 : p;
00361             code++;
00362             return TEMPLATE;
00363         } else if (isdigit(c)) {
00364             int n = 0;
00365             do {
00366                 int d = c - '0';
00367                 if (n > (INT_MAX - d)/10)
00368                     yyerror("integer greater than %d\n", INT_MAX);
00369                 else
00370                     n = 10*n + d;
00371                 c = get();
00372             } while (c != EOF && isdigit(c));
00373             bp--;
00374             yylval.n = n;
00375             return INT;
00376         } else if (isalpha(c)) {
00377             char *p = bp - 1;
00378             while (isalpha(*bp) || isdigit(*bp) || *bp == '_')
00379                 bp++;
00380             yylval.string = alloc(bp - p + 1);
00381             strncpy(yylval.string, p, bp - p);
00382             yylval.string[bp - p] = 0;
00383             return ID;
00384         } else if (isprint(c))
00385             yyerror("invalid character `%c'\n", c);
00386         else
00387             yyerror("invalid character `\\%03o'\n", (unsigned char)c);
00388     }
00389     return 0;
00390 }
00391 
00392 void yywarn(char *fmt, ...) {
00393     va_list ap;
00394 
00395     va_start(ap, fmt);
00396     if (yylineno > 0)
00397         fprintf(stderr, "line %d: ", yylineno);
00398     fprintf(stderr, "warning: ");
00399     vfprintf(stderr, fmt, ap);
00400 }
00401 #line 403 "y.tab.c"
00402 #define YYABORT goto yyabort
00403 #define YYACCEPT goto yyaccept
00404 #define YYERROR goto yyerrlab
00405 
00406 #if YYDEBUG
00407 #ifdef __cplusplus
00408 extern "C" char *getenv();
00409 #else
00410 extern char *getenv();
00411 #endif
00412 #endif
00413 
00414 int
00415 yyparse()
00416 {
00417     register int yym, yyn, yystate;
00418     register YYSTYPE *yyvsp;
00419     register short *yyssp;
00420     short *yysse;
00421 #if YYDEBUG
00422     register YYCONST char *yys;
00423 
00424     if (yys = getenv("YYDEBUG"))
00425     {
00426         yyn = *yys;
00427         if (yyn >= '0' && yyn <= '9')
00428             yydebug = yyn - '0';
00429     }
00430 #endif
00431 
00432     yynerrs = 0;
00433     yyerrflag = 0;
00434     yychar = (-1);
00435 
00436     if (yyss == 0)
00437     {
00438         yyss = (short *) yymalloc (YYSTACKSIZE * sizeof (short));
00439         if (yyss == 0)
00440           goto yyabort;
00441         yyvs = (YYSTYPE *) yymalloc (YYSTACKSIZE * sizeof (YYSTYPE));
00442         if (yyvs == 0)
00443         {
00444             yyfree (yyss);
00445             goto yyabort;
00446         }
00447         yystacksize = YYSTACKSIZE;
00448     }
00449     yysse = yyss + yystacksize - 1;
00450     yyssp = yyss;
00451     yyvsp = yyvs;
00452     *yyssp = yystate = 0;
00453     goto yyloop;
00454 
00455 yypush_lex:
00456     yyval = yylval;
00457     yystate = yytable[yyn];
00458 yypush:
00459     if (yyssp >= yysse)
00460     {
00461         int depth = yyssp - yyss;
00462         if (yygrow() != 0)
00463              goto yyoverflow;
00464         yysse = yyss + yystacksize -1;
00465         yyssp = depth + yyss;
00466         yyvsp = depth + yyvs;
00467     }
00468     *++yyssp = yystate;
00469     *++yyvsp = yyval;
00470 
00471 yyloop:
00472     if (yyn = yydefred[yystate]) goto yyreduce;
00473     yyn = yysindex[yystate];
00474     if (yychar < 0)
00475     {
00476         if ((yychar = yylex()) < 0) yychar = 0;
00477 #if YYDEBUG
00478         if (yydebug)
00479         {
00480             yys = 0;
00481             if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
00482             if (!yys) yys = "illegal-symbol";
00483             printf("yydebug: state %d, reading %d (%s)\n", yystate,
00484                     yychar, yys);
00485         }
00486 #endif
00487     }
00488     if (yyn != 0
00489         && ((yyn += yychar), ((unsigned)yyn <= (unsigned)YYTABLESIZE))
00490         && yycheck[yyn] == yychar)
00491     {
00492 #if YYDEBUG
00493         if (yydebug)
00494             printf("yydebug: state %d, shifting to state %d\n",
00495                     yystate, yytable[yyn]);
00496 #endif
00497         if (yyerrflag > 0)  --yyerrflag;
00498         yychar = (-1);
00499         goto yypush_lex;
00500     }
00501     yyn = yyrindex[yystate];
00502     if (yyn != 0
00503         && ((yyn += yychar), ((unsigned)yyn <= (unsigned)YYTABLESIZE))
00504         && yycheck[yyn] == yychar)
00505     {
00506         yyn = yytable[yyn];
00507         goto yyreduce;
00508     }
00509     if (yyerrflag) goto yyinrecovery;
00510 #ifdef lint
00511     goto yynewerror;
00512 #endif
00513 yynewerror:
00514     yyerror("syntax error");
00515 #ifdef lint
00516     goto yyerrlab;
00517 #endif
00518 yyerrlab:
00519     ++yynerrs;
00520 yyinrecovery:
00521     if (yyerrflag < 3)
00522     {
00523         yyerrflag = 3;
00524         for (;;)
00525         {
00526             yyn = yysindex[*yyssp];
00527             if (yyn != 0
00528                 && ((yyn += YYERRCODE), ((unsigned)yyn <= (unsigned)YYTABLESIZE))
00529                 && yycheck[yyn] == YYERRCODE)
00530             {
00531 #if YYDEBUG
00532                 if (yydebug)
00533                     printf("yydebug: state %d, error recovery shifting\
00534  to state %d\n", *yyssp, yytable[yyn]);
00535 #endif
00536                 goto yypush_lex;
00537             }
00538             else
00539             {
00540 #if YYDEBUG
00541                 if (yydebug)
00542                     printf("yydebug: error recovery discarding state %d\n",
00543                             *yyssp);
00544 #endif
00545                 if (yyssp <= yyss) goto yyabort;
00546                 --yyssp;
00547                 --yyvsp;
00548             }
00549         }
00550     }
00551     else
00552     {
00553         if (yychar == 0) goto yyabort;
00554 #if YYDEBUG
00555         if (yydebug)
00556         {
00557             yys = 0;
00558             if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
00559             if (!yys) yys = "illegal-symbol";
00560             printf("yydebug: state %d, error recovery discards token %d (%s)\n",
00561                     yystate, yychar, yys);
00562         }
00563 #endif
00564         yychar = (-1);
00565         goto yyloop;
00566     }
00567 yyreduce:
00568 #if YYDEBUG
00569     if (yydebug)
00570         printf("yydebug: state %d, reducing by rule %d (%s)\n",
00571                 yystate, yyn, yyrule[yyn]);
00572 #endif
00573     yym = yylen[yyn];
00574     yyval = yyvsp[1-yym];
00575     switch (yyn)
00576     {
00577 case 1:
00578 #line 22 "lburg/gram.y"
00579 { yylineno = 0; }
00580 break;
00581 case 2:
00582 #line 23 "lburg/gram.y"
00583 { yylineno = 0; }
00584 break;
00585 case 6:
00586 #line 31 "lburg/gram.y"
00587 {
00588         if (nonterm(yyvsp[-1].string)->number != 1)
00589             yyerror("redeclaration of the start symbol\n");
00590         }
00591 break;
00592 case 8:
00593 #line 36 "lburg/gram.y"
00594 { yyerrok; }
00595 break;
00596 case 10:
00597 #line 40 "lburg/gram.y"
00598 { term(yyvsp[-2].string, yyvsp[0].n); }
00599 break;
00600 case 12:
00601 #line 44 "lburg/gram.y"
00602 { rule(yyvsp[-5].string, yyvsp[-3].tree, yyvsp[-2].string, yyvsp[-1].string); }
00603 break;
00604 case 14:
00605 #line 46 "lburg/gram.y"
00606 { yyerrok; }
00607 break;
00608 case 15:
00609 #line 49 "lburg/gram.y"
00610 { nonterm(yyval.string = yyvsp[0].string); }
00611 break;
00612 case 16:
00613 #line 52 "lburg/gram.y"
00614 { yyval.tree = tree(yyvsp[0].string,  0,  0); }
00615 break;
00616 case 17:
00617 #line 53 "lburg/gram.y"
00618 { yyval.tree = tree(yyvsp[-3].string, yyvsp[-1].tree,  0); }
00619 break;
00620 case 18:
00621 #line 54 "lburg/gram.y"
00622 { yyval.tree = tree(yyvsp[-5].string, yyvsp[-3].tree, yyvsp[-1].tree); }
00623 break;
00624 case 19:
00625 #line 57 "lburg/gram.y"
00626 { if (*yyvsp[0].string == 0) yyval.string = "0"; }
00627 break;
00628 #line 630 "y.tab.c"
00629     }
00630     yyssp -= yym;
00631     yyvsp -= yym;
00632     yym = yylhs[yyn];
00633     yystate = *yyssp;
00634     if (yystate == 0 && yym == 0)
00635     {
00636 #if YYDEBUG
00637         if (yydebug)
00638             printf("yydebug: after reduction, shifting from state 0 to\
00639  state %d\n", YYFINAL);
00640 #endif
00641         yystate = YYFINAL;
00642         *++yyssp = YYFINAL;
00643         *++yyvsp = yyval;
00644         if (yychar < 0)
00645         {
00646             if ((yychar = yylex()) < 0) yychar = 0;
00647 #if YYDEBUG
00648             if (yydebug)
00649             {
00650                 yys = 0;
00651                 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
00652                 if (!yys) yys = "illegal-symbol";
00653                 printf("yydebug: state %d, reading %d (%s)\n",
00654                         YYFINAL, yychar, yys);
00655             }
00656 #endif
00657         }
00658         if (yychar == 0) goto yyaccept;
00659         goto yyloop;
00660     }
00661     yyn = yygindex[yym];
00662      if (yyn != 0
00663         && ((yyn += yystate), ((unsigned)yyn <= (unsigned)YYTABLESIZE))
00664         && yycheck[yyn] == yystate)
00665         yystate = yytable[yyn];
00666     else
00667         yystate = yydgoto[yym];
00668 #if YYDEBUG
00669     if (yydebug)
00670         printf("yydebug: after reduction, shifting from state %d \
00671 to state %d\n", *yyssp, yystate);
00672 #endif
00673     goto yypush;
00674 yyoverflow:
00675     yyerror("yacc stack overflow");
00676 yyabort:
00677     return (1);
00678 yyaccept:
00679     return (0);
00680 }

Generated on Thu Aug 25 12:38:11 2005 for Quake III Arena by  doxygen 1.3.9.1