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_calc_parse
17234949Sbapt#endif /* yyparse */
18234949Sbapt
19234949Sbapt#ifndef yylex
20234949Sbapt#define yylex      quote_calc_lex
21234949Sbapt#endif /* yylex */
22234949Sbapt
23234949Sbapt#ifndef yyerror
24234949Sbapt#define yyerror    quote_calc_error
25234949Sbapt#endif /* yyerror */
26234949Sbapt
27234949Sbapt#ifndef yychar
28234949Sbapt#define yychar     quote_calc_char
29234949Sbapt#endif /* yychar */
30234949Sbapt
31234949Sbapt#ifndef yyval
32234949Sbapt#define yyval      quote_calc_val
33234949Sbapt#endif /* yyval */
34234949Sbapt
35234949Sbapt#ifndef yylval
36234949Sbapt#define yylval     quote_calc_lval
37234949Sbapt#endif /* yylval */
38234949Sbapt
39234949Sbapt#ifndef yydebug
40234949Sbapt#define yydebug    quote_calc_debug
41234949Sbapt#endif /* yydebug */
42234949Sbapt
43234949Sbapt#ifndef yynerrs
44234949Sbapt#define yynerrs    quote_calc_nerrs
45234949Sbapt#endif /* yynerrs */
46234949Sbapt
47234949Sbapt#ifndef yyerrflag
48234949Sbapt#define yyerrflag  quote_calc_errflag
49234949Sbapt#endif /* yyerrflag */
50234949Sbapt
51234949Sbapt#ifndef yylhs
52234949Sbapt#define yylhs      quote_calc_lhs
53234949Sbapt#endif /* yylhs */
54234949Sbapt
55234949Sbapt#ifndef yylen
56234949Sbapt#define yylen      quote_calc_len
57234949Sbapt#endif /* yylen */
58234949Sbapt
59234949Sbapt#ifndef yydefred
60234949Sbapt#define yydefred   quote_calc_defred
61234949Sbapt#endif /* yydefred */
62234949Sbapt
63234949Sbapt#ifndef yydgoto
64234949Sbapt#define yydgoto    quote_calc_dgoto
65234949Sbapt#endif /* yydgoto */
66234949Sbapt
67234949Sbapt#ifndef yysindex
68234949Sbapt#define yysindex   quote_calc_sindex
69234949Sbapt#endif /* yysindex */
70234949Sbapt
71234949Sbapt#ifndef yyrindex
72234949Sbapt#define yyrindex   quote_calc_rindex
73234949Sbapt#endif /* yyrindex */
74234949Sbapt
75234949Sbapt#ifndef yygindex
76234949Sbapt#define yygindex   quote_calc_gindex
77234949Sbapt#endif /* yygindex */
78234949Sbapt
79234949Sbapt#ifndef yytable
80234949Sbapt#define yytable    quote_calc_table
81234949Sbapt#endif /* yytable */
82234949Sbapt
83234949Sbapt#ifndef yycheck
84234949Sbapt#define yycheck    quote_calc_check
85234949Sbapt#endif /* yycheck */
86234949Sbapt
87234949Sbapt#ifndef yyname
88234949Sbapt#define yyname     quote_calc_name
89234949Sbapt#endif /* yyname */
90234949Sbapt
91234949Sbapt#ifndef yyrule
92234949Sbapt#define yyrule     quote_calc_rule
93234949Sbapt#endif /* yyrule */
94234949Sbapt#define YYPREFIX "quote_calc_"
95234949Sbapt
96234949Sbapt#define YYPURE 0
97234949Sbapt
98234949Sbapt#line 2 "quote_calc.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_calc-s.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_calc_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_calc_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_calc_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_calc_dgoto[] = {                 1,
170234949Sbapt    7,    8,    9,
171234949Sbapt};
172234949Sbaptstatic const short quote_calc_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_calc_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_calc_gindex[] = {                0,
185234949Sbapt    0,   42,    0,
186234949Sbapt};
187234949Sbapt#define YYTABLESIZE 258
188234949Sbaptstatic const short quote_calc_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_calc_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\"","OP_SUB","\"SUB\"","OP_MUL","\"MUL\"","OP_DIV",
260234949Sbapt"\"DIV\"","OP_MOD","\"MOD\"","OP_AND","\"AND\"","DIGIT","LETTER","UMINUS",
261234949Sbapt};
262234949Sbaptstatic const char *yyrule[] = {
263234949Sbapt"$accept : list",
264234949Sbapt"list :",
265234949Sbapt"list : list stat '\\n'",
266234949Sbapt"list : list error '\\n'",
267234949Sbapt"stat : expr",
268234949Sbapt"stat : LETTER '=' expr",
269234949Sbapt"expr : '(' expr ')'",
270234949Sbapt"expr : expr OP_ADD expr",
271234949Sbapt"expr : expr OP_SUB expr",
272234949Sbapt"expr : expr OP_MUL expr",
273234949Sbapt"expr : expr OP_DIV expr",
274234949Sbapt"expr : expr OP_MOD expr",
275234949Sbapt"expr : expr OP_AND expr",
276234949Sbapt"expr : expr '|' expr",
277234949Sbapt"expr : OP_SUB expr",
278234949Sbapt"expr : LETTER",
279234949Sbapt"expr : number",
280234949Sbapt"number : DIGIT",
281234949Sbapt"number : number DIGIT",
282234949Sbapt
283234949Sbapt};
284234949Sbapt#endif
285234949Sbapt
286234949Sbaptint      yydebug;
287234949Sbaptint      yynerrs;
288234949Sbapt
289234949Sbaptint      yyerrflag;
290234949Sbaptint      yychar;
291234949SbaptYYSTYPE  yyval;
292234949SbaptYYSTYPE  yylval;
293234949Sbapt
294234949Sbapt/* define the initial stack-sizes */
295234949Sbapt#ifdef YYSTACKSIZE
296234949Sbapt#undef YYMAXDEPTH
297234949Sbapt#define YYMAXDEPTH  YYSTACKSIZE
298234949Sbapt#else
299234949Sbapt#ifdef YYMAXDEPTH
300234949Sbapt#define YYSTACKSIZE YYMAXDEPTH
301234949Sbapt#else
302234949Sbapt#define YYSTACKSIZE 500
303234949Sbapt#define YYMAXDEPTH  500
304234949Sbapt#endif
305234949Sbapt#endif
306234949Sbapt
307234949Sbapt#define YYINITSTACKSIZE 500
308234949Sbapt
309234949Sbapttypedef struct {
310234949Sbapt    unsigned stacksize;
311234949Sbapt    short    *s_base;
312234949Sbapt    short    *s_mark;
313234949Sbapt    short    *s_last;
314234949Sbapt    YYSTYPE  *l_base;
315234949Sbapt    YYSTYPE  *l_mark;
316234949Sbapt} YYSTACKDATA;
317234949Sbapt/* variables for the parser stack */
318234949Sbaptstatic YYSTACKDATA yystack;
319234949Sbapt#line 73 "quote_calc.y"
320234949Sbapt /* start of programs */
321234949Sbapt
322234949Sbaptint
323234949Sbaptmain (void)
324234949Sbapt{
325234949Sbapt    while(!feof(stdin)) {
326234949Sbapt	yyparse();
327234949Sbapt    }
328234949Sbapt    return 0;
329234949Sbapt}
330234949Sbapt
331234949Sbaptstatic void
332234949Sbaptyyerror(const char *s)
333234949Sbapt{
334234949Sbapt    fprintf(stderr, "%s\n", s);
335234949Sbapt}
336234949Sbapt
337234949Sbaptint
338234949Sbaptyylex(void) {
339234949Sbapt	/* lexical analysis routine */
340234949Sbapt	/* returns LETTER for a lower case letter, yylval = 0 through 25 */
341234949Sbapt	/* return DIGIT for a digit, yylval = 0 through 9 */
342234949Sbapt	/* all other characters are returned immediately */
343234949Sbapt
344234949Sbapt    int c;
345234949Sbapt
346234949Sbapt    while( (c=getchar()) == ' ' )   { /* skip blanks */ }
347234949Sbapt
348234949Sbapt    /* c is now nonblank */
349234949Sbapt
350234949Sbapt    if( islower( c )) {
351234949Sbapt	yylval = c - 'a';
352234949Sbapt	return ( LETTER );
353234949Sbapt    }
354234949Sbapt    if( isdigit( c )) {
355234949Sbapt	yylval = c - '0';
356234949Sbapt	return ( DIGIT );
357234949Sbapt    }
358234949Sbapt    return( c );
359234949Sbapt}
360234949Sbapt#line 361 "quote_calc-s.tab.c"
361234949Sbapt
362234949Sbapt#if YYDEBUG
363234949Sbapt#include <stdio.h>		/* needed for printf */
364234949Sbapt#endif
365234949Sbapt
366234949Sbapt#include <stdlib.h>	/* needed for malloc, etc */
367234949Sbapt#include <string.h>	/* needed for memset */
368234949Sbapt
369234949Sbapt/* allocate initial stack or double stack size, up to YYMAXDEPTH */
370234949Sbaptstatic int yygrowstack(YYSTACKDATA *data)
371234949Sbapt{
372234949Sbapt    int i;
373234949Sbapt    unsigned newsize;
374234949Sbapt    short *newss;
375234949Sbapt    YYSTYPE *newvs;
376234949Sbapt
377234949Sbapt    if ((newsize = data->stacksize) == 0)
378234949Sbapt        newsize = YYINITSTACKSIZE;
379234949Sbapt    else if (newsize >= YYMAXDEPTH)
380234949Sbapt        return -1;
381234949Sbapt    else if ((newsize *= 2) > YYMAXDEPTH)
382234949Sbapt        newsize = YYMAXDEPTH;
383234949Sbapt
384251143Sbapt    i = (int) (data->s_mark - data->s_base);
385234949Sbapt    newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
386234949Sbapt    if (newss == 0)
387234949Sbapt        return -1;
388234949Sbapt
389234949Sbapt    data->s_base = newss;
390234949Sbapt    data->s_mark = newss + i;
391234949Sbapt
392234949Sbapt    newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
393234949Sbapt    if (newvs == 0)
394234949Sbapt        return -1;
395234949Sbapt
396234949Sbapt    data->l_base = newvs;
397234949Sbapt    data->l_mark = newvs + i;
398234949Sbapt
399234949Sbapt    data->stacksize = newsize;
400234949Sbapt    data->s_last = data->s_base + newsize - 1;
401234949Sbapt    return 0;
402234949Sbapt}
403234949Sbapt
404234949Sbapt#if YYPURE || defined(YY_NO_LEAKS)
405234949Sbaptstatic void yyfreestack(YYSTACKDATA *data)
406234949Sbapt{
407234949Sbapt    free(data->s_base);
408234949Sbapt    free(data->l_base);
409234949Sbapt    memset(data, 0, sizeof(*data));
410234949Sbapt}
411234949Sbapt#else
412234949Sbapt#define yyfreestack(data) /* nothing */
413234949Sbapt#endif
414234949Sbapt
415234949Sbapt#define YYABORT  goto yyabort
416234949Sbapt#define YYREJECT goto yyabort
417234949Sbapt#define YYACCEPT goto yyaccept
418234949Sbapt#define YYERROR  goto yyerrlab
419234949Sbapt
420234949Sbaptint
421234949SbaptYYPARSE_DECL()
422234949Sbapt{
423234949Sbapt    int yym, yyn, yystate;
424234949Sbapt#if YYDEBUG
425234949Sbapt    const char *yys;
426234949Sbapt
427234949Sbapt    if ((yys = getenv("YYDEBUG")) != 0)
428234949Sbapt    {
429234949Sbapt        yyn = *yys;
430234949Sbapt        if (yyn >= '0' && yyn <= '9')
431234949Sbapt            yydebug = yyn - '0';
432234949Sbapt    }
433234949Sbapt#endif
434234949Sbapt
435234949Sbapt    yynerrs = 0;
436234949Sbapt    yyerrflag = 0;
437234949Sbapt    yychar = YYEMPTY;
438234949Sbapt    yystate = 0;
439234949Sbapt
440234949Sbapt#if YYPURE
441234949Sbapt    memset(&yystack, 0, sizeof(yystack));
442234949Sbapt#endif
443234949Sbapt
444234949Sbapt    if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow;
445234949Sbapt    yystack.s_mark = yystack.s_base;
446234949Sbapt    yystack.l_mark = yystack.l_base;
447234949Sbapt    yystate = 0;
448234949Sbapt    *yystack.s_mark = 0;
449234949Sbapt
450234949Sbaptyyloop:
451234949Sbapt    if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
452234949Sbapt    if (yychar < 0)
453234949Sbapt    {
454234949Sbapt        if ((yychar = YYLEX) < 0) yychar = 0;
455234949Sbapt#if YYDEBUG
456234949Sbapt        if (yydebug)
457234949Sbapt        {
458234949Sbapt            yys = 0;
459234949Sbapt            if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
460234949Sbapt            if (!yys) yys = "illegal-symbol";
461234949Sbapt            printf("%sdebug: state %d, reading %d (%s)\n",
462234949Sbapt                    YYPREFIX, yystate, yychar, yys);
463234949Sbapt        }
464234949Sbapt#endif
465234949Sbapt    }
466234949Sbapt    if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
467234949Sbapt            yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
468234949Sbapt    {
469234949Sbapt#if YYDEBUG
470234949Sbapt        if (yydebug)
471234949Sbapt            printf("%sdebug: state %d, shifting to state %d\n",
472234949Sbapt                    YYPREFIX, yystate, yytable[yyn]);
473234949Sbapt#endif
474234949Sbapt        if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
475234949Sbapt        {
476234949Sbapt            goto yyoverflow;
477234949Sbapt        }
478234949Sbapt        yystate = yytable[yyn];
479234949Sbapt        *++yystack.s_mark = yytable[yyn];
480234949Sbapt        *++yystack.l_mark = yylval;
481234949Sbapt        yychar = YYEMPTY;
482234949Sbapt        if (yyerrflag > 0)  --yyerrflag;
483234949Sbapt        goto yyloop;
484234949Sbapt    }
485234949Sbapt    if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
486234949Sbapt            yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
487234949Sbapt    {
488234949Sbapt        yyn = yytable[yyn];
489234949Sbapt        goto yyreduce;
490234949Sbapt    }
491234949Sbapt    if (yyerrflag) goto yyinrecovery;
492234949Sbapt
493234949Sbapt    yyerror("syntax error");
494234949Sbapt
495234949Sbapt    goto yyerrlab;
496234949Sbapt
497234949Sbaptyyerrlab:
498234949Sbapt    ++yynerrs;
499234949Sbapt
500234949Sbaptyyinrecovery:
501234949Sbapt    if (yyerrflag < 3)
502234949Sbapt    {
503234949Sbapt        yyerrflag = 3;
504234949Sbapt        for (;;)
505234949Sbapt        {
506234949Sbapt            if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
507234949Sbapt                    yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
508234949Sbapt            {
509234949Sbapt#if YYDEBUG
510234949Sbapt                if (yydebug)
511234949Sbapt                    printf("%sdebug: state %d, error recovery shifting\
512234949Sbapt to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
513234949Sbapt#endif
514234949Sbapt                if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
515234949Sbapt                {
516234949Sbapt                    goto yyoverflow;
517234949Sbapt                }
518234949Sbapt                yystate = yytable[yyn];
519234949Sbapt                *++yystack.s_mark = yytable[yyn];
520234949Sbapt                *++yystack.l_mark = yylval;
521234949Sbapt                goto yyloop;
522234949Sbapt            }
523234949Sbapt            else
524234949Sbapt            {
525234949Sbapt#if YYDEBUG
526234949Sbapt                if (yydebug)
527234949Sbapt                    printf("%sdebug: error recovery discarding state %d\n",
528234949Sbapt                            YYPREFIX, *yystack.s_mark);
529234949Sbapt#endif
530234949Sbapt                if (yystack.s_mark <= yystack.s_base) goto yyabort;
531234949Sbapt                --yystack.s_mark;
532234949Sbapt                --yystack.l_mark;
533234949Sbapt            }
534234949Sbapt        }
535234949Sbapt    }
536234949Sbapt    else
537234949Sbapt    {
538234949Sbapt        if (yychar == 0) goto yyabort;
539234949Sbapt#if YYDEBUG
540234949Sbapt        if (yydebug)
541234949Sbapt        {
542234949Sbapt            yys = 0;
543234949Sbapt            if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
544234949Sbapt            if (!yys) yys = "illegal-symbol";
545234949Sbapt            printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
546234949Sbapt                    YYPREFIX, yystate, yychar, yys);
547234949Sbapt        }
548234949Sbapt#endif
549234949Sbapt        yychar = YYEMPTY;
550234949Sbapt        goto yyloop;
551234949Sbapt    }
552234949Sbapt
553234949Sbaptyyreduce:
554234949Sbapt#if YYDEBUG
555234949Sbapt    if (yydebug)
556234949Sbapt        printf("%sdebug: state %d, reducing by rule %d (%s)\n",
557234949Sbapt                YYPREFIX, yystate, yyn, yyrule[yyn]);
558234949Sbapt#endif
559234949Sbapt    yym = yylen[yyn];
560234949Sbapt    if (yym)
561234949Sbapt        yyval = yystack.l_mark[1-yym];
562234949Sbapt    else
563234949Sbapt        memset(&yyval, 0, sizeof yyval);
564234949Sbapt    switch (yyn)
565234949Sbapt    {
566234949Sbaptcase 3:
567234949Sbapt#line 35 "quote_calc.y"
568234949Sbapt	{  yyerrok ; }
569234949Sbaptbreak;
570234949Sbaptcase 4:
571234949Sbapt#line 39 "quote_calc.y"
572234949Sbapt	{  printf("%d\n",yystack.l_mark[0]);}
573234949Sbaptbreak;
574234949Sbaptcase 5:
575234949Sbapt#line 41 "quote_calc.y"
576234949Sbapt	{  regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
577234949Sbaptbreak;
578234949Sbaptcase 6:
579234949Sbapt#line 45 "quote_calc.y"
580234949Sbapt	{  yyval = yystack.l_mark[-1]; }
581234949Sbaptbreak;
582234949Sbaptcase 7:
583234949Sbapt#line 47 "quote_calc.y"
584234949Sbapt	{  yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
585234949Sbaptbreak;
586234949Sbaptcase 8:
587234949Sbapt#line 49 "quote_calc.y"
588234949Sbapt	{  yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
589234949Sbaptbreak;
590234949Sbaptcase 9:
591234949Sbapt#line 51 "quote_calc.y"
592234949Sbapt	{  yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
593234949Sbaptbreak;
594234949Sbaptcase 10:
595234949Sbapt#line 53 "quote_calc.y"
596234949Sbapt	{  yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
597234949Sbaptbreak;
598234949Sbaptcase 11:
599234949Sbapt#line 55 "quote_calc.y"
600234949Sbapt	{  yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
601234949Sbaptbreak;
602234949Sbaptcase 12:
603234949Sbapt#line 57 "quote_calc.y"
604234949Sbapt	{  yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
605234949Sbaptbreak;
606234949Sbaptcase 13:
607234949Sbapt#line 59 "quote_calc.y"
608234949Sbapt	{  yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
609234949Sbaptbreak;
610234949Sbaptcase 14:
611234949Sbapt#line 61 "quote_calc.y"
612234949Sbapt	{  yyval = - yystack.l_mark[0]; }
613234949Sbaptbreak;
614234949Sbaptcase 15:
615234949Sbapt#line 63 "quote_calc.y"
616234949Sbapt	{  yyval = regs[yystack.l_mark[0]]; }
617234949Sbaptbreak;
618234949Sbaptcase 17:
619234949Sbapt#line 68 "quote_calc.y"
620234949Sbapt	{  yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; }
621234949Sbaptbreak;
622234949Sbaptcase 18:
623234949Sbapt#line 70 "quote_calc.y"
624234949Sbapt	{  yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
625234949Sbaptbreak;
626234949Sbapt#line 627 "quote_calc-s.tab.c"
627234949Sbapt    }
628234949Sbapt    yystack.s_mark -= yym;
629234949Sbapt    yystate = *yystack.s_mark;
630234949Sbapt    yystack.l_mark -= yym;
631234949Sbapt    yym = yylhs[yyn];
632234949Sbapt    if (yystate == 0 && yym == 0)
633234949Sbapt    {
634234949Sbapt#if YYDEBUG
635234949Sbapt        if (yydebug)
636234949Sbapt            printf("%sdebug: after reduction, shifting from state 0 to\
637234949Sbapt state %d\n", YYPREFIX, YYFINAL);
638234949Sbapt#endif
639234949Sbapt        yystate = YYFINAL;
640234949Sbapt        *++yystack.s_mark = YYFINAL;
641234949Sbapt        *++yystack.l_mark = yyval;
642234949Sbapt        if (yychar < 0)
643234949Sbapt        {
644234949Sbapt            if ((yychar = YYLEX) < 0) yychar = 0;
645234949Sbapt#if YYDEBUG
646234949Sbapt            if (yydebug)
647234949Sbapt            {
648234949Sbapt                yys = 0;
649234949Sbapt                if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
650234949Sbapt                if (!yys) yys = "illegal-symbol";
651234949Sbapt                printf("%sdebug: state %d, reading %d (%s)\n",
652234949Sbapt                        YYPREFIX, YYFINAL, yychar, yys);
653234949Sbapt            }
654234949Sbapt#endif
655234949Sbapt        }
656234949Sbapt        if (yychar == 0) goto yyaccept;
657234949Sbapt        goto yyloop;
658234949Sbapt    }
659234949Sbapt    if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
660234949Sbapt            yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
661234949Sbapt        yystate = yytable[yyn];
662234949Sbapt    else
663234949Sbapt        yystate = yydgoto[yym];
664234949Sbapt#if YYDEBUG
665234949Sbapt    if (yydebug)
666234949Sbapt        printf("%sdebug: after reduction, shifting from state %d \
667234949Sbaptto state %d\n", YYPREFIX, *yystack.s_mark, yystate);
668234949Sbapt#endif
669234949Sbapt    if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
670234949Sbapt    {
671234949Sbapt        goto yyoverflow;
672234949Sbapt    }
673234949Sbapt    *++yystack.s_mark = (short) yystate;
674234949Sbapt    *++yystack.l_mark = yyval;
675234949Sbapt    goto yyloop;
676234949Sbapt
677234949Sbaptyyoverflow:
678234949Sbapt    yyerror("yacc stack overflow");
679234949Sbapt
680234949Sbaptyyabort:
681234949Sbapt    yyfreestack(&yystack);
682234949Sbapt    return (1);
683234949Sbapt
684234949Sbaptyyaccept:
685234949Sbapt    yyfreestack(&yystack);
686234949Sbapt    return (0);
687234949Sbapt}
688