OpenCores
URL https://opencores.org/ocsvn/eco32/eco32/trunk

Subversion Repositories eco32

[/] [eco32/] [tags/] [eco32-0.22/] [lcc/] [lburg/] [gram.c] - Blame information for rev 150

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 hellwig
#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
22
#include <stdlib.h> /* for malloc/realloc/free */
23
#endif
24
#line 2 "lburg/gram.y"
25
#include <stdio.h>
26
#include <stdlib.h>
27
#include "lburg.h"
28
static char rcsid[] = "$Id: gram.c,v 2.1 2002/08/28 23:28:22 drh Exp $";
29
/*lint -e616 -e527 -e652 -esym(552,yynerrs) -esym(563,yynewstate,yyerrlab) */
30
static int yylineno = 0;
31
#line 8 "lburg/gram.y"
32
typedef union {
33
        int n;
34
        char *string;
35
        Tree tree;
36
} YYSTYPE;
37
#line 37 "y.tab.c"
38
#define TERMINAL 257
39
#define START 258
40
#define PPERCENT 259
41
#define ID 260
42
#define TEMPLATE 261
43
#define CODE 262
44
#define INT 263
45
#define YYERRCODE 256
46
static YYCONST short yylhs[] = {                                        -1,
47
    0,    0,    4,    4,    6,    6,    6,    6,    7,    7,
48
    5,    5,    5,    5,    1,    3,    3,    3,    2,
49
};
50
static YYCONST short yylen[] = {                                         2,
51
    3,    1,    0,    2,    3,    3,    1,    2,    0,    4,
52
    0,    7,    2,    3,    1,    1,    4,    6,    1,
53
};
54
static YYCONST short yydefred[] = {                                      3,
55
    0,    0,    0,    9,    0,   11,    7,    4,    8,    0,
56
   15,    0,    0,    0,    5,    6,    0,   13,    0,    0,
57
   14,    0,   10,    0,    0,    0,    0,    0,   19,    0,
58
   17,    0,   12,    0,   18,
59
};
60
static YYCONST short yydgoto[] = {                                       1,
61
   12,   30,   25,    2,   13,    8,   10,
62
};
63
static YYCONST short yysindex[] = {                                      0,
64
    0,   -4,   -2,    0, -250,    0,    0,    0,    0,   -9,
65
    0,    1,  -10,  -49,    0,    0,    3,    0,  -44, -248,
66
    0, -244,    0,  -22, -242, -244, -245,  -37,    0,   10,
67
    0, -244,    0,  -20,    0,
68
};
69
static YYCONST short yyrindex[] = {                                      0,
70
    0,   22,    0,    0,    0,    0,    0,    0,    0,    0,
71
    0,    0,   23,    0,    0,    0,    0,    0,    0,    0,
72
    0,    0,    0,  -39,    0,    0,    0,    0,    0,    0,
73
    0,    0,    0,    0,    0,
74
};
75
static YYCONST short yygindex[] = {                                      0,
76
   11,    0,  -23,    0,    0,    0,    0,
77
};
78
#define YYTABLESIZE 255
79
static YYCONST short yytable[] = {                                      18,
80
   15,   16,   28,   31,   16,    7,   32,    9,   34,   11,
81
   16,   20,   21,   22,   23,   24,   29,   26,   27,   33,
82
   35,    2,    1,   19,    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,    0,    0,    0,    0,    0,    0,    0,    0,    0,
101
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
102
    0,   16,    0,    0,    0,    0,    0,    0,    0,    0,
103
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
104
    0,    0,    0,    0,    0,   17,    0,    0,    0,   11,
105
   14,    3,    4,    5,    6,
106
};
107
static YYCONST short yycheck[] = {                                      10,
108
   10,   41,   26,   41,   44,   10,   44,   10,   32,  260,
109
   10,   61,   10,   58,  263,  260,  262,   40,  261,   10,
110
   41,    0,    0,   13,   -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,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
129
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
130
   -1,  261,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
131
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
132
   -1,   -1,   -1,   -1,   -1,  256,   -1,   -1,   -1,  260,
133
  260,  256,  257,  258,  259,
134
};
135
#define YYFINAL 1
136
#ifndef YYDEBUG
137
#define YYDEBUG 0
138
#endif
139
#define YYMAXTOKEN 263
140
#if YYDEBUG
141
static YYCONST char *YYCONST yyname[] = {
142
"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,
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,
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,
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,0,0,
147
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
148
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
149
"TERMINAL","START","PPERCENT","ID","TEMPLATE","CODE","INT",
150
};
151
static YYCONST char *YYCONST yyrule[] = {
152
"$accept : spec",
153
"spec : decls PPERCENT rules",
154
"spec : decls",
155
"decls :",
156
"decls : decls decl",
157
"decl : TERMINAL blist '\\n'",
158
"decl : START nonterm '\\n'",
159
"decl : '\\n'",
160
"decl : error '\\n'",
161
"blist :",
162
"blist : blist ID '=' INT",
163
"rules :",
164
"rules : rules nonterm ':' tree TEMPLATE cost '\\n'",
165
"rules : rules '\\n'",
166
"rules : rules error '\\n'",
167
"nonterm : ID",
168
"tree : ID",
169
"tree : ID '(' tree ')'",
170
"tree : ID '(' tree ',' tree ')'",
171
"cost : CODE",
172
};
173
#endif
174
#define YYLEX yylex()
175
#define YYEMPTY -1
176
#define yyclearin (yychar=(YYEMPTY))
177
#define yyerrok (yyerrflag=0)
178
#ifndef YYINITDEPTH
179
#define YYINITDEPTH 200
180
#endif
181
#ifdef YYSTACKSIZE
182
#ifndef YYMAXDEPTH
183
#define YYMAXDEPTH YYSTACKSIZE
184
#endif
185
#else
186
#ifdef YYMAXDEPTH
187
#define YYSTACKSIZE YYMAXDEPTH
188
#else
189
#define YYSTACKSIZE 500
190
#define YYMAXDEPTH 500
191
#endif
192
#endif
193
#ifndef YYMAXSTACKSIZE
194
#define YYMAXSTACKSIZE 10000
195
#endif
196
int yydebug;
197
int yynerrs;
198
int yyerrflag;
199
int yychar;
200
YYSTYPE yyval;
201
YYSTYPE yylval;
202
static short *yyss;
203
static YYSTYPE *yyvs;
204
static int yystacksize;
205
#define yyfree(x) free(x)
206
extern int yylex(void);
207
 
208
static YYPTR
209
YYDEFUN (yymalloc, (bytes), unsigned bytes)
210
{
211
    YYPTR ptr = (YYPTR) malloc (bytes);
212
    if (ptr != 0) return (ptr);
213
    yyerror ("yyparse: memory exhausted");
214
    return (0);
215
}
216
 
217
static YYPTR
218
YYDEFUN (yyrealloc, (old, bytes), YYPTR old YYAND unsigned bytes)
219
{
220
    YYPTR ptr = (YYPTR) realloc (old, bytes);
221
    if (ptr != 0) return (ptr);
222
    yyerror ("yyparse: memory exhausted");
223
    return (0);
224
}
225
 
226
static int
227
#ifdef __GNUC__
228
inline
229
#endif
230
yygrow (void)
231
{
232
    int old_stacksize = yystacksize;
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
 
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
 
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
 
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
 
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
417
yyparse(void)
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
#endif
515
yynewerror:
516
    yyerror("syntax error");
517
#ifdef lint
518
    goto yyerrlab;
519
#endif
520
yyerrlab:
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
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.