117680Spst/* original parser id follows */
217680Spst/* yysccsid[] = "@(#)yaccpar	1.9 (Berkeley) 02/21/93" */
317680Spst/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
417680Spst
517680Spst#define YYBYACC 1
617680Spst#define YYMAJOR 1
717680Spst#define YYMINOR 9
817680Spst#define YYCHECK "yyyymmdd"
917680Spst
1017680Spst#define YYEMPTY        (-1)
1117680Spst#define yyclearin      (yychar = YYEMPTY)
1217680Spst#define yyerrok        (yyerrflag = 0)
1317680Spst#define YYRECOVERING() (yyerrflag != 0)
1417680Spst#define YYENOMEM       (-2)
1517680Spst#define YYEOF          0
1617680Spst
1717680Spst#ifndef yyparse
1817680Spst#define yyparse    quote_calc_parse
1917680Spst#endif /* yyparse */
2026183Sfenner
2117680Spst#ifndef yylex
2217680Spst#define yylex      quote_calc_lex
2356896Sfenner#endif /* yylex */
2456896Sfenner
2517680Spst#ifndef yyerror
2626183Sfenner#define yyerror    quote_calc_error
2717680Spst#endif /* yyerror */
28127675Sbms
29190207Srpaulo#ifndef yychar
3017680Spst#define yychar     quote_calc_char
3117680Spst#endif /* yychar */
3256896Sfenner
3356896Sfenner#ifndef yyval
3456896Sfenner#define yyval      quote_calc_val
3556896Sfenner#endif /* yyval */
36127675Sbms
3717680Spst#ifndef yylval
3817680Spst#define yylval     quote_calc_lval
3917680Spst#endif /* yylval */
4017680Spst
4117680Spst#ifndef yydebug
4217680Spst#define yydebug    quote_calc_debug
4317680Spst#endif /* yydebug */
4417680Spst
4517680Spst#ifndef yynerrs
4617680Spst#define yynerrs    quote_calc_nerrs
4717680Spst#endif /* yynerrs */
4817680Spst
4917680Spst#ifndef yyerrflag
5017680Spst#define yyerrflag  quote_calc_errflag
5117680Spst#endif /* yyerrflag */
5217680Spst
5317680Spst#ifndef yylhs
5417680Spst#define yylhs      quote_calc_lhs
5517680Spst#endif /* yylhs */
5617680Spst
5717680Spst#ifndef yylen
5817680Spst#define yylen      quote_calc_len
5917680Spst#endif /* yylen */
6017680Spst
61146778Ssam#ifndef yydefred
62146778Ssam#define yydefred   quote_calc_defred
63146778Ssam#endif /* yydefred */
6417680Spst
65127675Sbms#ifndef yydgoto
6617680Spst#define yydgoto    quote_calc_dgoto
6717680Spst#endif /* yydgoto */
6817680Spst
69146778Ssam#ifndef yysindex
7017680Spst#define yysindex   quote_calc_sindex
7117680Spst#endif /* yysindex */
7217680Spst
7317680Spst#ifndef yyrindex
7417680Spst#define yyrindex   quote_calc_rindex
7517680Spst#endif /* yyrindex */
7617680Spst
7717680Spst#ifndef yygindex
7817680Spst#define yygindex   quote_calc_gindex
7917680Spst#endif /* yygindex */
8017680Spst
8117680Spst#ifndef yytable
8217680Spst#define yytable    quote_calc_table
8317680Spst#endif /* yytable */
8417680Spst
8517680Spst#ifndef yycheck
8617680Spst#define yycheck    quote_calc_check
8717680Spst#endif /* yycheck */
88127675Sbms
8917680Spst#ifndef yyname
9017680Spst#define yyname     quote_calc_name
9117680Spst#endif /* yyname */
9217680Spst
9317680Spst#ifndef yyrule
9417680Spst#define yyrule     quote_calc_rule
9517680Spst#endif /* yyrule */
9617680Spst#define YYPREFIX "quote_calc_"
9717680Spst
9817680Spst#define YYPURE 0
9917680Spst
10017680Spst#line 2 "quote_calc.y"
10117680Spst# include <stdio.h>
102146778Ssam# include <ctype.h>
10317680Spst
10417680Spstint regs[26];
10517680Spstint base;
10617680Spst
10717680Spstint yylex(void);
10817680Spststatic void yyerror(const char *s);
10917680Spst
11017680Spst#line 111 "quote_calc.tab.c"
111146778Ssam
11298527Sfenner#if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
11398527Sfenner/* Default: YYSTYPE is the semantic value type. */
11498527Sfennertypedef int YYSTYPE;
11517680Spst# define YYSTYPE_IS_DECLARED 1
11617680Spst#endif
117146778Ssam
11817680Spst/* compatibility with bison */
11998527Sfenner#ifdef YYPARSE_PARAM
120146778Ssam/* compatibility with FreeBSD */
12198527Sfenner# ifdef YYPARSE_PARAM_TYPE
12298527Sfenner#  define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
12398527Sfenner# else
12498527Sfenner#  define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
12598527Sfenner# endif
126146778Ssam#else
12798527Sfenner# define YYPARSE_DECL() yyparse(void)
12817680Spst#endif
129146778Ssam
13017680Spst/* Parameters sent to lex. */
13117680Spst#ifdef YYLEX_PARAM
13217680Spst# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
13317680Spst# define YYLEX yylex(YYLEX_PARAM)
13417680Spst#else
13517680Spst# define YYLEX_DECL() yylex(void)
13617680Spst# define YYLEX yylex()
13717680Spst#endif
13817680Spst
13917680Spst/* Parameters sent to yyerror. */
14017680Spst#ifndef YYERROR_DECL
14117680Spst#define YYERROR_DECL() yyerror(const char *s)
14217680Spst#endif
14317680Spst#ifndef YYERROR_CALL
14417680Spst#define YYERROR_CALL(msg) yyerror(msg)
14517680Spst#endif
14617680Spst
14717680Spstextern int YYPARSE_DECL();
14817680Spst
14917680Spst#define OP_ADD 257
15017680Spst#define ADD 258
15117680Spst#define OP_SUB 259
15298527Sfenner#define SUB 260
153127675Sbms#define OP_MUL 261
15417680Spst#define MUL 262
15517680Spst#define OP_DIV 263
15617680Spst#define DIV 264
15717680Spst#define OP_MOD 265
15817680Spst#define MOD 266
15917680Spst#define OP_AND 267
16017680Spst#define AND 268
16117680Spst#define DIGIT 269
16217680Spst#define LETTER 270
16317680Spst#define UMINUS 271
164147904Ssam#define YYERRCODE 256
165147904Ssamtypedef int YYINT;
166147904Ssamstatic const YYINT quote_calc_lhs[] = {                  -1,
167147904Ssam    0,    0,    0,    1,    1,    2,    2,    2,    2,    2,
168147904Ssam    2,    2,    2,    2,    2,    2,    3,    3,
169147904Ssam};
17098527Sfennerstatic const YYINT quote_calc_len[] = {                   2,
17117680Spst    0,    3,    3,    1,    3,    3,    3,    3,    3,    3,
17217680Spst    3,    3,    3,    2,    1,    1,    1,    2,
17317680Spst};
17417680Spststatic const YYINT quote_calc_defred[] = {                1,
17517680Spst    0,    0,    0,   17,    0,    0,    0,    0,    0,    3,
17617680Spst   15,    0,    0,    0,    2,    0,    0,    0,    0,    0,
17717680Spst    0,    0,   18,    0,    6,    0,    0,    0,    0,    0,
17898527Sfenner    0,    0,
17917680Spst};
18017680Spststatic const YYINT quote_calc_dgoto[] = {                 1,
18198527Sfenner    7,    8,    9,
18217680Spst};
18398527Sfennerstatic const YYINT quote_calc_sindex[] = {                0,
18417680Spst  -38,    5,  -36,    0,  -51,  -36,    7, -121, -248,    0,
18517680Spst    0, -243,  -36,  -22,    0,  -36,  -36,  -36,  -36,  -36,
18617680Spst  -36,  -36,    0, -121,    0, -121, -121, -121, -121, -121,
18717680Spst -121, -243,
18817680Spst};
18917680Spststatic const YYINT quote_calc_rindex[] = {                0,
19017680Spst    0,    0,    0,    0,   -9,    0,    0,   13,  -10,    0,
19117680Spst    0,   -5,    0,    0,    0,    0,    0,    0,    0,    0,
19217680Spst    0,    0,    0,   15,    0,   -3,   -2,   -1,    1,    2,
19317680Spst    3,   -4,
19417680Spst};
19517680Spststatic const YYINT quote_calc_gindex[] = {                0,
19617680Spst    0,   42,    0,
19717680Spst};
19817680Spst#define YYTABLESIZE 258
19917680Spststatic const YYINT quote_calc_table[] = {                16,
20017680Spst   15,    6,   22,    6,   14,   13,    7,    8,    9,   13,
201162021Ssam   10,   11,   12,   16,   10,   17,   15,   18,   25,   19,
20217680Spst   23,   20,    4,   21,    5,    0,    0,    0,    0,    0,
20317680Spst   16,    0,    0,    0,    0,   14,   13,    7,    8,    9,
20417680Spst    0,   10,   11,   12,   12,    0,    0,   14,    0,    0,
20517680Spst    0,    0,    0,    0,   24,    0,    0,   26,   27,   28,
20617680Spst   29,   30,   31,   32,    0,    0,    0,    0,    0,    0,
20717680Spst    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
20817680Spst    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
209162021Ssam    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
21017680Spst    0,   22,    0,    0,    0,    0,    0,    0,    0,    0,
21117680Spst    0,    0,    0,   16,   15,    0,    0,    0,   14,   13,
21217680Spst    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
21317680Spst    0,    0,    0,    0,    0,   16,    0,   17,    0,   18,
21417680Spst    0,   19,    0,   20,    0,   21,    0,    0,    0,    0,
21517680Spst    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
21617680Spst    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
21798527Sfenner    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
21898527Sfenner    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
21917680Spst    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
22098527Sfenner    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
22117680Spst    0,    0,    0,    0,    0,    0,    0,    2,    0,    0,
22298527Sfenner    3,    0,    3,    0,    0,    0,    0,    0,    0,    0,
22317680Spst    4,    5,    4,   11,   16,    0,   17,    0,   18,    0,
224   19,    0,   20,    0,   21,    0,   16,   15,   16,   15,
225   16,   15,   16,   15,   16,   15,   16,   15,
226};
227static const YYINT quote_calc_check[] = {                10,
228   10,   40,  124,   40,   10,   10,   10,   10,   10,   61,
229   10,   10,   10,  257,   10,  259,   10,  261,   41,  263,
230  269,  265,   10,  267,   10,   -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   -1,  124,   -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,  257,   -1,  259,   -1,  261,
242   -1,  263,   -1,  265,   -1,  267,   -1,   -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  259,   -1,  259,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
251  269,  270,  269,  270,  257,   -1,  259,   -1,  261,   -1,
252  263,   -1,  265,   -1,  267,   -1,  257,  257,  259,  259,
253  261,  261,  263,  263,  265,  265,  267,  267,
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
263static const char *const quote_calc_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,
2660,0,0,0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,
2670,0,0,0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2680,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,
2690,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2700,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2710,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2720,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,
2740,0,"illegal-symbol",
275};
276static const char *const quote_calc_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 OP_ADD expr",
285"expr : expr OP_SUB expr",
286"expr : expr OP_MUL expr",
287"expr : expr OP_DIV expr",
288"expr : expr OP_MOD expr",
289"expr : expr OP_AND expr",
290"expr : expr '|' expr",
291"expr : OP_SUB expr",
292"expr : LETTER",
293"expr : number",
294"number : DIGIT",
295"number : number DIGIT",
296
297};
298#endif
299
300int      yydebug;
301int      yynerrs;
302
303int      yyerrflag;
304int      yychar;
305YYSTYPE  yyval;
306YYSTYPE  yylval;
307
308/* define the initial stack-sizes */
309#ifdef YYSTACKSIZE
310#undef YYMAXDEPTH
311#define YYMAXDEPTH  YYSTACKSIZE
312#else
313#ifdef YYMAXDEPTH
314#define YYSTACKSIZE YYMAXDEPTH
315#else
316#define YYSTACKSIZE 10000
317#define YYMAXDEPTH  10000
318#endif
319#endif
320
321#define YYINITSTACKSIZE 200
322
323typedef struct {
324    unsigned stacksize;
325    YYINT    *s_base;
326    YYINT    *s_mark;
327    YYINT    *s_last;
328    YYSTYPE  *l_base;
329    YYSTYPE  *l_mark;
330} YYSTACKDATA;
331/* variables for the parser stack */
332static YYSTACKDATA yystack;
333#line 73 "quote_calc.y"
334 /* start of programs */
335
336int
337main (void)
338{
339    while(!feof(stdin)) {
340	yyparse();
341    }
342    return 0;
343}
344
345static void
346yyerror(const char *s)
347{
348    fprintf(stderr, "%s\n", s);
349}
350
351int
352yylex(void) {
353	/* lexical analysis routine */
354	/* returns LETTER for a lower case letter, yylval = 0 through 25 */
355	/* return DIGIT for a digit, yylval = 0 through 9 */
356	/* all other characters are returned immediately */
357
358    int c;
359
360    while( (c=getchar()) == ' ' )   { /* skip blanks */ }
361
362    /* c is now nonblank */
363
364    if( islower( c )) {
365	yylval = c - 'a';
366	return ( LETTER );
367    }
368    if( isdigit( c )) {
369	yylval = c - '0';
370	return ( DIGIT );
371    }
372    return( c );
373}
374#line 375 "quote_calc.tab.c"
375
376#if YYDEBUG
377#include <stdio.h>		/* needed for printf */
378#endif
379
380#include <stdlib.h>	/* needed for malloc, etc */
381#include <string.h>	/* needed for memset */
382
383/* allocate initial stack or double stack size, up to YYMAXDEPTH */
384static int yygrowstack(YYSTACKDATA *data)
385{
386    int i;
387    unsigned newsize;
388    YYINT *newss;
389    YYSTYPE *newvs;
390
391    if ((newsize = data->stacksize) == 0)
392        newsize = YYINITSTACKSIZE;
393    else if (newsize >= YYMAXDEPTH)
394        return YYENOMEM;
395    else if ((newsize *= 2) > YYMAXDEPTH)
396        newsize = YYMAXDEPTH;
397
398    i = (int) (data->s_mark - data->s_base);
399    newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
400    if (newss == 0)
401        return YYENOMEM;
402
403    data->s_base = newss;
404    data->s_mark = newss + i;
405
406    newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
407    if (newvs == 0)
408        return YYENOMEM;
409
410    data->l_base = newvs;
411    data->l_mark = newvs + i;
412
413    data->stacksize = newsize;
414    data->s_last = data->s_base + newsize - 1;
415    return 0;
416}
417
418#if YYPURE || defined(YY_NO_LEAKS)
419static void yyfreestack(YYSTACKDATA *data)
420{
421    free(data->s_base);
422    free(data->l_base);
423    memset(data, 0, sizeof(*data));
424}
425#else
426#define yyfreestack(data) /* nothing */
427#endif
428
429#define YYABORT  goto yyabort
430#define YYREJECT goto yyabort
431#define YYACCEPT goto yyaccept
432#define YYERROR  goto yyerrlab
433
434int
435YYPARSE_DECL()
436{
437    int yym, yyn, yystate;
438#if YYDEBUG
439    const char *yys;
440
441    if ((yys = getenv("YYDEBUG")) != 0)
442    {
443        yyn = *yys;
444        if (yyn >= '0' && yyn <= '9')
445            yydebug = yyn - '0';
446    }
447#endif
448
449    yynerrs = 0;
450    yyerrflag = 0;
451    yychar = YYEMPTY;
452    yystate = 0;
453
454#if YYPURE
455    memset(&yystack, 0, sizeof(yystack));
456#endif
457
458    if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
459    yystack.s_mark = yystack.s_base;
460    yystack.l_mark = yystack.l_base;
461    yystate = 0;
462    *yystack.s_mark = 0;
463
464yyloop:
465    if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
466    if (yychar < 0)
467    {
468        if ((yychar = YYLEX) < 0) yychar = YYEOF;
469#if YYDEBUG
470        if (yydebug)
471        {
472            yys = yyname[YYTRANSLATE(yychar)];
473            printf("%sdebug: state %d, reading %d (%s)\n",
474                    YYPREFIX, yystate, yychar, yys);
475        }
476#endif
477    }
478    if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
479            yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
480    {
481#if YYDEBUG
482        if (yydebug)
483            printf("%sdebug: state %d, shifting to state %d\n",
484                    YYPREFIX, yystate, yytable[yyn]);
485#endif
486        if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
487        {
488            goto yyoverflow;
489        }
490        yystate = yytable[yyn];
491        *++yystack.s_mark = yytable[yyn];
492        *++yystack.l_mark = yylval;
493        yychar = YYEMPTY;
494        if (yyerrflag > 0)  --yyerrflag;
495        goto yyloop;
496    }
497    if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
498            yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
499    {
500        yyn = yytable[yyn];
501        goto yyreduce;
502    }
503    if (yyerrflag) goto yyinrecovery;
504
505    YYERROR_CALL("syntax error");
506
507    goto yyerrlab;
508
509yyerrlab:
510    ++yynerrs;
511
512yyinrecovery:
513    if (yyerrflag < 3)
514    {
515        yyerrflag = 3;
516        for (;;)
517        {
518            if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
519                    yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
520            {
521#if YYDEBUG
522                if (yydebug)
523                    printf("%sdebug: state %d, error recovery shifting\
524 to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
525#endif
526                if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
527                {
528                    goto yyoverflow;
529                }
530                yystate = yytable[yyn];
531                *++yystack.s_mark = yytable[yyn];
532                *++yystack.l_mark = yylval;
533                goto yyloop;
534            }
535            else
536            {
537#if YYDEBUG
538                if (yydebug)
539                    printf("%sdebug: error recovery discarding state %d\n",
540                            YYPREFIX, *yystack.s_mark);
541#endif
542                if (yystack.s_mark <= yystack.s_base) goto yyabort;
543                --yystack.s_mark;
544                --yystack.l_mark;
545            }
546        }
547    }
548    else
549    {
550        if (yychar == YYEOF) goto yyabort;
551#if YYDEBUG
552        if (yydebug)
553        {
554            yys = yyname[YYTRANSLATE(yychar)];
555            printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
556                    YYPREFIX, yystate, yychar, yys);
557        }
558#endif
559        yychar = YYEMPTY;
560        goto yyloop;
561    }
562
563yyreduce:
564#if YYDEBUG
565    if (yydebug)
566        printf("%sdebug: state %d, reducing by rule %d (%s)\n",
567                YYPREFIX, yystate, yyn, yyrule[yyn]);
568#endif
569    yym = yylen[yyn];
570    if (yym)
571        yyval = yystack.l_mark[1-yym];
572    else
573        memset(&yyval, 0, sizeof yyval);
574    switch (yyn)
575    {
576case 3:
577#line 35 "quote_calc.y"
578	{  yyerrok ; }
579break;
580case 4:
581#line 39 "quote_calc.y"
582	{  printf("%d\n",yystack.l_mark[0]);}
583break;
584case 5:
585#line 41 "quote_calc.y"
586	{  regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
587break;
588case 6:
589#line 45 "quote_calc.y"
590	{  yyval = yystack.l_mark[-1]; }
591break;
592case 7:
593#line 47 "quote_calc.y"
594	{  yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
595break;
596case 8:
597#line 49 "quote_calc.y"
598	{  yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
599break;
600case 9:
601#line 51 "quote_calc.y"
602	{  yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
603break;
604case 10:
605#line 53 "quote_calc.y"
606	{  yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
607break;
608case 11:
609#line 55 "quote_calc.y"
610	{  yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
611break;
612case 12:
613#line 57 "quote_calc.y"
614	{  yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
615break;
616case 13:
617#line 59 "quote_calc.y"
618	{  yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
619break;
620case 14:
621#line 61 "quote_calc.y"
622	{  yyval = - yystack.l_mark[0]; }
623break;
624case 15:
625#line 63 "quote_calc.y"
626	{  yyval = regs[yystack.l_mark[0]]; }
627break;
628case 17:
629#line 68 "quote_calc.y"
630	{  yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; }
631break;
632case 18:
633#line 70 "quote_calc.y"
634	{  yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
635break;
636#line 637 "quote_calc.tab.c"
637    }
638    yystack.s_mark -= yym;
639    yystate = *yystack.s_mark;
640    yystack.l_mark -= yym;
641    yym = yylhs[yyn];
642    if (yystate == 0 && yym == 0)
643    {
644#if YYDEBUG
645        if (yydebug)
646            printf("%sdebug: after reduction, shifting from state 0 to\
647 state %d\n", YYPREFIX, YYFINAL);
648#endif
649        yystate = YYFINAL;
650        *++yystack.s_mark = YYFINAL;
651        *++yystack.l_mark = yyval;
652        if (yychar < 0)
653        {
654            if ((yychar = YYLEX) < 0) yychar = YYEOF;
655#if YYDEBUG
656            if (yydebug)
657            {
658                yys = yyname[YYTRANSLATE(yychar)];
659                printf("%sdebug: state %d, reading %d (%s)\n",
660                        YYPREFIX, YYFINAL, yychar, yys);
661            }
662#endif
663        }
664        if (yychar == YYEOF) goto yyaccept;
665        goto yyloop;
666    }
667    if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
668            yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
669        yystate = yytable[yyn];
670    else
671        yystate = yydgoto[yym];
672#if YYDEBUG
673    if (yydebug)
674        printf("%sdebug: after reduction, shifting from state %d \
675to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
676#endif
677    if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
678    {
679        goto yyoverflow;
680    }
681    *++yystack.s_mark = (YYINT) yystate;
682    *++yystack.l_mark = yyval;
683    goto yyloop;
684
685yyoverflow:
686    YYERROR_CALL("yacc stack overflow");
687
688yyabort:
689    yyfreestack(&yystack);
690    return (1);
691
692yyaccept:
693    yyfreestack(&yystack);
694    return (0);
695}
696