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

Subversion Repositories diogenes

[/] [diogenes/] [trunk/] [compiler/] [lcc-4.2/] [lburg/] [gram.c] - Blame information for rev 52

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

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

powered by: WebSVN 2.1.0

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