]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - tools/regression/usr.bin/yacc/regress.12.out
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / tools / regression / usr.bin / yacc / regress.12.out
1 #ifndef lint
2 static const char yysccsid[] = "@(#)yaccpar     1.9 (Berkeley) 02/21/93";
3 #endif
4
5 #define YYBYACC 1
6 #define YYMAJOR 1
7 #define YYMINOR 9
8
9 #define YYEMPTY        (-1)
10 #define yyclearin      (yychar = YYEMPTY)
11 #define yyerrok        (yyerrflag = 0)
12 #define YYRECOVERING() (yyerrflag != 0)
13
14 #define YYPREFIX "yy"
15
16 #define YYPURE 0
17
18 #line 2 "quote_calc2.y"
19 # include <stdio.h>
20 # include <ctype.h>
21
22 int regs[26];
23 int base;
24
25 int yylex(void);
26 static void yyerror(const char *s);
27
28 #line 28 "/dev/stdout"
29
30 #ifndef YYSTYPE
31 typedef int YYSTYPE;
32 #endif
33
34 /* compatibility with bison */
35 #ifdef YYPARSE_PARAM
36 /* compatibility with FreeBSD */
37 # ifdef YYPARSE_PARAM_TYPE
38 #  define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
39 # else
40 #  define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
41 # endif
42 #else
43 # define YYPARSE_DECL() yyparse(void)
44 #endif
45
46 /* Parameters sent to lex. */
47 #ifdef YYLEX_PARAM
48 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
49 # define YYLEX yylex(YYLEX_PARAM)
50 #else
51 # define YYLEX_DECL() yylex(void)
52 # define YYLEX yylex()
53 #endif
54
55 /* Parameters sent to yyerror. */
56 #ifndef YYERROR_DECL
57 #define YYERROR_DECL() yyerror(const char *s)
58 #endif
59 #ifndef YYERROR_CALL
60 #define YYERROR_CALL(msg) yyerror(msg)
61 #endif
62
63 extern int YYPARSE_DECL();
64
65 #define OP_ADD 257
66 #define ADD 258
67 #define OP_SUB 259
68 #define SUB 260
69 #define OP_MUL 261
70 #define MUL 262
71 #define OP_DIV 263
72 #define DIV 264
73 #define OP_MOD 265
74 #define MOD 266
75 #define OP_AND 267
76 #define AND 268
77 #define DIGIT 269
78 #define LETTER 270
79 #define UMINUS 271
80 #define YYERRCODE 256
81 static const short yylhs[] = {                           -1,
82     0,    0,    0,    1,    1,    2,    2,    2,    2,    2,
83     2,    2,    2,    2,    2,    2,    3,    3,
84 };
85 static const short yylen[] = {                            2,
86     0,    3,    3,    1,    3,    3,    3,    3,    3,    3,
87     3,    3,    3,    2,    1,    1,    1,    2,
88 };
89 static const short yydefred[] = {                         1,
90     0,    0,    0,   17,    0,    0,    0,    0,    0,    3,
91    15,    0,    0,    0,    2,    0,    0,    0,    0,    0,
92     0,    0,   18,    0,    6,    0,    0,    0,    0,    0,
93     0,    0,
94 };
95 static const short yydgoto[] = {                          1,
96     7,    8,    9,
97 };
98 static const short yysindex[] = {                         0,
99   -38,    4,  -36,    0,  -51,  -36,    6, -121, -249,    0,
100     0, -243,  -36,  -23,    0,  -36,  -36,  -36,  -36,  -36,
101   -36,  -36,    0, -121,    0, -121, -121, -121, -121, -121,
102  -121, -243,
103 };
104 static const short yyrindex[] = {                         0,
105     0,    0,    0,    0,   -9,    0,    0,   12,  -10,    0,
106     0,   -5,    0,    0,    0,    0,    0,    0,    0,    0,
107     0,    0,    0,   14,    0,   -3,   -2,   -1,    1,    2,
108     3,   -4,
109 };
110 static const short yygindex[] = {                         0,
111     0,   42,    0,
112 };
113 #define YYTABLESIZE 259
114 static const short yytable[] = {                         16,
115    15,    6,   22,    6,   14,   13,    7,    8,    9,   13,
116    10,   11,   12,   10,   16,   15,   17,   25,   18,   23,
117    19,    4,   20,    5,   21,    0,    0,    0,    0,    0,
118    16,    0,    0,    0,    0,   14,   13,    7,    8,    9,
119     0,   10,   11,   12,   12,    0,    0,   14,    0,    0,
120     0,    0,    0,    0,   24,    0,    0,   26,   27,   28,
121    29,   30,   31,   32,    0,    0,    0,    0,    0,    0,
122     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
123     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
124     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
125    22,    0,    0,    0,    0,    0,    0,    0,    0,    0,
126     0,    0,    0,   16,   15,    0,    0,    0,   14,   13,
127     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
128     0,    0,    0,    0,    0,    0,   16,    0,   17,    0,
129    18,    0,   19,    0,   20,    0,   21,    0,    0,    0,
130     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
131     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
132     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
133     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
134     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
135     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
136     0,    0,    0,    0,    0,    0,    0,    2,    0,    0,
137     0,    3,    0,    3,    0,    0,    0,    0,    0,    0,
138     4,    5,    4,   11,   16,    0,   17,    0,   18,    0,
139    19,    0,   20,    0,   21,    0,    0,   16,   15,   16,
140    15,   16,   15,   16,   15,   16,   15,   16,   15,
141 };
142 static const short yycheck[] = {                         10,
143    10,   40,  124,   40,   10,   10,   10,   10,   10,   61,
144    10,   10,   10,   10,  258,   10,  260,   41,  262,  269,
145   264,   10,  266,   10,  268,   -1,   -1,   -1,   -1,   -1,
146    41,   -1,   -1,   -1,   -1,   41,   41,   41,   41,   41,
147    -1,   41,   41,   41,    3,   -1,   -1,    6,   -1,   -1,
148    -1,   -1,   -1,   -1,   13,   -1,   -1,   16,   17,   18,
149    19,   20,   21,   22,   -1,   -1,   -1,   -1,   -1,   -1,
150    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
151    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
152    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
153   124,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
154    -1,   -1,   -1,  124,  124,   -1,   -1,   -1,  124,  124,
155    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
156    -1,   -1,   -1,   -1,   -1,   -1,  258,   -1,  260,   -1,
157   262,   -1,  264,   -1,  266,   -1,  268,   -1,   -1,   -1,
158    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
159    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
160    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
161    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
162    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
163    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
164    -1,   -1,   -1,   -1,   -1,   -1,   -1,  256,   -1,   -1,
165    -1,  260,   -1,  260,   -1,   -1,   -1,   -1,   -1,   -1,
166   269,  270,  269,  270,  258,   -1,  260,   -1,  262,   -1,
167   264,   -1,  266,   -1,  268,   -1,   -1,  258,  258,  260,
168   260,  262,  262,  264,  264,  266,  266,  268,  268,
169 };
170 #define YYFINAL 1
171 #ifndef YYDEBUG
172 #define YYDEBUG 0
173 #endif
174 #define YYMAXTOKEN 271
175 #if YYDEBUG
176 static const char *yyname[] = {
177
178 "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,
179 0,0,0,0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,
180 0,0,0,0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
181 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,
182 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
183 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
184 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
185 0,0,0,0,0,0,"OP_ADD","\"ADD\"","OP_SUB","\"SUB\"","OP_MUL","\"MUL\"","OP_DIV",
186 "\"DIV\"","OP_MOD","\"MOD\"","OP_AND","\"AND\"","DIGIT","LETTER","UMINUS",
187 };
188 static const char *yyrule[] = {
189 "$accept : list",
190 "list :",
191 "list : list stat '\\n'",
192 "list : list error '\\n'",
193 "stat : expr",
194 "stat : LETTER '=' expr",
195 "expr : '(' expr ')'",
196 "expr : expr \"ADD\" expr",
197 "expr : expr \"SUB\" expr",
198 "expr : expr \"MUL\" expr",
199 "expr : expr \"DIV\" expr",
200 "expr : expr \"MOD\" expr",
201 "expr : expr \"AND\" expr",
202 "expr : expr '|' expr",
203 "expr : \"SUB\" expr",
204 "expr : LETTER",
205 "expr : number",
206 "number : DIGIT",
207 "number : number DIGIT",
208
209 };
210 #endif
211
212 int      yydebug;
213 int      yynerrs;
214
215 int      yyerrflag;
216 int      yychar;
217 YYSTYPE  yyval;
218 YYSTYPE  yylval;
219
220 /* define the initial stack-sizes */
221 #ifdef YYSTACKSIZE
222 #undef YYMAXDEPTH
223 #define YYMAXDEPTH  YYSTACKSIZE
224 #else
225 #ifdef YYMAXDEPTH
226 #define YYSTACKSIZE YYMAXDEPTH
227 #else
228 #define YYSTACKSIZE 500
229 #define YYMAXDEPTH  500
230 #endif
231 #endif
232
233 #define YYINITSTACKSIZE 500
234
235 typedef struct {
236     unsigned stacksize;
237     short    *s_base;
238     short    *s_mark;
239     short    *s_last;
240     YYSTYPE  *l_base;
241     YYSTYPE  *l_mark;
242 } YYSTACKDATA;
243 /* variables for the parser stack */
244 static YYSTACKDATA yystack;
245 #line 73 "quote_calc2.y"
246  /* start of programs */
247
248 int
249 main (void)
250 {
251     while(!feof(stdin)) {
252         yyparse();
253     }
254     return 0;
255 }
256
257 static void
258 yyerror(const char *s)
259 {
260     fprintf(stderr, "%s\n", s);
261 }
262
263 int
264 yylex(void) {
265         /* lexical analysis routine */
266         /* returns LETTER for a lower case letter, yylval = 0 through 25 */
267         /* return DIGIT for a digit, yylval = 0 through 9 */
268         /* all other characters are returned immediately */
269
270     int c;
271
272     while( (c=getchar()) == ' ' )   { /* skip blanks */ }
273
274     /* c is now nonblank */
275
276     if( islower( c )) {
277         yylval = c - 'a';
278         return ( LETTER );
279     }
280     if( isdigit( c )) {
281         yylval = c - '0';
282         return ( DIGIT );
283     }
284     return( c );
285 }
286 #line 286 "/dev/stdout"
287
288 #if YYDEBUG
289 #include <stdio.h>              /* needed for printf */
290 #endif
291
292 #include <stdlib.h>     /* needed for malloc, etc */
293 #include <string.h>     /* needed for memset */
294
295 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
296 static int yygrowstack(YYSTACKDATA *data)
297 {
298     int i;
299     unsigned newsize;
300     short *newss;
301     YYSTYPE *newvs;
302
303     if ((newsize = data->stacksize) == 0)
304         newsize = YYINITSTACKSIZE;
305     else if (newsize >= YYMAXDEPTH)
306         return -1;
307     else if ((newsize *= 2) > YYMAXDEPTH)
308         newsize = YYMAXDEPTH;
309
310     i = data->s_mark - data->s_base;
311     newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
312     if (newss == 0)
313         return -1;
314
315     data->s_base = newss;
316     data->s_mark = newss + i;
317
318     newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
319     if (newvs == 0)
320         return -1;
321
322     data->l_base = newvs;
323     data->l_mark = newvs + i;
324
325     data->stacksize = newsize;
326     data->s_last = data->s_base + newsize - 1;
327     return 0;
328 }
329
330 #if YYPURE || defined(YY_NO_LEAKS)
331 static void yyfreestack(YYSTACKDATA *data)
332 {
333     free(data->s_base);
334     free(data->l_base);
335     memset(data, 0, sizeof(*data));
336 }
337 #else
338 #define yyfreestack(data) /* nothing */
339 #endif
340
341 #define YYABORT  goto yyabort
342 #define YYREJECT goto yyabort
343 #define YYACCEPT goto yyaccept
344 #define YYERROR  goto yyerrlab
345
346 int
347 YYPARSE_DECL()
348 {
349     int yym, yyn, yystate;
350 #if YYDEBUG
351     const char *yys;
352
353     if ((yys = getenv("YYDEBUG")) != 0)
354     {
355         yyn = *yys;
356         if (yyn >= '0' && yyn <= '9')
357             yydebug = yyn - '0';
358     }
359 #endif
360
361     yynerrs = 0;
362     yyerrflag = 0;
363     yychar = YYEMPTY;
364     yystate = 0;
365
366 #if YYPURE
367     memset(&yystack, 0, sizeof(yystack));
368 #endif
369
370     if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow;
371     yystack.s_mark = yystack.s_base;
372     yystack.l_mark = yystack.l_base;
373     yystate = 0;
374     *yystack.s_mark = 0;
375
376 yyloop:
377     if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
378     if (yychar < 0)
379     {
380         if ((yychar = YYLEX) < 0) yychar = 0;
381 #if YYDEBUG
382         if (yydebug)
383         {
384             yys = 0;
385             if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
386             if (!yys) yys = "illegal-symbol";
387             printf("%sdebug: state %d, reading %d (%s)\n",
388                     YYPREFIX, yystate, yychar, yys);
389         }
390 #endif
391     }
392     if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
393             yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
394     {
395 #if YYDEBUG
396         if (yydebug)
397             printf("%sdebug: state %d, shifting to state %d\n",
398                     YYPREFIX, yystate, yytable[yyn]);
399 #endif
400         if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
401         {
402             goto yyoverflow;
403         }
404         yystate = yytable[yyn];
405         *++yystack.s_mark = yytable[yyn];
406         *++yystack.l_mark = yylval;
407         yychar = YYEMPTY;
408         if (yyerrflag > 0)  --yyerrflag;
409         goto yyloop;
410     }
411     if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
412             yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
413     {
414         yyn = yytable[yyn];
415         goto yyreduce;
416     }
417     if (yyerrflag) goto yyinrecovery;
418
419     yyerror("syntax error");
420
421     goto yyerrlab;
422
423 yyerrlab:
424     ++yynerrs;
425
426 yyinrecovery:
427     if (yyerrflag < 3)
428     {
429         yyerrflag = 3;
430         for (;;)
431         {
432             if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
433                     yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
434             {
435 #if YYDEBUG
436                 if (yydebug)
437                     printf("%sdebug: state %d, error recovery shifting\
438  to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
439 #endif
440                 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
441                 {
442                     goto yyoverflow;
443                 }
444                 yystate = yytable[yyn];
445                 *++yystack.s_mark = yytable[yyn];
446                 *++yystack.l_mark = yylval;
447                 goto yyloop;
448             }
449             else
450             {
451 #if YYDEBUG
452                 if (yydebug)
453                     printf("%sdebug: error recovery discarding state %d\n",
454                             YYPREFIX, *yystack.s_mark);
455 #endif
456                 if (yystack.s_mark <= yystack.s_base) goto yyabort;
457                 --yystack.s_mark;
458                 --yystack.l_mark;
459             }
460         }
461     }
462     else
463     {
464         if (yychar == 0) goto yyabort;
465 #if YYDEBUG
466         if (yydebug)
467         {
468             yys = 0;
469             if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
470             if (!yys) yys = "illegal-symbol";
471             printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
472                     YYPREFIX, yystate, yychar, yys);
473         }
474 #endif
475         yychar = YYEMPTY;
476         goto yyloop;
477     }
478
479 yyreduce:
480 #if YYDEBUG
481     if (yydebug)
482         printf("%sdebug: state %d, reducing by rule %d (%s)\n",
483                 YYPREFIX, yystate, yyn, yyrule[yyn]);
484 #endif
485     yym = yylen[yyn];
486     if (yym)
487         yyval = yystack.l_mark[1-yym];
488     else
489         memset(&yyval, 0, sizeof yyval);
490     switch (yyn)
491     {
492 case 3:
493 #line 35 "quote_calc2.y"
494         {  yyerrok ; }
495 break;
496 case 4:
497 #line 39 "quote_calc2.y"
498         {  printf("%d\n",yystack.l_mark[0]);}
499 break;
500 case 5:
501 #line 41 "quote_calc2.y"
502         {  regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
503 break;
504 case 6:
505 #line 45 "quote_calc2.y"
506         {  yyval = yystack.l_mark[-1]; }
507 break;
508 case 7:
509 #line 47 "quote_calc2.y"
510         {  yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
511 break;
512 case 8:
513 #line 49 "quote_calc2.y"
514         {  yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
515 break;
516 case 9:
517 #line 51 "quote_calc2.y"
518         {  yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
519 break;
520 case 10:
521 #line 53 "quote_calc2.y"
522         {  yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
523 break;
524 case 11:
525 #line 55 "quote_calc2.y"
526         {  yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
527 break;
528 case 12:
529 #line 57 "quote_calc2.y"
530         {  yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
531 break;
532 case 13:
533 #line 59 "quote_calc2.y"
534         {  yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
535 break;
536 case 14:
537 #line 61 "quote_calc2.y"
538         {  yyval = - yystack.l_mark[0]; }
539 break;
540 case 15:
541 #line 63 "quote_calc2.y"
542         {  yyval = regs[yystack.l_mark[0]]; }
543 break;
544 case 17:
545 #line 68 "quote_calc2.y"
546         {  yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; }
547 break;
548 case 18:
549 #line 70 "quote_calc2.y"
550         {  yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
551 break;
552 #line 552 "/dev/stdout"
553     }
554     yystack.s_mark -= yym;
555     yystate = *yystack.s_mark;
556     yystack.l_mark -= yym;
557     yym = yylhs[yyn];
558     if (yystate == 0 && yym == 0)
559     {
560 #if YYDEBUG
561         if (yydebug)
562             printf("%sdebug: after reduction, shifting from state 0 to\
563  state %d\n", YYPREFIX, YYFINAL);
564 #endif
565         yystate = YYFINAL;
566         *++yystack.s_mark = YYFINAL;
567         *++yystack.l_mark = yyval;
568         if (yychar < 0)
569         {
570             if ((yychar = YYLEX) < 0) yychar = 0;
571 #if YYDEBUG
572             if (yydebug)
573             {
574                 yys = 0;
575                 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
576                 if (!yys) yys = "illegal-symbol";
577                 printf("%sdebug: state %d, reading %d (%s)\n",
578                         YYPREFIX, YYFINAL, yychar, yys);
579             }
580 #endif
581         }
582         if (yychar == 0) goto yyaccept;
583         goto yyloop;
584     }
585     if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
586             yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
587         yystate = yytable[yyn];
588     else
589         yystate = yydgoto[yym];
590 #if YYDEBUG
591     if (yydebug)
592         printf("%sdebug: after reduction, shifting from state %d \
593 to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
594 #endif
595     if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
596     {
597         goto yyoverflow;
598     }
599     *++yystack.s_mark = (short) yystate;
600     *++yystack.l_mark = yyval;
601     goto yyloop;
602
603 yyoverflow:
604     yyerror("yacc stack overflow");
605
606 yyabort:
607     yyfreestack(&yystack);
608     return (1);
609
610 yyaccept:
611     yyfreestack(&yystack);
612     return (0);
613 }