1234949Sbapt#ifndef lint
2234949Sbaptstatic const char yysccsid[] = "@(#)yaccpar	1.9 (Berkeley) 02/21/93";
3234949Sbapt#endif
4234949Sbapt
5234949Sbapt#define YYBYACC 1
6234949Sbapt#define YYMAJOR 1
7234949Sbapt#define YYMINOR 9
8234949Sbapt
9234949Sbapt#define YYEMPTY        (-1)
10234949Sbapt#define yyclearin      (yychar = YYEMPTY)
11234949Sbapt#define yyerrok        (yyerrflag = 0)
12234949Sbapt#define YYRECOVERING() (yyerrflag != 0)
13234949Sbapt
14234949Sbapt
15234949Sbapt#ifndef yyparse
16234949Sbapt#define yyparse    quote_calc3_parse
17234949Sbapt#endif /* yyparse */
18234949Sbapt
19234949Sbapt#ifndef yylex
20234949Sbapt#define yylex      quote_calc3_lex
21234949Sbapt#endif /* yylex */
22234949Sbapt
23234949Sbapt#ifndef yyerror
24234949Sbapt#define yyerror    quote_calc3_error
25234949Sbapt#endif /* yyerror */
26234949Sbapt
27234949Sbapt#ifndef yychar
28234949Sbapt#define yychar     quote_calc3_char
29234949Sbapt#endif /* yychar */
30234949Sbapt
31234949Sbapt#ifndef yyval
32234949Sbapt#define yyval      quote_calc3_val
33234949Sbapt#endif /* yyval */
34234949Sbapt
35234949Sbapt#ifndef yylval
36234949Sbapt#define yylval     quote_calc3_lval
37234949Sbapt#endif /* yylval */
38234949Sbapt
39234949Sbapt#ifndef yydebug
40234949Sbapt#define yydebug    quote_calc3_debug
41234949Sbapt#endif /* yydebug */
42234949Sbapt
43234949Sbapt#ifndef yynerrs
44234949Sbapt#define yynerrs    quote_calc3_nerrs
45234949Sbapt#endif /* yynerrs */
46234949Sbapt
47234949Sbapt#ifndef yyerrflag
48234949Sbapt#define yyerrflag  quote_calc3_errflag
49234949Sbapt#endif /* yyerrflag */
50234949Sbapt
51234949Sbapt#ifndef yylhs
52234949Sbapt#define yylhs      quote_calc3_lhs
53234949Sbapt#endif /* yylhs */
54234949Sbapt
55234949Sbapt#ifndef yylen
56234949Sbapt#define yylen      quote_calc3_len
57234949Sbapt#endif /* yylen */
58234949Sbapt
59234949Sbapt#ifndef yydefred
60234949Sbapt#define yydefred   quote_calc3_defred
61234949Sbapt#endif /* yydefred */
62234949Sbapt
63234949Sbapt#ifndef yydgoto
64234949Sbapt#define yydgoto    quote_calc3_dgoto
65234949Sbapt#endif /* yydgoto */
66234949Sbapt
67234949Sbapt#ifndef yysindex
68234949Sbapt#define yysindex   quote_calc3_sindex
69234949Sbapt#endif /* yysindex */
70234949Sbapt
71234949Sbapt#ifndef yyrindex
72234949Sbapt#define yyrindex   quote_calc3_rindex
73234949Sbapt#endif /* yyrindex */
74234949Sbapt
75234949Sbapt#ifndef yygindex
76234949Sbapt#define yygindex   quote_calc3_gindex
77234949Sbapt#endif /* yygindex */
78234949Sbapt
79234949Sbapt#ifndef yytable
80234949Sbapt#define yytable    quote_calc3_table
81234949Sbapt#endif /* yytable */
82234949Sbapt
83234949Sbapt#ifndef yycheck
84234949Sbapt#define yycheck    quote_calc3_check
85234949Sbapt#endif /* yycheck */
86234949Sbapt
87234949Sbapt#ifndef yyname
88234949Sbapt#define yyname     quote_calc3_name
89234949Sbapt#endif /* yyname */
90234949Sbapt
91234949Sbapt#ifndef yyrule
92234949Sbapt#define yyrule     quote_calc3_rule
93234949Sbapt#endif /* yyrule */
94234949Sbapt#define YYPREFIX "quote_calc3_"
95234949Sbapt
96234949Sbapt#define YYPURE 0
97234949Sbapt
98234949Sbapt#line 2 "quote_calc3.y"
99234949Sbapt# include <stdio.h>
100234949Sbapt# include <ctype.h>
101234949Sbapt
102234949Sbaptint regs[26];
103234949Sbaptint base;
104234949Sbapt
105234949Sbaptint yylex(void);
106234949Sbaptstatic void yyerror(const char *s);
107234949Sbapt
108234949Sbapt#line 109 "quote_calc3.tab.c"
109234949Sbapt
110234949Sbapt#ifndef YYSTYPE
111234949Sbapttypedef int YYSTYPE;
112234949Sbapt#endif
113234949Sbapt
114234949Sbapt/* compatibility with bison */
115234949Sbapt#ifdef YYPARSE_PARAM
116234949Sbapt/* compatibility with FreeBSD */
117234949Sbapt# ifdef YYPARSE_PARAM_TYPE
118234949Sbapt#  define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
119234949Sbapt# else
120234949Sbapt#  define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
121234949Sbapt# endif
122234949Sbapt#else
123234949Sbapt# define YYPARSE_DECL() yyparse(void)
124234949Sbapt#endif
125234949Sbapt
126234949Sbapt/* Parameters sent to lex. */
127234949Sbapt#ifdef YYLEX_PARAM
128234949Sbapt# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
129234949Sbapt# define YYLEX yylex(YYLEX_PARAM)
130234949Sbapt#else
131234949Sbapt# define YYLEX_DECL() yylex(void)
132234949Sbapt# define YYLEX yylex()
133234949Sbapt#endif
134234949Sbapt
135234949Sbapt/* Parameters sent to yyerror. */
136234949Sbapt#ifndef YYERROR_DECL
137234949Sbapt#define YYERROR_DECL() yyerror(const char *s)
138234949Sbapt#endif
139234949Sbapt#ifndef YYERROR_CALL
140234949Sbapt#define YYERROR_CALL(msg) yyerror(msg)
141234949Sbapt#endif
142234949Sbapt
143234949Sbaptextern int YYPARSE_DECL();
144234949Sbapt
145234949Sbapt#define OP_ADD 257
146234949Sbapt#define OP_SUB 259
147234949Sbapt#define OP_MUL 261
148234949Sbapt#define OP_DIV 263
149234949Sbapt#define OP_MOD 265
150234949Sbapt#define OP_AND 267
151234949Sbapt#define DIGIT 269
152234949Sbapt#define LETTER 270
153234949Sbapt#define UMINUS 271
154234949Sbapt#define YYERRCODE 256
155234949Sbaptstatic const short quote_calc3_lhs[] = {                 -1,
156234949Sbapt    0,    0,    0,    1,    1,    2,    2,    2,    2,    2,
157234949Sbapt    2,    2,    2,    2,    2,    2,    3,    3,
158234949Sbapt};
159234949Sbaptstatic const short quote_calc3_len[] = {                  2,
160234949Sbapt    0,    3,    3,    1,    3,    3,    3,    3,    3,    3,
161234949Sbapt    3,    3,    3,    2,    1,    1,    1,    2,
162234949Sbapt};
163234949Sbaptstatic const short quote_calc3_defred[] = {               1,
164234949Sbapt    0,    0,    0,   17,    0,    0,    0,    0,    0,    3,
165234949Sbapt   15,    0,    0,    0,    2,    0,    0,    0,    0,    0,
166234949Sbapt    0,    0,   18,    0,    6,    0,    0,    0,    0,    0,
167234949Sbapt    0,    0,
168234949Sbapt};
169234949Sbaptstatic const short quote_calc3_dgoto[] = {                1,
170234949Sbapt    7,    8,    9,
171234949Sbapt};
172234949Sbaptstatic const short quote_calc3_sindex[] = {               0,
173234949Sbapt  -38,    5,  -36,    0,  -51,  -36,    7, -121, -248,    0,
174234949Sbapt    0, -243,  -36,  -22,    0,  -36,  -36,  -36,  -36,  -36,
175234949Sbapt  -36,  -36,    0, -121,    0, -121, -121, -121, -121, -121,
176234949Sbapt -121, -243,
177234949Sbapt};
178234949Sbaptstatic const short quote_calc3_rindex[] = {               0,
179234949Sbapt    0,    0,    0,    0,   -9,    0,    0,   13,  -10,    0,
180234949Sbapt    0,   -5,    0,    0,    0,    0,    0,    0,    0,    0,
181234949Sbapt    0,    0,    0,   15,    0,   -3,   -2,   -1,    1,    2,
182234949Sbapt    3,   -4,
183234949Sbapt};
184234949Sbaptstatic const short quote_calc3_gindex[] = {               0,
185234949Sbapt    0,   42,    0,
186234949Sbapt};
187234949Sbapt#define YYTABLESIZE 258
188234949Sbaptstatic const short quote_calc3_table[] = {               16,
189234949Sbapt   15,    6,   22,    6,   14,   13,    7,    8,    9,   13,
190234949Sbapt   10,   11,   12,   16,   10,   17,   15,   18,   25,   19,
191234949Sbapt   23,   20,    4,   21,    5,    0,    0,    0,    0,    0,
192234949Sbapt   16,    0,    0,    0,    0,   14,   13,    7,    8,    9,
193234949Sbapt    0,   10,   11,   12,   12,    0,    0,   14,    0,    0,
194234949Sbapt    0,    0,    0,    0,   24,    0,    0,   26,   27,   28,
195234949Sbapt   29,   30,   31,   32,    0,    0,    0,    0,    0,    0,
196234949Sbapt    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
197234949Sbapt    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
198234949Sbapt    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
199234949Sbapt    0,   22,    0,    0,    0,    0,    0,    0,    0,    0,
200234949Sbapt    0,    0,    0,   16,   15,    0,    0,    0,   14,   13,
201234949Sbapt    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
202234949Sbapt    0,    0,    0,    0,    0,   16,    0,   17,    0,   18,
203234949Sbapt    0,   19,    0,   20,    0,   21,    0,    0,    0,    0,
204234949Sbapt    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
205234949Sbapt    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
206234949Sbapt    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
207234949Sbapt    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
208234949Sbapt    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
209234949Sbapt    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
210234949Sbapt    0,    0,    0,    0,    0,    0,    0,    2,    0,    0,
211234949Sbapt    3,    0,    3,    0,    0,    0,    0,    0,    0,    0,
212234949Sbapt    4,    5,    4,   11,   16,    0,   17,    0,   18,    0,
213234949Sbapt   19,    0,   20,    0,   21,    0,   16,   15,   16,   15,
214234949Sbapt   16,   15,   16,   15,   16,   15,   16,   15,
215234949Sbapt};
216234949Sbaptstatic const short quote_calc3_check[] = {               10,
217234949Sbapt   10,   40,  124,   40,   10,   10,   10,   10,   10,   61,
218234949Sbapt   10,   10,   10,  257,   10,  259,   10,  261,   41,  263,
219234949Sbapt  269,  265,   10,  267,   10,   -1,   -1,   -1,   -1,   -1,
220234949Sbapt   41,   -1,   -1,   -1,   -1,   41,   41,   41,   41,   41,
221234949Sbapt   -1,   41,   41,   41,    3,   -1,   -1,    6,   -1,   -1,
222234949Sbapt   -1,   -1,   -1,   -1,   13,   -1,   -1,   16,   17,   18,
223234949Sbapt   19,   20,   21,   22,   -1,   -1,   -1,   -1,   -1,   -1,
224234949Sbapt   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
225234949Sbapt   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
226234949Sbapt   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
227234949Sbapt   -1,  124,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
228234949Sbapt   -1,   -1,   -1,  124,  124,   -1,   -1,   -1,  124,  124,
229234949Sbapt   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
230234949Sbapt   -1,   -1,   -1,   -1,   -1,  257,   -1,  259,   -1,  261,
231234949Sbapt   -1,  263,   -1,  265,   -1,  267,   -1,   -1,   -1,   -1,
232234949Sbapt   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
233234949Sbapt   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
234234949Sbapt   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
235234949Sbapt   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
236234949Sbapt   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
237234949Sbapt   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
238234949Sbapt   -1,   -1,   -1,   -1,   -1,   -1,   -1,  256,   -1,   -1,
239234949Sbapt  259,   -1,  259,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
240234949Sbapt  269,  270,  269,  270,  257,   -1,  259,   -1,  261,   -1,
241234949Sbapt  263,   -1,  265,   -1,  267,   -1,  257,  257,  259,  259,
242234949Sbapt  261,  261,  263,  263,  265,  265,  267,  267,
243234949Sbapt};
244234949Sbapt#define YYFINAL 1
245234949Sbapt#ifndef YYDEBUG
246234949Sbapt#define YYDEBUG 0
247234949Sbapt#endif
248234949Sbapt#define YYMAXTOKEN 271
249234949Sbapt#if YYDEBUG
250234949Sbaptstatic const char *yyname[] = {
251234949Sbapt
252234949Sbapt"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,
253234949Sbapt0,0,0,0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,
254234949Sbapt0,0,0,0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
255234949Sbapt0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,
256234949Sbapt0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
257234949Sbapt0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
258234949Sbapt0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
259234949Sbapt0,0,0,0,0,0,"OP_ADD","\"ADD-operator\"","OP_SUB","\"SUB-operator\"","OP_MUL",
260234949Sbapt"\"MUL-operator\"","OP_DIV","\"DIV-operator\"","OP_MOD","\"MOD-operator\"",
261234949Sbapt"OP_AND","\"AND-operator\"","DIGIT","LETTER","UMINUS",
262234949Sbapt};
263234949Sbaptstatic const char *yyrule[] = {
264234949Sbapt"$accept : list",
265234949Sbapt"list :",
266234949Sbapt"list : list stat '\\n'",
267234949Sbapt"list : list error '\\n'",
268234949Sbapt"stat : expr",
269234949Sbapt"stat : LETTER '=' expr",
270234949Sbapt"expr : '(' expr ')'",
271234949Sbapt"expr : expr OP_ADD expr",
272234949Sbapt"expr : expr OP_SUB expr",
273234949Sbapt"expr : expr OP_MUL expr",
274234949Sbapt"expr : expr OP_DIV expr",
275234949Sbapt"expr : expr OP_MOD expr",
276234949Sbapt"expr : expr OP_AND expr",
277234949Sbapt"expr : expr '|' expr",
278234949Sbapt"expr : OP_SUB expr",
279234949Sbapt"expr : LETTER",
280234949Sbapt"expr : number",
281234949Sbapt"number : DIGIT",
282234949Sbapt"number : number DIGIT",
283234949Sbapt
284234949Sbapt};
285234949Sbapt#endif
286234949Sbapt
287234949Sbaptint      yydebug;
288234949Sbaptint      yynerrs;
289234949Sbapt
290234949Sbaptint      yyerrflag;
291234949Sbaptint      yychar;
292234949SbaptYYSTYPE  yyval;
293234949SbaptYYSTYPE  yylval;
294234949Sbapt
295234949Sbapt/* define the initial stack-sizes */
296234949Sbapt#ifdef YYSTACKSIZE
297234949Sbapt#undef YYMAXDEPTH
298234949Sbapt#define YYMAXDEPTH  YYSTACKSIZE
299234949Sbapt#else
300234949Sbapt#ifdef YYMAXDEPTH
301234949Sbapt#define YYSTACKSIZE YYMAXDEPTH
302234949Sbapt#else
303234949Sbapt#define YYSTACKSIZE 500
304234949Sbapt#define YYMAXDEPTH  500
305234949Sbapt#endif
306234949Sbapt#endif
307234949Sbapt
308234949Sbapt#define YYINITSTACKSIZE 500
309234949Sbapt
310234949Sbapttypedef struct {
311234949Sbapt    unsigned stacksize;
312234949Sbapt    short    *s_base;
313234949Sbapt    short    *s_mark;
314234949Sbapt    short    *s_last;
315234949Sbapt    YYSTYPE  *l_base;
316234949Sbapt    YYSTYPE  *l_mark;
317234949Sbapt} YYSTACKDATA;
318234949Sbapt/* variables for the parser stack */
319234949Sbaptstatic YYSTACKDATA yystack;
320234949Sbapt#line 73 "quote_calc3.y"
321234949Sbapt /* start of programs */
322234949Sbapt
323234949Sbaptint
324234949Sbaptmain (void)
325234949Sbapt{
326234949Sbapt    while(!feof(stdin)) {
327234949Sbapt	yyparse();
328234949Sbapt    }
329234949Sbapt    return 0;
330234949Sbapt}
331234949Sbapt
332234949Sbaptstatic void
333234949Sbaptyyerror(const char *s)
334234949Sbapt{
335234949Sbapt    fprintf(stderr, "%s\n", s);
336234949Sbapt}
337234949Sbapt
338234949Sbaptint
339234949Sbaptyylex(void) {
340234949Sbapt	/* lexical analysis routine */
341234949Sbapt	/* returns LETTER for a lower case letter, yylval = 0 through 25 */
342234949Sbapt	/* return DIGIT for a digit, yylval = 0 through 9 */
343234949Sbapt	/* all other characters are returned immediately */
344234949Sbapt
345234949Sbapt    int c;
346234949Sbapt
347234949Sbapt    while( (c=getchar()) == ' ' )   { /* skip blanks */ }
348234949Sbapt
349234949Sbapt    /* c is now nonblank */
350234949Sbapt
351234949Sbapt    if( islower( c )) {
352234949Sbapt	yylval = c - 'a';
353234949Sbapt	return ( LETTER );
354234949Sbapt    }
355234949Sbapt    if( isdigit( c )) {
356234949Sbapt	yylval = c - '0';
357234949Sbapt	return ( DIGIT );
358234949Sbapt    }
359234949Sbapt    return( c );
360234949Sbapt}
361234949Sbapt#line 362 "quote_calc3.tab.c"
362234949Sbapt
363234949Sbapt#if YYDEBUG
364234949Sbapt#include <stdio.h>		/* needed for printf */
365234949Sbapt#endif
366234949Sbapt
367234949Sbapt#include <stdlib.h>	/* needed for malloc, etc */
368234949Sbapt#include <string.h>	/* needed for memset */
369234949Sbapt
370234949Sbapt/* allocate initial stack or double stack size, up to YYMAXDEPTH */
371234949Sbaptstatic int yygrowstack(YYSTACKDATA *data)
372234949Sbapt{
373234949Sbapt    int i;
374234949Sbapt    unsigned newsize;
375234949Sbapt    short *newss;
376234949Sbapt    YYSTYPE *newvs;
377234949Sbapt
378234949Sbapt    if ((newsize = data->stacksize) == 0)
379234949Sbapt        newsize = YYINITSTACKSIZE;
380234949Sbapt    else if (newsize >= YYMAXDEPTH)
381234949Sbapt        return -1;
382234949Sbapt    else if ((newsize *= 2) > YYMAXDEPTH)
383234949Sbapt        newsize = YYMAXDEPTH;
384234949Sbapt
385251143Sbapt    i = (int) (data->s_mark - data->s_base);
386234949Sbapt    newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
387234949Sbapt    if (newss == 0)
388234949Sbapt        return -1;
389234949Sbapt
390234949Sbapt    data->s_base = newss;
391234949Sbapt    data->s_mark = newss + i;
392234949Sbapt
393234949Sbapt    newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
394234949Sbapt    if (newvs == 0)
395234949Sbapt        return -1;
396234949Sbapt
397234949Sbapt    data->l_base = newvs;
398234949Sbapt    data->l_mark = newvs + i;
399234949Sbapt
400234949Sbapt    data->stacksize = newsize;
401234949Sbapt    data->s_last = data->s_base + newsize - 1;
402234949Sbapt    return 0;
403234949Sbapt}
404234949Sbapt
405234949Sbapt#if YYPURE || defined(YY_NO_LEAKS)
406234949Sbaptstatic void yyfreestack(YYSTACKDATA *data)
407234949Sbapt{
408234949Sbapt    free(data->s_base);
409234949Sbapt    free(data->l_base);
410234949Sbapt    memset(data, 0, sizeof(*data));
411234949Sbapt}
412234949Sbapt#else
413234949Sbapt#define yyfreestack(data) /* nothing */
414234949Sbapt#endif
415234949Sbapt
416234949Sbapt#define YYABORT  goto yyabort
417234949Sbapt#define YYREJECT goto yyabort
418234949Sbapt#define YYACCEPT goto yyaccept
419234949Sbapt#define YYERROR  goto yyerrlab
420234949Sbapt
421234949Sbaptint
422234949SbaptYYPARSE_DECL()
423234949Sbapt{
424234949Sbapt    int yym, yyn, yystate;
425234949Sbapt#if YYDEBUG
426234949Sbapt    const char *yys;
427234949Sbapt
428234949Sbapt    if ((yys = getenv("YYDEBUG")) != 0)
429234949Sbapt    {
430234949Sbapt        yyn = *yys;
431234949Sbapt        if (yyn >= '0' && yyn <= '9')
432234949Sbapt            yydebug = yyn - '0';
433234949Sbapt    }
434234949Sbapt#endif
435234949Sbapt
436234949Sbapt    yynerrs = 0;
437234949Sbapt    yyerrflag = 0;
438234949Sbapt    yychar = YYEMPTY;
439234949Sbapt    yystate = 0;
440234949Sbapt
441234949Sbapt#if YYPURE
442234949Sbapt    memset(&yystack, 0, sizeof(yystack));
443234949Sbapt#endif
444234949Sbapt
445234949Sbapt    if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow;
446234949Sbapt    yystack.s_mark = yystack.s_base;
447234949Sbapt    yystack.l_mark = yystack.l_base;
448234949Sbapt    yystate = 0;
449234949Sbapt    *yystack.s_mark = 0;
450234949Sbapt
451234949Sbaptyyloop:
452234949Sbapt    if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
453234949Sbapt    if (yychar < 0)
454234949Sbapt    {
455234949Sbapt        if ((yychar = YYLEX) < 0) yychar = 0;
456234949Sbapt#if YYDEBUG
457234949Sbapt        if (yydebug)
458234949Sbapt        {
459234949Sbapt            yys = 0;
460234949Sbapt            if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
461234949Sbapt            if (!yys) yys = "illegal-symbol";
462234949Sbapt            printf("%sdebug: state %d, reading %d (%s)\n",
463234949Sbapt                    YYPREFIX, yystate, yychar, yys);
464234949Sbapt        }
465234949Sbapt#endif
466234949Sbapt    }
467234949Sbapt    if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
468234949Sbapt            yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
469234949Sbapt    {
470234949Sbapt#if YYDEBUG
471234949Sbapt        if (yydebug)
472234949Sbapt            printf("%sdebug: state %d, shifting to state %d\n",
473234949Sbapt                    YYPREFIX, yystate, yytable[yyn]);
474234949Sbapt#endif
475234949Sbapt        if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
476234949Sbapt        {
477234949Sbapt            goto yyoverflow;
478234949Sbapt        }
479234949Sbapt        yystate = yytable[yyn];
480234949Sbapt        *++yystack.s_mark = yytable[yyn];
481234949Sbapt        *++yystack.l_mark = yylval;
482234949Sbapt        yychar = YYEMPTY;
483234949Sbapt        if (yyerrflag > 0)  --yyerrflag;
484234949Sbapt        goto yyloop;
485234949Sbapt    }
486234949Sbapt    if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
487234949Sbapt            yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
488234949Sbapt    {
489234949Sbapt        yyn = yytable[yyn];
490234949Sbapt        goto yyreduce;
491234949Sbapt    }
492234949Sbapt    if (yyerrflag) goto yyinrecovery;
493234949Sbapt
494234949Sbapt    yyerror("syntax error");
495234949Sbapt
496234949Sbapt    goto yyerrlab;
497234949Sbapt
498234949Sbaptyyerrlab:
499234949Sbapt    ++yynerrs;
500234949Sbapt
501234949Sbaptyyinrecovery:
502234949Sbapt    if (yyerrflag < 3)
503234949Sbapt    {
504234949Sbapt        yyerrflag = 3;
505234949Sbapt        for (;;)
506234949Sbapt        {
507234949Sbapt            if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
508234949Sbapt                    yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
509234949Sbapt            {
510234949Sbapt#if YYDEBUG
511234949Sbapt                if (yydebug)
512234949Sbapt                    printf("%sdebug: state %d, error recovery shifting\
513234949Sbapt to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
514234949Sbapt#endif
515234949Sbapt                if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
516234949Sbapt                {
517234949Sbapt                    goto yyoverflow;
518234949Sbapt                }
519234949Sbapt                yystate = yytable[yyn];
520234949Sbapt                *++yystack.s_mark = yytable[yyn];
521234949Sbapt                *++yystack.l_mark = yylval;
522234949Sbapt                goto yyloop;
523234949Sbapt            }
524234949Sbapt            else
525234949Sbapt            {
526234949Sbapt#if YYDEBUG
527234949Sbapt                if (yydebug)
528234949Sbapt                    printf("%sdebug: error recovery discarding state %d\n",
529234949Sbapt                            YYPREFIX, *yystack.s_mark);
530234949Sbapt#endif
531234949Sbapt                if (yystack.s_mark <= yystack.s_base) goto yyabort;
532234949Sbapt                --yystack.s_mark;
533234949Sbapt                --yystack.l_mark;
534234949Sbapt            }
535234949Sbapt        }
536234949Sbapt    }
537234949Sbapt    else
538234949Sbapt    {
539234949Sbapt        if (yychar == 0) goto yyabort;
540234949Sbapt#if YYDEBUG
541234949Sbapt        if (yydebug)
542234949Sbapt        {
543234949Sbapt            yys = 0;
544234949Sbapt            if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
545234949Sbapt            if (!yys) yys = "illegal-symbol";
546234949Sbapt            printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
547234949Sbapt                    YYPREFIX, yystate, yychar, yys);
548234949Sbapt        }
549234949Sbapt#endif
550234949Sbapt        yychar = YYEMPTY;
551234949Sbapt        goto yyloop;
552234949Sbapt    }
553234949Sbapt
554234949Sbaptyyreduce:
555234949Sbapt#if YYDEBUG
556234949Sbapt    if (yydebug)
557234949Sbapt        printf("%sdebug: state %d, reducing by rule %d (%s)\n",
558234949Sbapt                YYPREFIX, yystate, yyn, yyrule[yyn]);
559234949Sbapt#endif
560234949Sbapt    yym = yylen[yyn];
561234949Sbapt    if (yym)
562234949Sbapt        yyval = yystack.l_mark[1-yym];
563234949Sbapt    else
564234949Sbapt        memset(&yyval, 0, sizeof yyval);
565234949Sbapt    switch (yyn)
566234949Sbapt    {
567234949Sbaptcase 3:
568234949Sbapt#line 35 "quote_calc3.y"
569234949Sbapt	{  yyerrok ; }
570234949Sbaptbreak;
571234949Sbaptcase 4:
572234949Sbapt#line 39 "quote_calc3.y"
573234949Sbapt	{  printf("%d\n",yystack.l_mark[0]);}
574234949Sbaptbreak;
575234949Sbaptcase 5:
576234949Sbapt#line 41 "quote_calc3.y"
577234949Sbapt	{  regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
578234949Sbaptbreak;
579234949Sbaptcase 6:
580234949Sbapt#line 45 "quote_calc3.y"
581234949Sbapt	{  yyval = yystack.l_mark[-1]; }
582234949Sbaptbreak;
583234949Sbaptcase 7:
584234949Sbapt#line 47 "quote_calc3.y"
585234949Sbapt	{  yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
586234949Sbaptbreak;
587234949Sbaptcase 8:
588234949Sbapt#line 49 "quote_calc3.y"
589234949Sbapt	{  yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
590234949Sbaptbreak;
591234949Sbaptcase 9:
592234949Sbapt#line 51 "quote_calc3.y"
593234949Sbapt	{  yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
594234949Sbaptbreak;
595234949Sbaptcase 10:
596234949Sbapt#line 53 "quote_calc3.y"
597234949Sbapt	{  yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
598234949Sbaptbreak;
599234949Sbaptcase 11:
600234949Sbapt#line 55 "quote_calc3.y"
601234949Sbapt	{  yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
602234949Sbaptbreak;
603234949Sbaptcase 12:
604234949Sbapt#line 57 "quote_calc3.y"
605234949Sbapt	{  yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
606234949Sbaptbreak;
607234949Sbaptcase 13:
608234949Sbapt#line 59 "quote_calc3.y"
609234949Sbapt	{  yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
610234949Sbaptbreak;
611234949Sbaptcase 14:
612234949Sbapt#line 61 "quote_calc3.y"
613234949Sbapt	{  yyval = - yystack.l_mark[0]; }
614234949Sbaptbreak;
615234949Sbaptcase 15:
616234949Sbapt#line 63 "quote_calc3.y"
617234949Sbapt	{  yyval = regs[yystack.l_mark[0]]; }
618234949Sbaptbreak;
619234949Sbaptcase 17:
620234949Sbapt#line 68 "quote_calc3.y"
621234949Sbapt	{  yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; }
622234949Sbaptbreak;
623234949Sbaptcase 18:
624234949Sbapt#line 70 "quote_calc3.y"
625234949Sbapt	{  yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
626234949Sbaptbreak;
627234949Sbapt#line 628 "quote_calc3.tab.c"
628234949Sbapt    }
629234949Sbapt    yystack.s_mark -= yym;
630234949Sbapt    yystate = *yystack.s_mark;
631234949Sbapt    yystack.l_mark -= yym;
632234949Sbapt    yym = yylhs[yyn];
633234949Sbapt    if (yystate == 0 && yym == 0)
634234949Sbapt    {
635234949Sbapt#if YYDEBUG
636234949Sbapt        if (yydebug)
637234949Sbapt            printf("%sdebug: after reduction, shifting from state 0 to\
638234949Sbapt state %d\n", YYPREFIX, YYFINAL);
639234949Sbapt#endif
640234949Sbapt        yystate = YYFINAL;
641234949Sbapt        *++yystack.s_mark = YYFINAL;
642234949Sbapt        *++yystack.l_mark = yyval;
643234949Sbapt        if (yychar < 0)
644234949Sbapt        {
645234949Sbapt            if ((yychar = YYLEX) < 0) yychar = 0;
646234949Sbapt#if YYDEBUG
647234949Sbapt            if (yydebug)
648234949Sbapt            {
649234949Sbapt                yys = 0;
650234949Sbapt                if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
651234949Sbapt                if (!yys) yys = "illegal-symbol";
652234949Sbapt                printf("%sdebug: state %d, reading %d (%s)\n",
653234949Sbapt                        YYPREFIX, YYFINAL, yychar, yys);
654234949Sbapt            }
655234949Sbapt#endif
656234949Sbapt        }
657234949Sbapt        if (yychar == 0) goto yyaccept;
658234949Sbapt        goto yyloop;
659234949Sbapt    }
660234949Sbapt    if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
661234949Sbapt            yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
662234949Sbapt        yystate = yytable[yyn];
663234949Sbapt    else
664234949Sbapt        yystate = yydgoto[yym];
665234949Sbapt#if YYDEBUG
666234949Sbapt    if (yydebug)
667234949Sbapt        printf("%sdebug: after reduction, shifting from state %d \
668234949Sbaptto state %d\n", YYPREFIX, *yystack.s_mark, yystate);
669234949Sbapt#endif
670234949Sbapt    if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
671234949Sbapt    {
672234949Sbapt        goto yyoverflow;
673234949Sbapt    }
674234949Sbapt    *++yystack.s_mark = (short) yystate;
675234949Sbapt    *++yystack.l_mark = yyval;
676234949Sbapt    goto yyloop;
677234949Sbapt
678234949Sbaptyyoverflow:
679234949Sbapt    yyerror("yacc stack overflow");
680234949Sbapt
681234949Sbaptyyabort:
682234949Sbapt    yyfreestack(&yystack);
683234949Sbapt    return (1);
684234949Sbapt
685234949Sbaptyyaccept:
686234949Sbapt    yyfreestack(&yystack);
687234949Sbapt    return (0);
688234949Sbapt}
689