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