Home | History | Annotate | Line # | Download | only in btyacc
      1  1.1  christos /*	$NetBSD: defines3.calc.c,v 1.3 2026/01/18 16:41:30 christos Exp $	*/
      2  1.1  christos 
      3  1.1  christos /* original parser id follows */
      4  1.1  christos /* yysccsid[] = "@(#)yaccpar	1.9 (Berkeley) 02/21/93" */
      5  1.1  christos /* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
      6  1.1  christos 
      7  1.1  christos #define YYBYACC 1
      8  1.2  christos #define YYMAJOR 2
      9  1.2  christos #define YYMINOR 0
     10  1.1  christos #define YYCHECK "yyyymmdd"
     11  1.1  christos 
     12  1.1  christos #define YYEMPTY        (-1)
     13  1.1  christos #define yyclearin      (yychar = YYEMPTY)
     14  1.1  christos #define yyerrok        (yyerrflag = 0)
     15  1.1  christos #define YYRECOVERING() (yyerrflag != 0)
     16  1.1  christos #define YYENOMEM       (-2)
     17  1.1  christos #define YYEOF          0
     18  1.1  christos #undef YYBTYACC
     19  1.1  christos #define YYBTYACC 0
     20  1.1  christos #define YYDEBUGSTR YYPREFIX "debug"
     21  1.1  christos #define YYPREFIX "yy"
     22  1.1  christos 
     23  1.1  christos #define YYPURE 0
     24  1.1  christos 
     25  1.1  christos #line 2 "calc.y"
     26  1.1  christos # include <stdio.h>
     27  1.1  christos # include <ctype.h>
     28  1.1  christos 
     29  1.1  christos int regs[26];
     30  1.1  christos int base;
     31  1.1  christos 
     32  1.1  christos extern int yylex(void);
     33  1.1  christos static void yyerror(const char *s);
     34  1.1  christos 
     35  1.1  christos #line 34 "prefix.tab.c"
     36  1.1  christos 
     37  1.1  christos #if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
     38  1.1  christos /* Default: YYSTYPE is the semantic value type. */
     39  1.1  christos typedef int YYSTYPE;
     40  1.1  christos # define YYSTYPE_IS_DECLARED 1
     41  1.1  christos #endif
     42  1.1  christos 
     43  1.1  christos /* compatibility with bison */
     44  1.1  christos #ifdef YYPARSE_PARAM
     45  1.1  christos /* compatibility with FreeBSD */
     46  1.1  christos # ifdef YYPARSE_PARAM_TYPE
     47  1.1  christos #  define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
     48  1.1  christos # else
     49  1.1  christos #  define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
     50  1.1  christos # endif
     51  1.1  christos #else
     52  1.1  christos # define YYPARSE_DECL() yyparse(void)
     53  1.1  christos #endif
     54  1.1  christos 
     55  1.1  christos /* Parameters sent to lex. */
     56  1.1  christos #ifdef YYLEX_PARAM
     57  1.1  christos # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
     58  1.1  christos # define YYLEX yylex(YYLEX_PARAM)
     59  1.1  christos #else
     60  1.1  christos # define YYLEX_DECL() yylex(void)
     61  1.1  christos # define YYLEX yylex()
     62  1.1  christos #endif
     63  1.1  christos 
     64  1.1  christos #if !(defined(yylex) || defined(YYSTATE))
     65  1.1  christos int YYLEX_DECL();
     66  1.1  christos #endif
     67  1.1  christos 
     68  1.1  christos /* Parameters sent to yyerror. */
     69  1.1  christos #ifndef YYERROR_DECL
     70  1.1  christos #define YYERROR_DECL() yyerror(const char *s)
     71  1.1  christos #endif
     72  1.1  christos #ifndef YYERROR_CALL
     73  1.1  christos #define YYERROR_CALL(msg) yyerror(msg)
     74  1.1  christos #endif
     75  1.1  christos 
     76  1.1  christos extern int YYPARSE_DECL();
     77  1.1  christos 
     78  1.1  christos #define DIGIT 257
     79  1.1  christos #define LETTER 258
     80  1.1  christos #define UMINUS 259
     81  1.1  christos #define YYERRCODE 256
     82  1.2  christos typedef int YYINT;
     83  1.1  christos static const YYINT yylhs[] = {                           -1,
     84  1.1  christos     0,    0,    0,    1,    1,    2,    2,    2,    2,    2,
     85  1.1  christos     2,    2,    2,    2,    2,    2,    3,    3,
     86  1.1  christos };
     87  1.1  christos static const YYINT yylen[] = {                            2,
     88  1.1  christos     0,    3,    3,    1,    3,    3,    3,    3,    3,    3,
     89  1.1  christos     3,    3,    3,    2,    1,    1,    1,    2,
     90  1.1  christos };
     91  1.1  christos static const YYINT yydefred[] = {                         1,
     92  1.1  christos     0,    0,   17,    0,    0,    0,    0,    0,    0,    3,
     93  1.1  christos     0,   15,   14,    0,    2,    0,    0,    0,    0,    0,
     94  1.1  christos     0,    0,   18,    0,    6,    0,    0,    0,    0,    9,
     95  1.1  christos    10,   11,
     96  1.1  christos };
     97  1.1  christos #if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING)
     98  1.1  christos static const YYINT yystos[] = {                           0,
     99  1.1  christos   261,  256,  257,  258,   45,   40,  262,  263,  264,   10,
    100  1.1  christos    61,  258,  263,  263,   10,  124,   38,   43,   45,   42,
    101  1.1  christos    47,   37,  257,  263,   41,  263,  263,  263,  263,  263,
    102  1.1  christos   263,  263,
    103  1.1  christos };
    104  1.1  christos #endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */
    105  1.1  christos static const YYINT yydgoto[] = {                          1,
    106  1.1  christos     7,    8,    9,
    107  1.1  christos };
    108  1.1  christos static const YYINT yysindex[] = {                         0,
    109  1.1  christos   -40,   -7,    0,  -55,  -38,  -38,    1,  -29, -247,    0,
    110  1.1  christos   -38,    0,    0,   22,    0,  -38,  -38,  -38,  -38,  -38,
    111  1.1  christos   -38,  -38,    0,  -29,    0,   51,   60,  -20,  -20,    0,
    112  1.1  christos     0,    0,
    113  1.1  christos };
    114  1.1  christos static const YYINT yyrindex[] = {                         0,
    115  1.1  christos     0,    0,    0,    2,    0,    0,    0,    9,   -9,    0,
    116  1.1  christos     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    117  1.1  christos     0,    0,    0,   10,    0,   -6,   14,    5,   13,    0,
    118  1.1  christos     0,    0,
    119  1.1  christos };
    120  1.1  christos #if YYBTYACC
    121  1.1  christos static const YYINT yycindex[] = {                         0,
    122  1.1  christos     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    123  1.1  christos     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    124  1.1  christos     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    125  1.1  christos     0,    0,
    126  1.1  christos };
    127  1.1  christos #endif
    128  1.1  christos static const YYINT yygindex[] = {                         0,
    129  1.1  christos     0,   65,    0,
    130  1.1  christos };
    131  1.1  christos #define YYTABLESIZE 220
    132  1.1  christos static const YYINT yytable[] = {                          6,
    133  1.1  christos    16,    6,   10,   13,    5,   11,    5,   22,   17,   23,
    134  1.1  christos    15,   15,   20,   18,    7,   19,   22,   21,    4,    5,
    135  1.1  christos     0,   20,    8,   12,    0,    0,   21,   16,   16,    0,
    136  1.1  christos     0,   16,   16,   16,   13,   16,    0,   16,   15,   15,
    137  1.1  christos     0,    0,    7,   15,   15,    7,   15,    7,   15,    7,
    138  1.1  christos     8,   12,    0,    8,   12,    8,    0,    8,   22,   17,
    139  1.1  christos     0,    0,   25,   20,   18,    0,   19,    0,   21,   13,
    140  1.1  christos    14,    0,    0,    0,    0,   24,    0,    0,    0,    0,
    141  1.1  christos    26,   27,   28,   29,   30,   31,   32,   22,   17,    0,
    142  1.1  christos     0,    0,   20,   18,   16,   19,   22,   21,    0,    0,
    143  1.1  christos     0,   20,   18,    0,   19,    0,   21,    0,    0,    0,
    144  1.1  christos     0,    0,    0,    0,   16,    0,    0,   13,    0,    0,
    145  1.1  christos     0,    0,    0,    0,    0,   15,    0,    0,    7,    0,
    146  1.1  christos     0,    0,    0,    0,    0,    0,    8,   12,    0,    0,
    147  1.1  christos     0,    0,    0,    0,    0,   16,    0,    0,    0,    0,
    148  1.1  christos     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    149  1.1  christos     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    150  1.1  christos     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    151  1.1  christos     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    152  1.1  christos     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    153  1.1  christos     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    154  1.1  christos     0,    0,    0,    0,    0,    2,    3,    4,    3,   12,
    155  1.1  christos };
    156  1.1  christos static const YYINT yycheck[] = {                         40,
    157  1.1  christos    10,   40,   10,   10,   45,   61,   45,   37,   38,  257,
    158  1.1  christos    10,   10,   42,   43,   10,   45,   37,   47,   10,   10,
    159  1.1  christos    -1,   42,   10,   10,   -1,   -1,   47,   37,   38,   -1,
    160  1.1  christos    -1,   41,   42,   43,   41,   45,   -1,   47,   37,   38,
    161  1.1  christos    -1,   -1,   38,   42,   43,   41,   45,   43,   47,   45,
    162  1.1  christos    38,   38,   -1,   41,   41,   43,   -1,   45,   37,   38,
    163  1.1  christos    -1,   -1,   41,   42,   43,   -1,   45,   -1,   47,    5,
    164  1.1  christos     6,   -1,   -1,   -1,   -1,   11,   -1,   -1,   -1,   -1,
    165  1.1  christos    16,   17,   18,   19,   20,   21,   22,   37,   38,   -1,
    166  1.1  christos    -1,   -1,   42,   43,  124,   45,   37,   47,   -1,   -1,
    167  1.1  christos    -1,   42,   43,   -1,   45,   -1,   47,   -1,   -1,   -1,
    168  1.1  christos    -1,   -1,   -1,   -1,  124,   -1,   -1,  124,   -1,   -1,
    169  1.1  christos    -1,   -1,   -1,   -1,   -1,  124,   -1,   -1,  124,   -1,
    170  1.1  christos    -1,   -1,   -1,   -1,   -1,   -1,  124,  124,   -1,   -1,
    171  1.1  christos    -1,   -1,   -1,   -1,   -1,  124,   -1,   -1,   -1,   -1,
    172  1.1  christos    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
    173  1.1  christos    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
    174  1.1  christos    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
    175  1.1  christos    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
    176  1.1  christos    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
    177  1.1  christos    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
    178  1.1  christos    -1,   -1,   -1,   -1,   -1,  256,  257,  258,  257,  258,
    179  1.1  christos };
    180  1.1  christos #if YYBTYACC
    181  1.1  christos static const YYINT yyctable[] = {                        -1,
    182  1.1  christos    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
    183  1.1  christos    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
    184  1.1  christos    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
    185  1.1  christos    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
    186  1.1  christos    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
    187  1.1  christos    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
    188  1.1  christos    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
    189  1.1  christos    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
    190  1.1  christos    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
    191  1.1  christos    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
    192  1.1  christos    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
    193  1.1  christos    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
    194  1.1  christos    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
    195  1.1  christos    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
    196  1.1  christos    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
    197  1.1  christos    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
    198  1.1  christos    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
    199  1.1  christos    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
    200  1.1  christos    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
    201  1.1  christos    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
    202  1.1  christos    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
    203  1.1  christos    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
    204  1.1  christos };
    205  1.1  christos #endif
    206  1.1  christos #define YYFINAL 1
    207  1.1  christos #ifndef YYDEBUG
    208  1.1  christos #define YYDEBUG 0
    209  1.1  christos #endif
    210  1.1  christos #define YYMAXTOKEN 259
    211  1.1  christos #define YYUNDFTOKEN 265
    212  1.1  christos #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
    213  1.1  christos #if YYDEBUG
    214  1.3  christos #ifndef NULL
    215  1.3  christos #define NULL (void*)0
    216  1.3  christos #endif
    217  1.1  christos static const char *const yyname[] = {
    218  1.1  christos 
    219  1.3  christos "$end",NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,"'\\n'",NULL,NULL,NULL,NULL,
    220  1.3  christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
    221  1.3  christos NULL,NULL,NULL,NULL,NULL,NULL,"'%'","'&'",NULL,"'('","')'","'*'","'+'",NULL,
    222  1.3  christos "'-'",NULL,"'/'",NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
    223  1.3  christos NULL,"'='",NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
    224  1.3  christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
    225  1.3  christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
    226  1.3  christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
    227  1.3  christos NULL,"'|'",NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
    228  1.3  christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
    229  1.3  christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
    230  1.3  christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
    231  1.3  christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
    232  1.3  christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
    233  1.3  christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
    234  1.3  christos NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
    235  1.3  christos NULL,NULL,NULL,NULL,NULL,NULL,"error","DIGIT","LETTER","UMINUS","$accept",
    236  1.3  christos "list","stat","expr","number","illegal-symbol",
    237  1.1  christos };
    238  1.1  christos static const char *const yyrule[] = {
    239  1.1  christos "$accept : list",
    240  1.1  christos "list :",
    241  1.1  christos "list : list stat '\\n'",
    242  1.1  christos "list : list error '\\n'",
    243  1.1  christos "stat : expr",
    244  1.1  christos "stat : LETTER '=' expr",
    245  1.1  christos "expr : '(' expr ')'",
    246  1.1  christos "expr : expr '+' expr",
    247  1.1  christos "expr : expr '-' expr",
    248  1.1  christos "expr : expr '*' expr",
    249  1.1  christos "expr : expr '/' expr",
    250  1.1  christos "expr : expr '%' expr",
    251  1.1  christos "expr : expr '&' expr",
    252  1.1  christos "expr : expr '|' expr",
    253  1.1  christos "expr : '-' expr",
    254  1.1  christos "expr : LETTER",
    255  1.1  christos "expr : number",
    256  1.1  christos "number : DIGIT",
    257  1.1  christos "number : number DIGIT",
    258  1.1  christos 
    259  1.1  christos };
    260  1.1  christos #endif
    261  1.1  christos 
    262  1.1  christos #if YYDEBUG
    263  1.1  christos int      yydebug;
    264  1.1  christos #endif
    265  1.1  christos 
    266  1.1  christos int      yyerrflag;
    267  1.1  christos int      yychar;
    268  1.1  christos YYSTYPE  yyval;
    269  1.1  christos YYSTYPE  yylval;
    270  1.1  christos int      yynerrs;
    271  1.1  christos 
    272  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
    273  1.1  christos YYLTYPE  yyloc; /* position returned by actions */
    274  1.1  christos YYLTYPE  yylloc; /* position from the lexer */
    275  1.1  christos #endif
    276  1.1  christos 
    277  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
    278  1.1  christos #ifndef YYLLOC_DEFAULT
    279  1.1  christos #define YYLLOC_DEFAULT(loc, rhs, n) \
    280  1.1  christos do \
    281  1.1  christos { \
    282  1.1  christos     if (n == 0) \
    283  1.1  christos     { \
    284  1.1  christos         (loc).first_line   = YYRHSLOC(rhs, 0).last_line; \
    285  1.1  christos         (loc).first_column = YYRHSLOC(rhs, 0).last_column; \
    286  1.1  christos         (loc).last_line    = YYRHSLOC(rhs, 0).last_line; \
    287  1.1  christos         (loc).last_column  = YYRHSLOC(rhs, 0).last_column; \
    288  1.1  christos     } \
    289  1.1  christos     else \
    290  1.1  christos     { \
    291  1.1  christos         (loc).first_line   = YYRHSLOC(rhs, 1).first_line; \
    292  1.1  christos         (loc).first_column = YYRHSLOC(rhs, 1).first_column; \
    293  1.1  christos         (loc).last_line    = YYRHSLOC(rhs, n).last_line; \
    294  1.1  christos         (loc).last_column  = YYRHSLOC(rhs, n).last_column; \
    295  1.1  christos     } \
    296  1.1  christos } while (0)
    297  1.1  christos #endif /* YYLLOC_DEFAULT */
    298  1.1  christos #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
    299  1.1  christos #if YYBTYACC
    300  1.1  christos 
    301  1.1  christos #ifndef YYLVQUEUEGROWTH
    302  1.1  christos #define YYLVQUEUEGROWTH 32
    303  1.1  christos #endif
    304  1.1  christos #endif /* YYBTYACC */
    305  1.1  christos 
    306  1.1  christos /* define the initial stack-sizes */
    307  1.1  christos #ifdef YYSTACKSIZE
    308  1.1  christos #undef YYMAXDEPTH
    309  1.1  christos #define YYMAXDEPTH  YYSTACKSIZE
    310  1.1  christos #else
    311  1.1  christos #ifdef YYMAXDEPTH
    312  1.1  christos #define YYSTACKSIZE YYMAXDEPTH
    313  1.1  christos #else
    314  1.1  christos #define YYSTACKSIZE 10000
    315  1.1  christos #define YYMAXDEPTH  10000
    316  1.1  christos #endif
    317  1.1  christos #endif
    318  1.1  christos 
    319  1.1  christos #ifndef YYINITSTACKSIZE
    320  1.1  christos #define YYINITSTACKSIZE 200
    321  1.1  christos #endif
    322  1.1  christos 
    323  1.1  christos typedef struct {
    324  1.1  christos     unsigned stacksize;
    325  1.1  christos     YYINT    *s_base;
    326  1.1  christos     YYINT    *s_mark;
    327  1.1  christos     YYINT    *s_last;
    328  1.1  christos     YYSTYPE  *l_base;
    329  1.1  christos     YYSTYPE  *l_mark;
    330  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
    331  1.1  christos     YYLTYPE  *p_base;
    332  1.1  christos     YYLTYPE  *p_mark;
    333  1.1  christos #endif
    334  1.1  christos } YYSTACKDATA;
    335  1.1  christos #if YYBTYACC
    336  1.1  christos 
    337  1.1  christos struct YYParseState_s
    338  1.1  christos {
    339  1.1  christos     struct YYParseState_s *save;    /* Previously saved parser state */
    340  1.1  christos     YYSTACKDATA            yystack; /* saved parser stack */
    341  1.1  christos     int                    state;   /* saved parser state */
    342  1.1  christos     int                    errflag; /* saved error recovery status */
    343  1.1  christos     int                    lexeme;  /* saved index of the conflict lexeme in the lexical queue */
    344  1.1  christos     YYINT                  ctry;    /* saved index in yyctable[] for this conflict */
    345  1.1  christos };
    346  1.1  christos typedef struct YYParseState_s YYParseState;
    347  1.1  christos #endif /* YYBTYACC */
    348  1.1  christos /* variables for the parser stack */
    349  1.1  christos static YYSTACKDATA yystack;
    350  1.1  christos #if YYBTYACC
    351  1.1  christos 
    352  1.1  christos /* Current parser state */
    353  1.3  christos static YYParseState *yyps = NULL;
    354  1.1  christos 
    355  1.1  christos /* yypath != NULL: do the full parse, starting at *yypath parser state. */
    356  1.3  christos static YYParseState *yypath = NULL;
    357  1.1  christos 
    358  1.1  christos /* Base of the lexical value queue */
    359  1.3  christos static YYSTYPE *yylvals = NULL;
    360  1.1  christos 
    361  1.1  christos /* Current position at lexical value queue */
    362  1.3  christos static YYSTYPE *yylvp = NULL;
    363  1.1  christos 
    364  1.1  christos /* End position of lexical value queue */
    365  1.3  christos static YYSTYPE *yylve = NULL;
    366  1.1  christos 
    367  1.1  christos /* The last allocated position at the lexical value queue */
    368  1.3  christos static YYSTYPE *yylvlim = NULL;
    369  1.1  christos 
    370  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
    371  1.1  christos /* Base of the lexical position queue */
    372  1.3  christos static YYLTYPE *yylpsns = NULL;
    373  1.1  christos 
    374  1.1  christos /* Current position at lexical position queue */
    375  1.3  christos static YYLTYPE *yylpp = NULL;
    376  1.1  christos 
    377  1.1  christos /* End position of lexical position queue */
    378  1.3  christos static YYLTYPE *yylpe = NULL;
    379  1.1  christos 
    380  1.1  christos /* The last allocated position at the lexical position queue */
    381  1.3  christos static YYLTYPE *yylplim = NULL;
    382  1.1  christos #endif
    383  1.1  christos 
    384  1.1  christos /* Current position at lexical token queue */
    385  1.3  christos static YYINT  *yylexp = NULL;
    386  1.1  christos 
    387  1.3  christos static YYINT  *yylexemes = NULL;
    388  1.1  christos #endif /* YYBTYACC */
    389  1.1  christos #line 66 "calc.y"
    390  1.1  christos  /* start of programs */
    391  1.1  christos 
    392  1.1  christos int
    393  1.1  christos main (void)
    394  1.1  christos {
    395  1.1  christos     while(!feof(stdin)) {
    396  1.1  christos 	yyparse();
    397  1.1  christos     }
    398  1.1  christos     return 0;
    399  1.1  christos }
    400  1.1  christos 
    401  1.1  christos static void
    402  1.1  christos yyerror(const char *s)
    403  1.1  christos {
    404  1.1  christos     fprintf(stderr, "%s\n", s);
    405  1.1  christos }
    406  1.1  christos 
    407  1.1  christos int
    408  1.1  christos yylex(void)
    409  1.1  christos {
    410  1.1  christos 	/* lexical analysis routine */
    411  1.1  christos 	/* returns LETTER for a lower case letter, yylval = 0 through 25 */
    412  1.1  christos 	/* return DIGIT for a digit, yylval = 0 through 9 */
    413  1.1  christos 	/* all other characters are returned immediately */
    414  1.1  christos 
    415  1.1  christos     int c;
    416  1.1  christos 
    417  1.1  christos     while( (c=getchar()) == ' ' )   { /* skip blanks */ }
    418  1.1  christos 
    419  1.1  christos     /* c is now nonblank */
    420  1.1  christos 
    421  1.1  christos     if( islower( c )) {
    422  1.1  christos 	yylval = c - 'a';
    423  1.1  christos 	return ( LETTER );
    424  1.1  christos     }
    425  1.1  christos     if( isdigit( c )) {
    426  1.1  christos 	yylval = c - '0';
    427  1.1  christos 	return ( DIGIT );
    428  1.1  christos     }
    429  1.1  christos     return( c );
    430  1.1  christos }
    431  1.3  christos #line 430 "prefix.tab.c"
    432  1.1  christos 
    433  1.1  christos /* For use in generated program */
    434  1.1  christos #define yydepth (int)(yystack.s_mark - yystack.s_base)
    435  1.1  christos #if YYBTYACC
    436  1.1  christos #define yytrial (yyps->save)
    437  1.1  christos #endif /* YYBTYACC */
    438  1.1  christos 
    439  1.1  christos #if YYDEBUG
    440  1.1  christos #include <stdio.h>	/* needed for printf */
    441  1.1  christos #endif
    442  1.1  christos 
    443  1.1  christos #include <stdlib.h>	/* needed for malloc, etc */
    444  1.1  christos #include <string.h>	/* needed for memset */
    445  1.1  christos 
    446  1.1  christos /* allocate initial stack or double stack size, up to YYMAXDEPTH */
    447  1.1  christos static int yygrowstack(YYSTACKDATA *data)
    448  1.1  christos {
    449  1.1  christos     int i;
    450  1.1  christos     unsigned newsize;
    451  1.1  christos     YYINT *newss;
    452  1.1  christos     YYSTYPE *newvs;
    453  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
    454  1.1  christos     YYLTYPE *newps;
    455  1.1  christos #endif
    456  1.1  christos 
    457  1.1  christos     if ((newsize = data->stacksize) == 0)
    458  1.1  christos         newsize = YYINITSTACKSIZE;
    459  1.1  christos     else if (newsize >= YYMAXDEPTH)
    460  1.1  christos         return YYENOMEM;
    461  1.1  christos     else if ((newsize *= 2) > YYMAXDEPTH)
    462  1.1  christos         newsize = YYMAXDEPTH;
    463  1.1  christos 
    464  1.1  christos     i = (int) (data->s_mark - data->s_base);
    465  1.1  christos     newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
    466  1.3  christos     if (newss == NULL)
    467  1.1  christos         return YYENOMEM;
    468  1.1  christos 
    469  1.1  christos     data->s_base = newss;
    470  1.1  christos     data->s_mark = newss + i;
    471  1.1  christos 
    472  1.1  christos     newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
    473  1.3  christos     if (newvs == NULL)
    474  1.1  christos         return YYENOMEM;
    475  1.1  christos 
    476  1.1  christos     data->l_base = newvs;
    477  1.1  christos     data->l_mark = newvs + i;
    478  1.1  christos 
    479  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
    480  1.1  christos     newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
    481  1.3  christos     if (newps == NULL)
    482  1.1  christos         return YYENOMEM;
    483  1.1  christos 
    484  1.1  christos     data->p_base = newps;
    485  1.1  christos     data->p_mark = newps + i;
    486  1.1  christos #endif
    487  1.1  christos 
    488  1.1  christos     data->stacksize = newsize;
    489  1.1  christos     data->s_last = data->s_base + newsize - 1;
    490  1.1  christos 
    491  1.1  christos #if YYDEBUG
    492  1.1  christos     if (yydebug)
    493  1.1  christos         fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
    494  1.1  christos #endif
    495  1.1  christos     return 0;
    496  1.1  christos }
    497  1.1  christos 
    498  1.1  christos #if YYPURE || defined(YY_NO_LEAKS)
    499  1.1  christos static void yyfreestack(YYSTACKDATA *data)
    500  1.1  christos {
    501  1.1  christos     free(data->s_base);
    502  1.1  christos     free(data->l_base);
    503  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
    504  1.1  christos     free(data->p_base);
    505  1.1  christos #endif
    506  1.1  christos     memset(data, 0, sizeof(*data));
    507  1.1  christos }
    508  1.1  christos #else
    509  1.1  christos #define yyfreestack(data) /* nothing */
    510  1.1  christos #endif /* YYPURE || defined(YY_NO_LEAKS) */
    511  1.1  christos #if YYBTYACC
    512  1.1  christos 
    513  1.1  christos static YYParseState *
    514  1.1  christos yyNewState(unsigned size)
    515  1.1  christos {
    516  1.1  christos     YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
    517  1.1  christos     if (p == NULL) return NULL;
    518  1.1  christos 
    519  1.1  christos     p->yystack.stacksize = size;
    520  1.1  christos     if (size == 0)
    521  1.1  christos     {
    522  1.1  christos         p->yystack.s_base = NULL;
    523  1.1  christos         p->yystack.l_base = NULL;
    524  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
    525  1.1  christos         p->yystack.p_base = NULL;
    526  1.1  christos #endif
    527  1.1  christos         return p;
    528  1.1  christos     }
    529  1.1  christos     p->yystack.s_base    = (YYINT *) malloc(size * sizeof(YYINT));
    530  1.1  christos     if (p->yystack.s_base == NULL) return NULL;
    531  1.1  christos     p->yystack.l_base    = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
    532  1.1  christos     if (p->yystack.l_base == NULL) return NULL;
    533  1.1  christos     memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
    534  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
    535  1.1  christos     p->yystack.p_base    = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
    536  1.1  christos     if (p->yystack.p_base == NULL) return NULL;
    537  1.1  christos     memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
    538  1.1  christos #endif
    539  1.1  christos 
    540  1.1  christos     return p;
    541  1.1  christos }
    542  1.1  christos 
    543  1.1  christos static void
    544  1.1  christos yyFreeState(YYParseState *p)
    545  1.1  christos {
    546  1.1  christos     yyfreestack(&p->yystack);
    547  1.1  christos     free(p);
    548  1.1  christos }
    549  1.1  christos #endif /* YYBTYACC */
    550  1.1  christos 
    551  1.1  christos #define YYABORT  goto yyabort
    552  1.1  christos #define YYREJECT goto yyabort
    553  1.1  christos #define YYACCEPT goto yyaccept
    554  1.1  christos #define YYERROR  goto yyerrlab
    555  1.1  christos #if YYBTYACC
    556  1.1  christos #define YYVALID        do { if (yyps->save)            goto yyvalid; } while(0)
    557  1.1  christos #define YYVALID_NESTED do { if (yyps->save && \
    558  1.1  christos                                 yyps->save->save == 0) goto yyvalid; } while(0)
    559  1.1  christos #endif /* YYBTYACC */
    560  1.1  christos 
    561  1.1  christos int
    562  1.1  christos YYPARSE_DECL()
    563  1.1  christos {
    564  1.1  christos     int yym, yyn, yystate, yyresult;
    565  1.1  christos #if YYBTYACC
    566  1.1  christos     int yynewerrflag;
    567  1.1  christos     YYParseState *yyerrctx = NULL;
    568  1.1  christos #endif /* YYBTYACC */
    569  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
    570  1.1  christos     YYLTYPE  yyerror_loc_range[3]; /* position of error start/end (0 unused) */
    571  1.1  christos #endif
    572  1.1  christos #if YYDEBUG
    573  1.1  christos     const char *yys;
    574  1.1  christos 
    575  1.3  christos     if ((yys = getenv("YYDEBUG")) != NULL)
    576  1.1  christos     {
    577  1.1  christos         yyn = *yys;
    578  1.1  christos         if (yyn >= '0' && yyn <= '9')
    579  1.1  christos             yydebug = yyn - '0';
    580  1.1  christos     }
    581  1.1  christos     if (yydebug)
    582  1.1  christos         fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
    583  1.1  christos #endif
    584  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
    585  1.1  christos     memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
    586  1.1  christos #endif
    587  1.1  christos 
    588  1.1  christos #if YYBTYACC
    589  1.3  christos     yyps = yyNewState(0); if (yyps == NULL) goto yyenomem;
    590  1.3  christos     yyps->save = NULL;
    591  1.1  christos #endif /* YYBTYACC */
    592  1.1  christos     yym = 0;
    593  1.2  christos     /* yyn is set below */
    594  1.1  christos     yynerrs = 0;
    595  1.1  christos     yyerrflag = 0;
    596  1.1  christos     yychar = YYEMPTY;
    597  1.1  christos     yystate = 0;
    598  1.1  christos 
    599  1.1  christos #if YYPURE
    600  1.1  christos     memset(&yystack, 0, sizeof(yystack));
    601  1.1  christos #endif
    602  1.1  christos 
    603  1.1  christos     if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
    604  1.1  christos     yystack.s_mark = yystack.s_base;
    605  1.1  christos     yystack.l_mark = yystack.l_base;
    606  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
    607  1.1  christos     yystack.p_mark = yystack.p_base;
    608  1.1  christos #endif
    609  1.1  christos     yystate = 0;
    610  1.1  christos     *yystack.s_mark = 0;
    611  1.1  christos 
    612  1.1  christos yyloop:
    613  1.1  christos     if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
    614  1.1  christos     if (yychar < 0)
    615  1.1  christos     {
    616  1.1  christos #if YYBTYACC
    617  1.1  christos         do {
    618  1.1  christos         if (yylvp < yylve)
    619  1.1  christos         {
    620  1.1  christos             /* we're currently re-reading tokens */
    621  1.1  christos             yylval = *yylvp++;
    622  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
    623  1.1  christos             yylloc = *yylpp++;
    624  1.1  christos #endif
    625  1.1  christos             yychar = *yylexp++;
    626  1.1  christos             break;
    627  1.1  christos         }
    628  1.1  christos         if (yyps->save)
    629  1.1  christos         {
    630  1.1  christos             /* in trial mode; save scanner results for future parse attempts */
    631  1.1  christos             if (yylvp == yylvlim)
    632  1.1  christos             {   /* Enlarge lexical value queue */
    633  1.1  christos                 size_t p = (size_t) (yylvp - yylvals);
    634  1.1  christos                 size_t s = (size_t) (yylvlim - yylvals);
    635  1.1  christos 
    636  1.1  christos                 s += YYLVQUEUEGROWTH;
    637  1.1  christos                 if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
    638  1.1  christos                 if ((yylvals   = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
    639  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
    640  1.1  christos                 if ((yylpsns   = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
    641  1.1  christos #endif
    642  1.1  christos                 yylvp   = yylve = yylvals + p;
    643  1.1  christos                 yylvlim = yylvals + s;
    644  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
    645  1.1  christos                 yylpp   = yylpe = yylpsns + p;
    646  1.1  christos                 yylplim = yylpsns + s;
    647  1.1  christos #endif
    648  1.1  christos                 yylexp  = yylexemes + p;
    649  1.1  christos             }
    650  1.1  christos             *yylexp = (YYINT) YYLEX;
    651  1.1  christos             *yylvp++ = yylval;
    652  1.1  christos             yylve++;
    653  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
    654  1.1  christos             *yylpp++ = yylloc;
    655  1.1  christos             yylpe++;
    656  1.1  christos #endif
    657  1.1  christos             yychar = *yylexp++;
    658  1.1  christos             break;
    659  1.1  christos         }
    660  1.1  christos         /* normal operation, no conflict encountered */
    661  1.1  christos #endif /* YYBTYACC */
    662  1.1  christos         yychar = YYLEX;
    663  1.1  christos #if YYBTYACC
    664  1.1  christos         } while (0);
    665  1.1  christos #endif /* YYBTYACC */
    666  1.1  christos         if (yychar < 0) yychar = YYEOF;
    667  1.1  christos #if YYDEBUG
    668  1.1  christos         if (yydebug)
    669  1.1  christos         {
    670  1.1  christos             if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
    671  1.1  christos             fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
    672  1.1  christos                             YYDEBUGSTR, yydepth, yystate, yychar, yys);
    673  1.1  christos #ifdef YYSTYPE_TOSTRING
    674  1.1  christos #if YYBTYACC
    675  1.1  christos             if (!yytrial)
    676  1.1  christos #endif /* YYBTYACC */
    677  1.1  christos                 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
    678  1.1  christos #endif
    679  1.1  christos             fputc('\n', stderr);
    680  1.1  christos         }
    681  1.1  christos #endif
    682  1.1  christos     }
    683  1.1  christos #if YYBTYACC
    684  1.1  christos 
    685  1.1  christos     /* Do we have a conflict? */
    686  1.1  christos     if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
    687  1.1  christos         yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
    688  1.1  christos     {
    689  1.1  christos         YYINT ctry;
    690  1.1  christos 
    691  1.1  christos         if (yypath)
    692  1.1  christos         {
    693  1.1  christos             YYParseState *save;
    694  1.1  christos #if YYDEBUG
    695  1.1  christos             if (yydebug)
    696  1.1  christos                 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
    697  1.1  christos                                 YYDEBUGSTR, yydepth, yystate);
    698  1.1  christos #endif
    699  1.1  christos             /* Switch to the next conflict context */
    700  1.1  christos             save = yypath;
    701  1.1  christos             yypath = save->save;
    702  1.1  christos             save->save = NULL;
    703  1.1  christos             ctry = save->ctry;
    704  1.1  christos             if (save->state != yystate) YYABORT;
    705  1.1  christos             yyFreeState(save);
    706  1.1  christos 
    707  1.1  christos         }
    708  1.1  christos         else
    709  1.1  christos         {
    710  1.1  christos 
    711  1.1  christos             /* Unresolved conflict - start/continue trial parse */
    712  1.1  christos             YYParseState *save;
    713  1.1  christos #if YYDEBUG
    714  1.1  christos             if (yydebug)
    715  1.1  christos             {
    716  1.1  christos                 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
    717  1.1  christos                 if (yyps->save)
    718  1.1  christos                     fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
    719  1.1  christos                 else
    720  1.1  christos                     fputs("Starting trial parse.\n", stderr);
    721  1.1  christos             }
    722  1.1  christos #endif
    723  1.1  christos             save                  = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
    724  1.1  christos             if (save == NULL) goto yyenomem;
    725  1.1  christos             save->save            = yyps->save;
    726  1.1  christos             save->state           = yystate;
    727  1.1  christos             save->errflag         = yyerrflag;
    728  1.1  christos             save->yystack.s_mark  = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
    729  1.1  christos             memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
    730  1.1  christos             save->yystack.l_mark  = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
    731  1.1  christos             memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
    732  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
    733  1.1  christos             save->yystack.p_mark  = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
    734  1.1  christos             memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
    735  1.1  christos #endif
    736  1.1  christos             ctry                  = yytable[yyn];
    737  1.1  christos             if (yyctable[ctry] == -1)
    738  1.1  christos             {
    739  1.1  christos #if YYDEBUG
    740  1.1  christos                 if (yydebug && yychar >= YYEOF)
    741  1.1  christos                     fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
    742  1.1  christos #endif
    743  1.1  christos                 ctry++;
    744  1.1  christos             }
    745  1.1  christos             save->ctry = ctry;
    746  1.1  christos             if (yyps->save == NULL)
    747  1.1  christos             {
    748  1.1  christos                 /* If this is a first conflict in the stack, start saving lexemes */
    749  1.1  christos                 if (!yylexemes)
    750  1.1  christos                 {
    751  1.1  christos                     yylexemes = (YYINT *) malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
    752  1.1  christos                     if (yylexemes == NULL) goto yyenomem;
    753  1.1  christos                     yylvals   = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
    754  1.1  christos                     if (yylvals == NULL) goto yyenomem;
    755  1.1  christos                     yylvlim   = yylvals + YYLVQUEUEGROWTH;
    756  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
    757  1.1  christos                     yylpsns   = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
    758  1.1  christos                     if (yylpsns == NULL) goto yyenomem;
    759  1.1  christos                     yylplim   = yylpsns + YYLVQUEUEGROWTH;
    760  1.1  christos #endif
    761  1.1  christos                 }
    762  1.1  christos                 if (yylvp == yylve)
    763  1.1  christos                 {
    764  1.1  christos                     yylvp  = yylve = yylvals;
    765  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
    766  1.1  christos                     yylpp  = yylpe = yylpsns;
    767  1.1  christos #endif
    768  1.1  christos                     yylexp = yylexemes;
    769  1.1  christos                     if (yychar >= YYEOF)
    770  1.1  christos                     {
    771  1.1  christos                         *yylve++ = yylval;
    772  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
    773  1.1  christos                         *yylpe++ = yylloc;
    774  1.1  christos #endif
    775  1.1  christos                         *yylexp  = (YYINT) yychar;
    776  1.1  christos                         yychar   = YYEMPTY;
    777  1.1  christos                     }
    778  1.1  christos                 }
    779  1.1  christos             }
    780  1.1  christos             if (yychar >= YYEOF)
    781  1.1  christos             {
    782  1.1  christos                 yylvp--;
    783  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
    784  1.1  christos                 yylpp--;
    785  1.1  christos #endif
    786  1.1  christos                 yylexp--;
    787  1.1  christos                 yychar = YYEMPTY;
    788  1.1  christos             }
    789  1.1  christos             save->lexeme = (int) (yylvp - yylvals);
    790  1.1  christos             yyps->save   = save;
    791  1.1  christos         }
    792  1.1  christos         if (yytable[yyn] == ctry)
    793  1.1  christos         {
    794  1.1  christos #if YYDEBUG
    795  1.1  christos             if (yydebug)
    796  1.1  christos                 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
    797  1.1  christos                                 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
    798  1.1  christos #endif
    799  1.1  christos             if (yychar < 0)
    800  1.1  christos             {
    801  1.1  christos                 yylvp++;
    802  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
    803  1.1  christos                 yylpp++;
    804  1.1  christos #endif
    805  1.1  christos                 yylexp++;
    806  1.1  christos             }
    807  1.1  christos             if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
    808  1.1  christos                 goto yyoverflow;
    809  1.1  christos             yystate = yyctable[ctry];
    810  1.1  christos             *++yystack.s_mark = (YYINT) yystate;
    811  1.1  christos             *++yystack.l_mark = yylval;
    812  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
    813  1.1  christos             *++yystack.p_mark = yylloc;
    814  1.1  christos #endif
    815  1.1  christos             yychar  = YYEMPTY;
    816  1.1  christos             if (yyerrflag > 0) --yyerrflag;
    817  1.1  christos             goto yyloop;
    818  1.1  christos         }
    819  1.1  christos         else
    820  1.1  christos         {
    821  1.1  christos             yyn = yyctable[ctry];
    822  1.1  christos             goto yyreduce;
    823  1.1  christos         }
    824  1.1  christos     } /* End of code dealing with conflicts */
    825  1.1  christos #endif /* YYBTYACC */
    826  1.1  christos     if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
    827  1.1  christos             yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
    828  1.1  christos     {
    829  1.1  christos #if YYDEBUG
    830  1.1  christos         if (yydebug)
    831  1.1  christos             fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
    832  1.1  christos                             YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
    833  1.1  christos #endif
    834  1.1  christos         if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
    835  1.1  christos         yystate = yytable[yyn];
    836  1.1  christos         *++yystack.s_mark = yytable[yyn];
    837  1.1  christos         *++yystack.l_mark = yylval;
    838  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
    839  1.1  christos         *++yystack.p_mark = yylloc;
    840  1.1  christos #endif
    841  1.1  christos         yychar = YYEMPTY;
    842  1.1  christos         if (yyerrflag > 0)  --yyerrflag;
    843  1.1  christos         goto yyloop;
    844  1.1  christos     }
    845  1.1  christos     if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
    846  1.1  christos             yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
    847  1.1  christos     {
    848  1.1  christos         yyn = yytable[yyn];
    849  1.1  christos         goto yyreduce;
    850  1.1  christos     }
    851  1.1  christos     if (yyerrflag != 0) goto yyinrecovery;
    852  1.1  christos #if YYBTYACC
    853  1.1  christos 
    854  1.1  christos     yynewerrflag = 1;
    855  1.1  christos     goto yyerrhandler;
    856  1.1  christos     goto yyerrlab; /* redundant goto avoids 'unused label' warning */
    857  1.1  christos 
    858  1.1  christos yyerrlab:
    859  1.1  christos     /* explicit YYERROR from an action -- pop the rhs of the rule reduced
    860  1.1  christos      * before looking for error recovery */
    861  1.1  christos     yystack.s_mark -= yym;
    862  1.1  christos     yystate = *yystack.s_mark;
    863  1.1  christos     yystack.l_mark -= yym;
    864  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
    865  1.1  christos     yystack.p_mark -= yym;
    866  1.1  christos #endif
    867  1.1  christos 
    868  1.1  christos     yynewerrflag = 0;
    869  1.1  christos yyerrhandler:
    870  1.1  christos     while (yyps->save)
    871  1.1  christos     {
    872  1.1  christos         int ctry;
    873  1.1  christos         YYParseState *save = yyps->save;
    874  1.1  christos #if YYDEBUG
    875  1.1  christos         if (yydebug)
    876  1.1  christos             fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
    877  1.1  christos                             YYDEBUGSTR, yydepth, yystate, yyps->save->state,
    878  1.1  christos                     (int)(yylvp - yylvals - yyps->save->lexeme));
    879  1.1  christos #endif
    880  1.1  christos         /* Memorize most forward-looking error state in case it's really an error. */
    881  1.1  christos         if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
    882  1.1  christos         {
    883  1.1  christos             /* Free old saved error context state */
    884  1.1  christos             if (yyerrctx) yyFreeState(yyerrctx);
    885  1.1  christos             /* Create and fill out new saved error context state */
    886  1.1  christos             yyerrctx                 = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
    887  1.1  christos             if (yyerrctx == NULL) goto yyenomem;
    888  1.1  christos             yyerrctx->save           = yyps->save;
    889  1.1  christos             yyerrctx->state          = yystate;
    890  1.1  christos             yyerrctx->errflag        = yyerrflag;
    891  1.1  christos             yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
    892  1.1  christos             memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
    893  1.1  christos             yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
    894  1.1  christos             memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
    895  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
    896  1.1  christos             yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
    897  1.1  christos             memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
    898  1.1  christos #endif
    899  1.1  christos             yyerrctx->lexeme         = (int) (yylvp - yylvals);
    900  1.1  christos         }
    901  1.1  christos         yylvp          = yylvals   + save->lexeme;
    902  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
    903  1.1  christos         yylpp          = yylpsns   + save->lexeme;
    904  1.1  christos #endif
    905  1.1  christos         yylexp         = yylexemes + save->lexeme;
    906  1.1  christos         yychar         = YYEMPTY;
    907  1.1  christos         yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
    908  1.1  christos         memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
    909  1.1  christos         yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
    910  1.1  christos         memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
    911  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
    912  1.1  christos         yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
    913  1.1  christos         memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
    914  1.1  christos #endif
    915  1.1  christos         ctry           = ++save->ctry;
    916  1.1  christos         yystate        = save->state;
    917  1.1  christos         /* We tried shift, try reduce now */
    918  1.1  christos         if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
    919  1.1  christos         yyps->save     = save->save;
    920  1.1  christos         save->save     = NULL;
    921  1.1  christos         yyFreeState(save);
    922  1.1  christos 
    923  1.1  christos         /* Nothing left on the stack -- error */
    924  1.1  christos         if (!yyps->save)
    925  1.1  christos         {
    926  1.1  christos #if YYDEBUG
    927  1.1  christos             if (yydebug)
    928  1.1  christos                 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
    929  1.1  christos                                 YYPREFIX, yydepth);
    930  1.1  christos #endif
    931  1.1  christos             /* Restore state as it was in the most forward-advanced error */
    932  1.1  christos             yylvp          = yylvals   + yyerrctx->lexeme;
    933  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
    934  1.1  christos             yylpp          = yylpsns   + yyerrctx->lexeme;
    935  1.1  christos #endif
    936  1.1  christos             yylexp         = yylexemes + yyerrctx->lexeme;
    937  1.1  christos             yychar         = yylexp[-1];
    938  1.1  christos             yylval         = yylvp[-1];
    939  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
    940  1.1  christos             yylloc         = yylpp[-1];
    941  1.1  christos #endif
    942  1.1  christos             yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
    943  1.1  christos             memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
    944  1.1  christos             yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
    945  1.1  christos             memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
    946  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
    947  1.1  christos             yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
    948  1.1  christos             memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
    949  1.1  christos #endif
    950  1.1  christos             yystate        = yyerrctx->state;
    951  1.1  christos             yyFreeState(yyerrctx);
    952  1.1  christos             yyerrctx       = NULL;
    953  1.1  christos         }
    954  1.1  christos         yynewerrflag = 1;
    955  1.1  christos     }
    956  1.1  christos     if (yynewerrflag == 0) goto yyinrecovery;
    957  1.1  christos #endif /* YYBTYACC */
    958  1.1  christos 
    959  1.1  christos     YYERROR_CALL("syntax error");
    960  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
    961  1.1  christos     yyerror_loc_range[1] = yylloc; /* lookahead position is error start position */
    962  1.1  christos #endif
    963  1.1  christos 
    964  1.1  christos #if !YYBTYACC
    965  1.1  christos     goto yyerrlab; /* redundant goto avoids 'unused label' warning */
    966  1.1  christos yyerrlab:
    967  1.1  christos #endif
    968  1.1  christos     ++yynerrs;
    969  1.1  christos 
    970  1.1  christos yyinrecovery:
    971  1.1  christos     if (yyerrflag < 3)
    972  1.1  christos     {
    973  1.1  christos         yyerrflag = 3;
    974  1.1  christos         for (;;)
    975  1.1  christos         {
    976  1.1  christos             if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
    977  1.1  christos                     yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
    978  1.1  christos             {
    979  1.1  christos #if YYDEBUG
    980  1.1  christos                 if (yydebug)
    981  1.1  christos                     fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
    982  1.1  christos                                     YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
    983  1.1  christos #endif
    984  1.1  christos                 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
    985  1.1  christos                 yystate = yytable[yyn];
    986  1.1  christos                 *++yystack.s_mark = yytable[yyn];
    987  1.1  christos                 *++yystack.l_mark = yylval;
    988  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
    989  1.1  christos                 /* lookahead position is error end position */
    990  1.1  christos                 yyerror_loc_range[2] = yylloc;
    991  1.1  christos                 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
    992  1.1  christos                 *++yystack.p_mark = yyloc;
    993  1.1  christos #endif
    994  1.1  christos                 goto yyloop;
    995  1.1  christos             }
    996  1.1  christos             else
    997  1.1  christos             {
    998  1.1  christos #if YYDEBUG
    999  1.1  christos                 if (yydebug)
   1000  1.1  christos                     fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
   1001  1.1  christos                                     YYDEBUGSTR, yydepth, *yystack.s_mark);
   1002  1.1  christos #endif
   1003  1.1  christos                 if (yystack.s_mark <= yystack.s_base) goto yyabort;
   1004  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
   1005  1.1  christos                 /* the current TOS position is the error start position */
   1006  1.1  christos                 yyerror_loc_range[1] = *yystack.p_mark;
   1007  1.1  christos #endif
   1008  1.1  christos #if defined(YYDESTRUCT_CALL)
   1009  1.1  christos #if YYBTYACC
   1010  1.1  christos                 if (!yytrial)
   1011  1.1  christos #endif /* YYBTYACC */
   1012  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
   1013  1.1  christos                     YYDESTRUCT_CALL("error: discarding state",
   1014  1.1  christos                                     yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
   1015  1.1  christos #else
   1016  1.1  christos                     YYDESTRUCT_CALL("error: discarding state",
   1017  1.1  christos                                     yystos[*yystack.s_mark], yystack.l_mark);
   1018  1.1  christos #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
   1019  1.1  christos #endif /* defined(YYDESTRUCT_CALL) */
   1020  1.1  christos                 --yystack.s_mark;
   1021  1.1  christos                 --yystack.l_mark;
   1022  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
   1023  1.1  christos                 --yystack.p_mark;
   1024  1.1  christos #endif
   1025  1.1  christos             }
   1026  1.1  christos         }
   1027  1.1  christos     }
   1028  1.1  christos     else
   1029  1.1  christos     {
   1030  1.1  christos         if (yychar == YYEOF) goto yyabort;
   1031  1.1  christos #if YYDEBUG
   1032  1.1  christos         if (yydebug)
   1033  1.1  christos         {
   1034  1.1  christos             if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
   1035  1.1  christos             fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
   1036  1.1  christos                             YYDEBUGSTR, yydepth, yystate, yychar, yys);
   1037  1.1  christos         }
   1038  1.1  christos #endif
   1039  1.1  christos #if defined(YYDESTRUCT_CALL)
   1040  1.1  christos #if YYBTYACC
   1041  1.1  christos         if (!yytrial)
   1042  1.1  christos #endif /* YYBTYACC */
   1043  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
   1044  1.1  christos             YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
   1045  1.1  christos #else
   1046  1.1  christos             YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
   1047  1.1  christos #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
   1048  1.1  christos #endif /* defined(YYDESTRUCT_CALL) */
   1049  1.1  christos         yychar = YYEMPTY;
   1050  1.1  christos         goto yyloop;
   1051  1.1  christos     }
   1052  1.1  christos 
   1053  1.1  christos yyreduce:
   1054  1.1  christos     yym = yylen[yyn];
   1055  1.1  christos #if YYDEBUG
   1056  1.1  christos     if (yydebug)
   1057  1.1  christos     {
   1058  1.1  christos         fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
   1059  1.1  christos                         YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
   1060  1.1  christos #ifdef YYSTYPE_TOSTRING
   1061  1.1  christos #if YYBTYACC
   1062  1.1  christos         if (!yytrial)
   1063  1.1  christos #endif /* YYBTYACC */
   1064  1.1  christos             if (yym > 0)
   1065  1.1  christos             {
   1066  1.1  christos                 int i;
   1067  1.1  christos                 fputc('<', stderr);
   1068  1.1  christos                 for (i = yym; i > 0; i--)
   1069  1.1  christos                 {
   1070  1.1  christos                     if (i != yym) fputs(", ", stderr);
   1071  1.1  christos                     fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
   1072  1.1  christos                                            yystack.l_mark[1-i]), stderr);
   1073  1.1  christos                 }
   1074  1.1  christos                 fputc('>', stderr);
   1075  1.1  christos             }
   1076  1.1  christos #endif
   1077  1.1  christos         fputc('\n', stderr);
   1078  1.1  christos     }
   1079  1.1  christos #endif
   1080  1.1  christos     if (yym > 0)
   1081  1.1  christos         yyval = yystack.l_mark[1-yym];
   1082  1.1  christos     else
   1083  1.1  christos         memset(&yyval, 0, sizeof yyval);
   1084  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
   1085  1.1  christos 
   1086  1.1  christos     /* Perform position reduction */
   1087  1.1  christos     memset(&yyloc, 0, sizeof(yyloc));
   1088  1.1  christos #if YYBTYACC
   1089  1.1  christos     if (!yytrial)
   1090  1.1  christos #endif /* YYBTYACC */
   1091  1.1  christos     {
   1092  1.1  christos         YYLLOC_DEFAULT(yyloc, &yystack.p_mark[-yym], yym);
   1093  1.1  christos         /* just in case YYERROR is invoked within the action, save
   1094  1.1  christos            the start of the rhs as the error start position */
   1095  1.1  christos         yyerror_loc_range[1] = yystack.p_mark[1-yym];
   1096  1.1  christos     }
   1097  1.1  christos #endif
   1098  1.1  christos 
   1099  1.1  christos     switch (yyn)
   1100  1.1  christos     {
   1101  1.1  christos case 3:
   1102  1.1  christos #line 28 "calc.y"
   1103  1.1  christos 	{  yyerrok ; }
   1104  1.3  christos #line 1103 "prefix.tab.c"
   1105  1.1  christos break;
   1106  1.1  christos case 4:
   1107  1.1  christos #line 32 "calc.y"
   1108  1.1  christos 	{  printf("%d\n",yystack.l_mark[0]);}
   1109  1.3  christos #line 1108 "prefix.tab.c"
   1110  1.1  christos break;
   1111  1.1  christos case 5:
   1112  1.1  christos #line 34 "calc.y"
   1113  1.1  christos 	{  regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
   1114  1.3  christos #line 1113 "prefix.tab.c"
   1115  1.1  christos break;
   1116  1.1  christos case 6:
   1117  1.1  christos #line 38 "calc.y"
   1118  1.1  christos 	{  yyval = yystack.l_mark[-1]; }
   1119  1.3  christos #line 1118 "prefix.tab.c"
   1120  1.1  christos break;
   1121  1.1  christos case 7:
   1122  1.1  christos #line 40 "calc.y"
   1123  1.1  christos 	{  yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
   1124  1.3  christos #line 1123 "prefix.tab.c"
   1125  1.1  christos break;
   1126  1.1  christos case 8:
   1127  1.1  christos #line 42 "calc.y"
   1128  1.1  christos 	{  yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
   1129  1.3  christos #line 1128 "prefix.tab.c"
   1130  1.1  christos break;
   1131  1.1  christos case 9:
   1132  1.1  christos #line 44 "calc.y"
   1133  1.1  christos 	{  yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
   1134  1.3  christos #line 1133 "prefix.tab.c"
   1135  1.1  christos break;
   1136  1.1  christos case 10:
   1137  1.1  christos #line 46 "calc.y"
   1138  1.1  christos 	{  yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
   1139  1.3  christos #line 1138 "prefix.tab.c"
   1140  1.1  christos break;
   1141  1.1  christos case 11:
   1142  1.1  christos #line 48 "calc.y"
   1143  1.1  christos 	{  yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
   1144  1.3  christos #line 1143 "prefix.tab.c"
   1145  1.1  christos break;
   1146  1.1  christos case 12:
   1147  1.1  christos #line 50 "calc.y"
   1148  1.1  christos 	{  yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
   1149  1.3  christos #line 1148 "prefix.tab.c"
   1150  1.1  christos break;
   1151  1.1  christos case 13:
   1152  1.1  christos #line 52 "calc.y"
   1153  1.1  christos 	{  yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
   1154  1.3  christos #line 1153 "prefix.tab.c"
   1155  1.1  christos break;
   1156  1.1  christos case 14:
   1157  1.1  christos #line 54 "calc.y"
   1158  1.1  christos 	{  yyval = - yystack.l_mark[0]; }
   1159  1.3  christos #line 1158 "prefix.tab.c"
   1160  1.1  christos break;
   1161  1.1  christos case 15:
   1162  1.1  christos #line 56 "calc.y"
   1163  1.1  christos 	{  yyval = regs[yystack.l_mark[0]]; }
   1164  1.3  christos #line 1163 "prefix.tab.c"
   1165  1.1  christos break;
   1166  1.1  christos case 17:
   1167  1.1  christos #line 61 "calc.y"
   1168  1.1  christos 	{  yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; }
   1169  1.3  christos #line 1168 "prefix.tab.c"
   1170  1.1  christos break;
   1171  1.1  christos case 18:
   1172  1.1  christos #line 63 "calc.y"
   1173  1.1  christos 	{  yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
   1174  1.3  christos #line 1173 "prefix.tab.c"
   1175  1.1  christos break;
   1176  1.3  christos #line 1175 "prefix.tab.c"
   1177  1.1  christos     default:
   1178  1.1  christos         break;
   1179  1.1  christos     }
   1180  1.1  christos     yystack.s_mark -= yym;
   1181  1.1  christos     yystate = *yystack.s_mark;
   1182  1.1  christos     yystack.l_mark -= yym;
   1183  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
   1184  1.1  christos     yystack.p_mark -= yym;
   1185  1.1  christos #endif
   1186  1.1  christos     yym = yylhs[yyn];
   1187  1.1  christos     if (yystate == 0 && yym == 0)
   1188  1.1  christos     {
   1189  1.1  christos #if YYDEBUG
   1190  1.1  christos         if (yydebug)
   1191  1.1  christos         {
   1192  1.1  christos             fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
   1193  1.1  christos #ifdef YYSTYPE_TOSTRING
   1194  1.1  christos #if YYBTYACC
   1195  1.1  christos             if (!yytrial)
   1196  1.1  christos #endif /* YYBTYACC */
   1197  1.1  christos                 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
   1198  1.1  christos #endif
   1199  1.1  christos             fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
   1200  1.1  christos         }
   1201  1.1  christos #endif
   1202  1.1  christos         yystate = YYFINAL;
   1203  1.1  christos         *++yystack.s_mark = YYFINAL;
   1204  1.1  christos         *++yystack.l_mark = yyval;
   1205  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
   1206  1.1  christos         *++yystack.p_mark = yyloc;
   1207  1.1  christos #endif
   1208  1.1  christos         if (yychar < 0)
   1209  1.1  christos         {
   1210  1.1  christos #if YYBTYACC
   1211  1.1  christos             do {
   1212  1.1  christos             if (yylvp < yylve)
   1213  1.1  christos             {
   1214  1.1  christos                 /* we're currently re-reading tokens */
   1215  1.1  christos                 yylval = *yylvp++;
   1216  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
   1217  1.1  christos                 yylloc = *yylpp++;
   1218  1.1  christos #endif
   1219  1.1  christos                 yychar = *yylexp++;
   1220  1.1  christos                 break;
   1221  1.1  christos             }
   1222  1.1  christos             if (yyps->save)
   1223  1.1  christos             {
   1224  1.1  christos                 /* in trial mode; save scanner results for future parse attempts */
   1225  1.1  christos                 if (yylvp == yylvlim)
   1226  1.1  christos                 {   /* Enlarge lexical value queue */
   1227  1.1  christos                     size_t p = (size_t) (yylvp - yylvals);
   1228  1.1  christos                     size_t s = (size_t) (yylvlim - yylvals);
   1229  1.1  christos 
   1230  1.1  christos                     s += YYLVQUEUEGROWTH;
   1231  1.1  christos                     if ((yylexemes = (YYINT *)realloc(yylexemes, s * sizeof(YYINT))) == NULL)
   1232  1.1  christos                         goto yyenomem;
   1233  1.1  christos                     if ((yylvals   = (YYSTYPE *)realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
   1234  1.1  christos                         goto yyenomem;
   1235  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
   1236  1.1  christos                     if ((yylpsns   = (YYLTYPE *)realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
   1237  1.1  christos                         goto yyenomem;
   1238  1.1  christos #endif
   1239  1.1  christos                     yylvp   = yylve = yylvals + p;
   1240  1.1  christos                     yylvlim = yylvals + s;
   1241  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
   1242  1.1  christos                     yylpp   = yylpe = yylpsns + p;
   1243  1.1  christos                     yylplim = yylpsns + s;
   1244  1.1  christos #endif
   1245  1.1  christos                     yylexp  = yylexemes + p;
   1246  1.1  christos                 }
   1247  1.1  christos                 *yylexp = (YYINT) YYLEX;
   1248  1.1  christos                 *yylvp++ = yylval;
   1249  1.1  christos                 yylve++;
   1250  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
   1251  1.1  christos                 *yylpp++ = yylloc;
   1252  1.1  christos                 yylpe++;
   1253  1.1  christos #endif
   1254  1.1  christos                 yychar = *yylexp++;
   1255  1.1  christos                 break;
   1256  1.1  christos             }
   1257  1.1  christos             /* normal operation, no conflict encountered */
   1258  1.1  christos #endif /* YYBTYACC */
   1259  1.1  christos             yychar = YYLEX;
   1260  1.1  christos #if YYBTYACC
   1261  1.1  christos             } while (0);
   1262  1.1  christos #endif /* YYBTYACC */
   1263  1.1  christos             if (yychar < 0) yychar = YYEOF;
   1264  1.1  christos #if YYDEBUG
   1265  1.1  christos             if (yydebug)
   1266  1.1  christos             {
   1267  1.1  christos                 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
   1268  1.1  christos                 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
   1269  1.1  christos                                 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
   1270  1.1  christos             }
   1271  1.1  christos #endif
   1272  1.1  christos         }
   1273  1.1  christos         if (yychar == YYEOF) goto yyaccept;
   1274  1.1  christos         goto yyloop;
   1275  1.1  christos     }
   1276  1.1  christos     if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
   1277  1.1  christos             yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
   1278  1.1  christos         yystate = yytable[yyn];
   1279  1.1  christos     else
   1280  1.1  christos         yystate = yydgoto[yym];
   1281  1.1  christos #if YYDEBUG
   1282  1.1  christos     if (yydebug)
   1283  1.1  christos     {
   1284  1.1  christos         fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
   1285  1.1  christos #ifdef YYSTYPE_TOSTRING
   1286  1.1  christos #if YYBTYACC
   1287  1.1  christos         if (!yytrial)
   1288  1.1  christos #endif /* YYBTYACC */
   1289  1.1  christos             fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
   1290  1.1  christos #endif
   1291  1.1  christos         fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
   1292  1.1  christos     }
   1293  1.1  christos #endif
   1294  1.1  christos     if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
   1295  1.1  christos     *++yystack.s_mark = (YYINT) yystate;
   1296  1.1  christos     *++yystack.l_mark = yyval;
   1297  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
   1298  1.1  christos     *++yystack.p_mark = yyloc;
   1299  1.1  christos #endif
   1300  1.1  christos     goto yyloop;
   1301  1.1  christos #if YYBTYACC
   1302  1.1  christos 
   1303  1.1  christos     /* Reduction declares that this path is valid. Set yypath and do a full parse */
   1304  1.1  christos yyvalid:
   1305  1.1  christos     if (yypath) YYABORT;
   1306  1.1  christos     while (yyps->save)
   1307  1.1  christos     {
   1308  1.1  christos         YYParseState *save = yyps->save;
   1309  1.1  christos         yyps->save = save->save;
   1310  1.1  christos         save->save = yypath;
   1311  1.1  christos         yypath = save;
   1312  1.1  christos     }
   1313  1.1  christos #if YYDEBUG
   1314  1.1  christos     if (yydebug)
   1315  1.1  christos         fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
   1316  1.1  christos                         YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
   1317  1.1  christos #endif
   1318  1.1  christos     if (yyerrctx)
   1319  1.1  christos     {
   1320  1.1  christos         yyFreeState(yyerrctx);
   1321  1.1  christos         yyerrctx = NULL;
   1322  1.1  christos     }
   1323  1.1  christos     yylvp          = yylvals + yypath->lexeme;
   1324  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
   1325  1.1  christos     yylpp          = yylpsns + yypath->lexeme;
   1326  1.1  christos #endif
   1327  1.1  christos     yylexp         = yylexemes + yypath->lexeme;
   1328  1.1  christos     yychar         = YYEMPTY;
   1329  1.1  christos     yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
   1330  1.1  christos     memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
   1331  1.1  christos     yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
   1332  1.1  christos     memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
   1333  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
   1334  1.1  christos     yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
   1335  1.1  christos     memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
   1336  1.1  christos #endif
   1337  1.1  christos     yystate        = yypath->state;
   1338  1.1  christos     goto yyloop;
   1339  1.1  christos #endif /* YYBTYACC */
   1340  1.1  christos 
   1341  1.1  christos yyoverflow:
   1342  1.1  christos     YYERROR_CALL("yacc stack overflow");
   1343  1.1  christos #if YYBTYACC
   1344  1.1  christos     goto yyabort_nomem;
   1345  1.1  christos yyenomem:
   1346  1.1  christos     YYERROR_CALL("memory exhausted");
   1347  1.1  christos yyabort_nomem:
   1348  1.1  christos #endif /* YYBTYACC */
   1349  1.1  christos     yyresult = 2;
   1350  1.1  christos     goto yyreturn;
   1351  1.1  christos 
   1352  1.1  christos yyabort:
   1353  1.1  christos     yyresult = 1;
   1354  1.1  christos     goto yyreturn;
   1355  1.1  christos 
   1356  1.1  christos yyaccept:
   1357  1.1  christos #if YYBTYACC
   1358  1.1  christos     if (yyps->save) goto yyvalid;
   1359  1.1  christos #endif /* YYBTYACC */
   1360  1.1  christos     yyresult = 0;
   1361  1.1  christos 
   1362  1.1  christos yyreturn:
   1363  1.1  christos #if defined(YYDESTRUCT_CALL)
   1364  1.1  christos     if (yychar != YYEOF && yychar != YYEMPTY)
   1365  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
   1366  1.1  christos         YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
   1367  1.1  christos #else
   1368  1.1  christos         YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
   1369  1.1  christos #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
   1370  1.1  christos 
   1371  1.1  christos     {
   1372  1.1  christos         YYSTYPE *pv;
   1373  1.1  christos #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
   1374  1.1  christos         YYLTYPE *pp;
   1375  1.1  christos 
   1376  1.1  christos         for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
   1377  1.1  christos              YYDESTRUCT_CALL("cleanup: discarding state",
   1378  1.1  christos                              yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
   1379  1.1  christos #else
   1380  1.1  christos         for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
   1381  1.1  christos              YYDESTRUCT_CALL("cleanup: discarding state",
   1382  1.1  christos                              yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
   1383  1.1  christos #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
   1384  1.1  christos     }
   1385  1.1  christos #endif /* defined(YYDESTRUCT_CALL) */
   1386  1.1  christos 
   1387  1.1  christos #if YYBTYACC
   1388  1.1  christos     if (yyerrctx)
   1389  1.1  christos     {
   1390  1.1  christos         yyFreeState(yyerrctx);
   1391  1.1  christos         yyerrctx = NULL;
   1392  1.1  christos     }
   1393  1.1  christos     while (yyps)
   1394  1.1  christos     {
   1395  1.1  christos         YYParseState *save = yyps;
   1396  1.1  christos         yyps = save->save;
   1397  1.1  christos         save->save = NULL;
   1398  1.1  christos         yyFreeState(save);
   1399  1.1  christos     }
   1400  1.1  christos     while (yypath)
   1401  1.1  christos     {
   1402  1.1  christos         YYParseState *save = yypath;
   1403  1.1  christos         yypath = save->save;
   1404  1.1  christos         save->save = NULL;
   1405  1.1  christos         yyFreeState(save);
   1406  1.1  christos     }
   1407  1.1  christos #endif /* YYBTYACC */
   1408  1.1  christos     yyfreestack(&yystack);
   1409  1.1  christos     return (yyresult);
   1410  1.1  christos }
   1411