parser.c
gurba-0.40/src/comp/parser.c · 85.8 KB
From the archive gurba.tgz
Download the archive « Back to the archive contents
#ifndef lint
static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
#endif
#define YYBYACC 1
#define YYMAJOR 1
#define YYMINOR 9
#define yyclearin (yychar=(-1))
#define yyerrok (yyerrflag=0)
#define YYRECOVERING (yyerrflag!=0)
#define YYPREFIX "yy"
#line 8 "parser.y"
# define INCLUDE_CTYPE
# include "comp.h"
# include "str.h"
# include "array.h"
# include "object.h"
# include "xfloat.h"
# include "interpret.h"
# include "macro.h"
# include "token.h"
# include "ppcontrol.h"
# include "node.h"
# include "compile.h"
# define yylex pp_gettok
# define yyerror c_error
int nerrors; /* number of errors encountered so far */
static int ndeclarations; /* number of declarations */
static int nstatements; /* number of statements in current function */
static bool typechecking; /* does the current function have it? */
static void t_void P((node*));
static bool t_unary P((node*, char*));
static node *uassign P((int, node*, char*));
static node *cast P((node*, unsigned int));
static node *idx P((node*, node*));
static node *range P((node*, node*, node*));
static node *bini P((int, node*, node*, char*));
static node *bina P((int, node*, node*, char*));
static node *mult P((int, node*, node*, char*));
static node *mdiv P((int, node*, node*, char*));
static node *mod P((int, node*, node*, char*));
static node *add P((int, node*, node*, char*));
static node *sub P((int, node*, node*, char*));
static node *umin P((node*));
static node *lshift P((int, node*, node*, char*));
static node *rshift P((int, node*, node*, char*));
static node *rel P((int, node*, node*, char*));
static node *eq P((node*, node*));
static node *and P((int, node*, node*, char*));
static node *xor P((int, node*, node*, char*));
static node *or P((int, node*, node*, char*));
static node *land P((node*, node*));
static node *lor P((node*, node*));
static node *quest P((node*, node*, node*));
static node *assign P((node*, node*));
static node *comma P((node*, node*));
#line 74 "parser.y"
typedef union {
Int number; /* lex input */
xfloat real; /* lex input */
unsigned short type; /* internal */
struct _node_ *node; /* internal */
} YYSTYPE;
#line 69 "y.tab.c"
#define STRING 257
#define NOMASK 258
#define DO 259
#define BREAK 260
#define ELSE 261
#define CASE 262
#define OBJECT 263
#define DEFAULT 264
#define STATIC 265
#define CONTINUE 266
#define INT 267
#define RLIMITS 268
#define FLOAT 269
#define FOR 270
#define INHERIT 271
#define WHILE 272
#define IF 273
#define CATCH 274
#define SWITCH 275
#define MAPPING 276
#define PRIVATE 277
#define VOID 278
#define ATOMIC 279
#define RETURN 280
#define MIXED 281
#define VARARGS 282
#define ARROW 283
#define PLUS_PLUS 284
#define MIN_MIN 285
#define LSHIFT 286
#define RSHIFT 287
#define LE 288
#define GE 289
#define EQ 290
#define NE 291
#define LAND 292
#define LOR 293
#define PLUS_EQ 294
#define MIN_EQ 295
#define MULT_EQ 296
#define DIV_EQ 297
#define MOD_EQ 298
#define LSHIFT_EQ 299
#define RSHIFT_EQ 300
#define AND_EQ 301
#define XOR_EQ 302
#define OR_EQ 303
#define COLON_COLON 304
#define DOT_DOT 305
#define ELLIPSIS 306
#define STRING_CONST 307
#define IDENTIFIER 308
#define INT_CONST 309
#define FLOAT_CONST 310
#define MARK 311
#define HASH 312
#define HASH_HASH 313
#define INCL_CONST 314
#define NR_TOKENS 315
#define YYERRCODE 256
short yylhs[] = { -1,
50, 0, 49, 49, 51, 51, 51, 5, 5, 48,
7, 7, 7, 6, 52, 54, 53, 55, 53, 56,
8, 8, 8, 8, 9, 9, 10, 10, 1, 1,
2, 2, 2, 2, 2, 3, 3, 3, 3, 3,
3, 3, 4, 4, 11, 12, 13, 13, 14, 14,
15, 15, 16, 16, 16, 17, 17, 17, 17, 57,
17, 58, 17, 59, 17, 60, 17, 61, 62, 17,
63, 17, 64, 17, 65, 17, 66, 17, 17, 17,
17, 17, 67, 18, 19, 19, 20, 20, 20, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 22,
22, 22, 23, 23, 23, 24, 24, 24, 24, 24,
24, 24, 25, 25, 26, 26, 26, 26, 27, 27,
27, 28, 28, 28, 29, 29, 29, 29, 29, 30,
30, 30, 31, 31, 32, 32, 33, 33, 34, 34,
35, 35, 36, 36, 37, 37, 37, 37, 37, 37,
37, 37, 37, 37, 37, 37, 38, 38, 39, 39,
40, 41, 42, 42, 43, 43, 43, 44, 44, 44,
45, 46, 46, 47, 47, 47,
};
short yylen[] = { 2,
0, 2, 0, 2, 4, 1, 1, 0, 1, 1,
1, 3, 3, 1, 4, 0, 5, 0, 7, 4,
0, 1, 1, 2, 1, 3, 2, 1, 0, 2,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 0, 2, 2, 5, 1, 1, 1, 3,
0, 2, 1, 1, 2, 2, 1, 5, 7, 0,
8, 0, 6, 0, 10, 0, 8, 0, 0, 5,
0, 6, 0, 5, 0, 7, 0, 4, 2, 2,
3, 1, 0, 4, 0, 2, 1, 2, 3, 1,
1, 1, 5, 5, 1, 3, 4, 4, 6, 1,
4, 6, 1, 2, 2, 1, 2, 2, 2, 2,
2, 2, 1, 5, 1, 3, 3, 3, 1, 3,
3, 1, 3, 3, 1, 3, 3, 3, 3, 1,
3, 3, 1, 3, 1, 3, 1, 3, 1, 3,
1, 3, 1, 5, 1, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 1, 3, 0, 1,
1, 1, 1, 3, 0, 1, 2, 0, 1, 2,
3, 1, 3, 0, 1, 2,
};
short yydefred[] = { 1,
0, 3, 0, 0, 0, 4, 6, 7, 10, 0,
9, 38, 34, 39, 32, 36, 37, 40, 31, 42,
33, 41, 35, 30, 43, 0, 14, 0, 11, 0,
0, 47, 0, 49, 0, 0, 0, 5, 0, 44,
0, 0, 15, 43, 0, 43, 0, 0, 25, 28,
13, 12, 0, 83, 17, 48, 50, 0, 27, 18,
24, 0, 0, 51, 45, 0, 26, 46, 0, 19,
0, 60, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 90, 91, 82, 0,
0, 84, 0, 0, 0, 0, 92, 52, 54, 57,
0, 100, 0, 0, 113, 115, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 157, 0, 0,
53, 55, 0, 79, 0, 0, 77, 80, 0, 0,
0, 0, 0, 0, 0, 0, 162, 0, 107, 108,
88, 110, 0, 0, 43, 0, 109, 111, 112, 43,
0, 0, 0, 104, 105, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 56, 0, 0, 0, 0,
73, 0, 0, 0, 0, 0, 0, 0, 69, 0,
81, 163, 0, 0, 0, 172, 0, 0, 0, 96,
0, 0, 0, 0, 0, 0, 0, 116, 117, 118,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 147, 148, 149, 150,
151, 152, 153, 154, 155, 156, 146, 158, 89, 0,
0, 0, 78, 0, 0, 62, 0, 98, 0, 71,
0, 0, 0, 0, 0, 0, 20, 167, 0, 97,
0, 101, 0, 0, 0, 75, 74, 0, 0, 0,
0, 0, 70, 0, 164, 93, 171, 173, 94, 114,
0, 0, 144, 0, 0, 66, 0, 63, 0, 86,
72, 99, 102, 0, 76, 0, 0, 59, 61, 67,
64, 0, 65,
};
short yydgoto[] = { 1,
5, 24, 46, 31, 10, 97, 30, 47, 48, 49,
32, 56, 34, 35, 69, 98, 99, 100, 283, 101,
102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
112, 113, 114, 115, 116, 117, 118, 119, 137, 194,
138, 212, 213, 204, 206, 207, 208, 120, 3, 2,
6, 7, 8, 42, 66, 121, 123, 280, 312, 306,
134, 259, 284, 252, 295, 192, 64,
};
short yysindex[] = { 0,
0, 0, -241, -231, 892, 0, 0, 0, 0, -40,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 42, 0, -40, 0, 6,
-33, 0, 0, 0, -9, -132, -18, 0, -223, 0,
50, -31, 0, 0, 0, 0, 54, -41, 0, 0,
0, 0, -132, 0, 0, 0, 0, -33, 0, 0,
0, 160, 60, 0, 0, -31, 0, 0, -23, 0,
48, 0, 52, 163, 55, 61, 82, 87, 92, 94,
102, 105, 163, 163, 163, -231, 0, 0, 0, 163,
343, 0, 163, 163, 163, 1291, 0, 0, 0, 0,
115, 0, -76, -179, 0, 0, -21, 25, -168, 2,
-167, 119, 64, 41, -130, -61, 374, 0, 10, -138,
0, 0, 146, 0, 102, -51, 0, 0, 163, 163,
163, 163, 163, -31, 163, 124, 0, 110, 0, 0,
0, 0, 163, 163, 0, -17, 0, 0, 0, 0,
163, -231, 163, 0, 0, 163, 163, 163, 163, 163,
163, 163, 163, 163, 163, 163, 163, 163, 163, 163,
163, 163, 163, 163, 163, 163, 163, 163, 163, 163,
163, 163, 163, 163, 163, 0, 163, -231, -101, 163,
0, 146, 124, 113, 114, 133, 139, 19, 0, 144,
0, 0, 143, 63, 132, 0, 148, 100, 99, 0,
13, -32, 153, 155, 124, 104, -106, 0, 0, 0,
-21, -21, 25, 25, -168, -168, -168, -168, 2, 2,
-167, 119, 64, 41, -130, 17, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 161,
151, 146, 0, 163, 163, 0, 146, 0, 154, 0,
163, 173, 163, 163, 174, 163, 0, 0, 163, 0,
163, 0, 163, 163, 163, 0, 0, 180, 145, 146,
-59, 146, 0, -31, 0, 0, 0, 0, 0, 0,
181, 130, 0, 184, 146, 0, 163, 0, 146, 0,
0, 0, 0, 167, 0, -31, 186, 0, 0, 0,
0, 146, 0,
};
short yyrindex[] = { 0,
0, 0, 1, -34, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, -15, 0, 0, 187, 0, 0, 0, 0,
15, 0, 0, 0, -37, 0, 0, 193, 0, 0,
0, 0, 187, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1622, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
117, 0, 179, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 464, 505, 0, 0, 532, 840, 945, 35,
1359, 1451, 1735, 1772, 574, 1404, -13, 0, 0, 437,
0, 0, 0, 0, 0, 0, 0, 0, 0, 179,
0, 0, 0, 0, 0, -27, 0, 0, 0, 0,
0, 0, 121, 149, 0, 0, 0, 0, 0, 0,
203, 0, -57, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, -1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 131, 0, 0, 0, 162, 0, 0, 0,
0, 219, 0, 0, -85, 0, 0, 0, 0, 0,
620, 803, 891, 917, 986, 1023, 1289, 1315, 1343, 1383,
1428, 1472, 1751, 1788, 1809, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 179, 0, 0, 0, 38, 0,
138, 0, 0, 183, 0, 0, 0, 0, 0, 0,
203, 0, 195, 0, 0, 0, 0, 0, 0, 0,
93, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 280, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0,
};
short yygindex[] = { 0,
255, 0, 8, -28, 0, 28, 311, 290, 0, 282,
308, 339, 335, 230, 0, 0, -82, 101, 0, 0,
0, 0, 0, 0, -42, -12, -11, 18, -14, 212,
214, 211, 215, 216, 0, 116, 511, -44, -119, -98,
-134, 248, 122, 0, 128, 0, 0, 935, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
};
#define YYTABLESIZE 2115
short yytable[] = { 28,
2, 174, 62, 22, 42, 8, 191, 161, 40, 94,
195, 269, 25, 160, 153, 158, 91, 58, 217, 90,
156, 93, 51, 210, 39, 157, 187, 145, 48, 4,
145, 160, 196, 197, 44, 89, 200, 29, 136, 161,
189, 139, 140, 48, 145, 145, 146, 142, 39, 43,
147, 148, 149, 187, 216, 29, 44, 161, 45, 258,
187, 165, 187, 166, 38, 160, 52, 159, 186, 160,
85, 267, 130, 45, 274, 130, 9, 85, 130, 145,
85, 36, 85, 27, 193, 136, 193, 193, 198, 53,
193, 54, 130, 130, 60, 130, 85, 130, 145, 54,
68, 92, 95, 150, 154, 155, 122, 16, 215, 253,
124, 145, 127, 218, 219, 220, 209, 161, 162, 128,
279, 129, 167, 168, 12, 58, 130, 130, 130, 236,
14, 131, 58, 132, 16, 58, 17, 58, 292, 266,
40, 133, 55, 18, 135, 45, 221, 222, 22, 223,
224, 58, 229, 230, 151, 278, 169, 170, 130, 130,
85, 172, 85, 85, 171, 188, 70, 187, 201, 277,
250, 254, 255, 256, 281, 9, 294, 307, 94, 257,
225, 226, 227, 228, 260, 91, 261, 262, 90, 263,
93, 264, 265, 270, 271, 94, 272, 298, 273, 300,
275, 299, 91, 297, 89, 90, 152, 93, 276, 193,
136, 282, 305, 286, 289, 58, 308, 58, 58, 160,
296, 302, 303, 290, 304, 309, 311, 21, 136, 313,
193, 173, 71, 23, 199, 72, 73, 159, 74, 68,
75, 174, 76, 165, 77, 168, 78, 159, 79, 80,
81, 82, 136, 190, 175, 169, 83, 29, 29, 166,
84, 85, 170, 29, 61, 29, 27, 29, 54, 29,
42, 95, 8, 268, 9, 176, 29, 29, 29, 29,
86, 29, 29, 27, 9, 87, 88, 159, 95, 163,
164, 145, 145, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85, 85, 85, 29, 85,
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
159, 85, 85, 96, 130, 130, 130, 130, 130, 130,
130, 130, 130, 130, 130, 130, 130, 130, 37, 130,
130, 85, 63, 67, 85, 85, 85, 85, 58, 58,
58, 58, 58, 59, 58, 58, 58, 58, 58, 58,
58, 58, 58, 33, 58, 58, 58, 58, 58, 58,
58, 58, 58, 58, 58, 94, 58, 58, 57, 211,
231, 233, 91, 232, 301, 90, 234, 93, 235, 293,
203, 288, 291, 0, 0, 0, 58, 0, 0, 58,
58, 58, 58, 0, 72, 73, 310, 74, 0, 75,
0, 76, 0, 77, 0, 78, 12, 79, 80, 81,
82, 0, 14, 0, 0, 83, 16, 0, 17, 84,
85, 0, 0, 144, 185, 18, 125, 20, 0, 0,
22, 0, 0, 0, 0, 0, 84, 85, 0, 86,
0, 0, 27, 9, 87, 88, 0, 0, 0, 0,
0, 0, 0, 0, 0, 143, 86, 9, 95, 27,
9, 87, 88, 95, 95, 0, 87, 95, 95, 95,
95, 95, 0, 95, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 95, 95, 95, 95, 95, 95,
103, 103, 0, 0, 103, 103, 103, 103, 103, 0,
103, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 103, 103, 103, 103, 103, 103, 95, 0, 95,
95, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 106, 106, 0, 0, 106, 106, 106, 106, 106,
0, 106, 0, 0, 0, 0, 103, 103, 0, 0,
95, 95, 106, 106, 106, 106, 106, 106, 0, 119,
0, 0, 119, 0, 119, 119, 119, 0, 0, 0,
0, 0, 0, 0, 126, 0, 0, 103, 103, 119,
119, 119, 119, 119, 119, 0, 0, 106, 106, 12,
0, 0, 0, 0, 0, 14, 0, 0, 0, 16,
0, 17, 0, 0, 141, 0, 125, 141, 18, 0,
20, 0, 0, 22, 119, 119, 84, 85, 106, 106,
0, 141, 141, 0, 141, 0, 141, 0, 0, 0,
0, 0, 0, 0, 0, 0, 86, 0, 0, 27,
9, 87, 88, 202, 205, 119, 119, 120, 0, 0,
120, 202, 120, 120, 120, 0, 141, 175, 176, 177,
178, 179, 180, 181, 182, 183, 184, 120, 120, 120,
120, 120, 120, 0, 0, 237, 238, 239, 240, 241,
242, 243, 244, 245, 246, 247, 0, 248, 141, 0,
251, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 120, 120, 0, 0, 0, 0, 0, 95,
95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
0, 95, 95, 120, 120, 0, 0, 103, 103, 103,
103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
103, 103, 103, 103, 103, 103, 103, 0, 103, 103,
0, 285, 0, 287, 205, 0, 0, 0, 0, 285,
0, 202, 0, 0, 0, 0, 0, 0, 0, 0,
106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
106, 106, 106, 106, 106, 106, 106, 106, 0, 106,
106, 0, 0, 0, 0, 0, 0, 119, 119, 119,
119, 119, 119, 119, 119, 119, 119, 119, 119, 119,
119, 119, 119, 119, 119, 0, 119, 119, 0, 0,
121, 0, 0, 121, 0, 121, 121, 121, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
121, 121, 121, 121, 121, 121, 141, 141, 141, 141,
141, 141, 141, 141, 141, 141, 141, 122, 141, 141,
122, 0, 0, 122, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 121, 121, 122, 122, 122,
122, 122, 122, 0, 0, 120, 120, 120, 120, 120,
120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
120, 120, 120, 0, 120, 120, 121, 121, 123, 0,
0, 123, 122, 122, 123, 0, 0, 0, 11, 26,
0, 0, 0, 0, 0, 0, 0, 0, 123, 123,
123, 123, 123, 123, 124, 0, 0, 124, 0, 0,
124, 0, 0, 122, 122, 41, 0, 0, 0, 0,
50, 0, 0, 0, 124, 124, 124, 124, 124, 124,
0, 0, 125, 123, 123, 125, 0, 50, 125, 0,
0, 0, 65, 0, 0, 0, 50, 0, 0, 0,
0, 0, 125, 125, 125, 125, 125, 125, 0, 124,
124, 0, 0, 0, 123, 123, 0, 0, 0, 0,
141, 0, 0, 128, 0, 0, 128, 0, 0, 128,
0, 0, 0, 0, 0, 0, 0, 125, 125, 0,
124, 124, 0, 128, 128, 128, 128, 128, 128, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
129, 0, 0, 129, 0, 0, 129, 0, 125, 125,
0, 0, 0, 0, 0, 0, 0, 0, 128, 128,
129, 129, 129, 129, 129, 129, 214, 0, 121, 121,
121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
121, 121, 121, 121, 121, 121, 0, 121, 121, 128,
128, 0, 0, 0, 0, 129, 129, 0, 0, 0,
0, 0, 249, 0, 0, 122, 122, 122, 122, 122,
122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
122, 122, 122, 0, 122, 122, 129, 129, 12, 13,
0, 0, 0, 0, 14, 0, 15, 0, 16, 0,
17, 0, 0, 0, 0, 0, 0, 18, 19, 20,
21, 0, 22, 23, 0, 0, 123, 123, 123, 123,
123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
123, 123, 123, 123, 0, 123, 123, 0, 0, 9,
0, 0, 124, 124, 124, 124, 124, 124, 124, 124,
124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
0, 124, 124, 0, 0, 0, 0, 0, 0, 0,
0, 0, 125, 125, 125, 125, 125, 125, 125, 125,
125, 125, 125, 125, 125, 125, 125, 125, 0, 125,
125, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 0,
128, 128, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
129, 129, 129, 129, 129, 129, 129, 129, 129, 129,
129, 129, 129, 129, 129, 129, 126, 129, 129, 126,
0, 0, 126, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 126, 126, 126, 126,
126, 126, 127, 0, 0, 127, 0, 0, 127, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 127, 127, 127, 127, 127, 127, 0, 0,
131, 126, 126, 131, 0, 0, 131, 0, 0, 0,
0, 0, 0, 0, 0, 0, 133, 0, 0, 133,
131, 131, 133, 131, 0, 131, 0, 127, 127, 0,
0, 0, 126, 126, 0, 0, 133, 133, 0, 133,
132, 133, 0, 132, 0, 0, 132, 0, 0, 0,
0, 0, 0, 0, 0, 131, 131, 0, 127, 127,
132, 132, 0, 132, 143, 132, 0, 143, 0, 0,
0, 133, 133, 0, 0, 0, 0, 0, 0, 0,
0, 143, 143, 0, 143, 134, 131, 131, 134, 0,
0, 134, 0, 0, 0, 132, 132, 0, 0, 0,
0, 0, 133, 133, 0, 134, 134, 0, 134, 0,
134, 135, 0, 0, 135, 0, 143, 0, 0, 0,
0, 0, 0, 0, 0, 0, 132, 132, 135, 135,
0, 135, 136, 135, 0, 136, 0, 0, 0, 0,
134, 134, 0, 0, 0, 0, 0, 0, 143, 136,
136, 0, 136, 0, 136, 0, 0, 0, 0, 0,
0, 0, 0, 135, 135, 0, 0, 12, 13, 0,
0, 134, 134, 14, 0, 15, 0, 16, 0, 17,
0, 0, 0, 0, 136, 136, 18, 19, 20, 21,
0, 22, 23, 0, 135, 135, 126, 126, 126, 126,
126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
126, 126, 0, 126, 126, 136, 136, 0, 0, 0,
0, 0, 127, 127, 127, 127, 127, 127, 127, 127,
127, 127, 127, 127, 127, 127, 127, 127, 0, 127,
127, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 131, 131, 131, 131, 131, 131, 131, 131,
131, 131, 131, 131, 131, 131, 0, 131, 131, 0,
133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
133, 133, 0, 133, 133, 0, 0, 0, 0, 0,
0, 0, 132, 132, 132, 132, 132, 132, 132, 132,
132, 132, 132, 132, 132, 132, 0, 132, 132, 0,
0, 0, 0, 0, 0, 0, 0, 143, 143, 143,
143, 143, 143, 143, 143, 143, 143, 0, 143, 143,
0, 0, 0, 0, 0, 0, 0, 0, 0, 134,
134, 134, 134, 134, 134, 134, 134, 134, 134, 134,
134, 0, 134, 134, 0, 0, 0, 0, 0, 0,
0, 0, 135, 135, 135, 135, 135, 135, 135, 135,
135, 135, 135, 135, 0, 135, 135, 0, 0, 0,
0, 0, 0, 136, 136, 136, 136, 136, 136, 136,
136, 136, 136, 136, 136, 137, 136, 136, 137, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 138, 137, 137, 138, 137, 0, 137, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 138, 138,
0, 138, 139, 138, 0, 139, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 137, 140, 139,
139, 140, 139, 0, 139, 0, 0, 0, 0, 0,
0, 0, 0, 138, 0, 140, 140, 0, 140, 142,
140, 0, 142, 0, 0, 0, 0, 0, 137, 137,
0, 0, 0, 0, 139, 0, 142, 142, 0, 142,
0, 142, 0, 0, 138, 138, 0, 0, 29, 29,
140, 0, 0, 0, 29, 0, 29, 0, 29, 0,
29, 0, 0, 0, 0, 0, 139, 29, 29, 29,
29, 142, 29, 29, 0, 0, 0, 0, 0, 0,
0, 0, 140, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 142, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 137, 137, 137, 137,
137, 137, 137, 137, 137, 137, 137, 137, 0, 137,
137, 0, 138, 138, 138, 138, 138, 138, 138, 138,
138, 138, 138, 138, 0, 138, 138, 0, 0, 0,
0, 0, 0, 139, 139, 139, 139, 139, 139, 139,
139, 139, 139, 139, 139, 0, 139, 139, 0, 140,
140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
140, 0, 140, 140, 0, 0, 0, 0, 0, 0,
0, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 0, 142, 142,
};
short yycheck[] = { 40,
0, 63, 44, 41, 42, 40, 58, 93, 42, 33,
130, 44, 5, 41, 91, 37, 40, 46, 153, 43,
42, 45, 41, 41, 43, 47, 44, 41, 44, 271,
44, 59, 131, 132, 44, 59, 135, 10, 83, 41,
123, 84, 85, 59, 58, 59, 91, 90, 43, 59,
93, 94, 95, 44, 153, 28, 44, 59, 44, 41,
44, 60, 44, 62, 59, 93, 39, 43, 59, 45,
33, 59, 38, 59, 58, 41, 308, 40, 44, 93,
43, 40, 45, 307, 129, 130, 131, 132, 133, 40,
135, 123, 58, 59, 41, 61, 59, 63, 91, 123,
41, 125, 126, 96, 284, 285, 59, 123, 153, 192,
59, 125, 58, 156, 157, 158, 145, 286, 287, 59,
255, 40, 290, 291, 257, 33, 40, 93, 94, 174,
263, 40, 40, 40, 267, 43, 269, 45, 273, 41,
42, 40, 42, 276, 40, 278, 159, 160, 281, 161,
162, 59, 167, 168, 40, 254, 38, 94, 124, 125,
123, 292, 125, 126, 124, 304, 66, 44, 59, 252,
272, 59, 59, 41, 257, 308, 275, 297, 33, 41,
163, 164, 165, 166, 41, 40, 44, 125, 43, 58,
45, 44, 93, 41, 40, 33, 93, 280, 305, 282,
40, 261, 40, 59, 59, 43, 283, 45, 58, 254,
255, 58, 295, 41, 41, 123, 299, 125, 126, 305,
41, 41, 93, 266, 41, 59, 41, 41, 273, 312,
275, 293, 256, 41, 134, 259, 260, 59, 262, 123,
264, 93, 266, 41, 268, 125, 270, 305, 272, 273,
274, 275, 297, 305, 93, 125, 280, 257, 258, 41,
284, 285, 125, 263, 306, 265, 307, 267, 123, 269,
308, 126, 307, 306, 308, 93, 276, 277, 278, 279,
304, 281, 282, 307, 308, 309, 310, 93, 126, 288,
289, 305, 306, 256, 257, 258, 259, 260, 261, 262,
263, 264, 265, 266, 267, 268, 269, 270, 308, 272,
273, 274, 275, 276, 277, 278, 279, 280, 281, 282,
41, 284, 285, 69, 290, 291, 292, 293, 294, 295,
296, 297, 298, 299, 300, 301, 302, 303, 28, 305,
306, 304, 53, 62, 307, 308, 309, 310, 256, 257,
258, 259, 260, 46, 262, 263, 264, 265, 266, 267,
268, 269, 270, 25, 272, 273, 274, 275, 276, 277,
278, 279, 280, 281, 282, 33, 284, 285, 44, 150,
169, 171, 40, 170, 284, 43, 172, 45, 173, 274,
143, 264, 271, -1, -1, -1, 304, -1, -1, 307,
308, 309, 310, -1, 259, 260, 306, 262, -1, 264,
-1, 266, -1, 268, -1, 270, 257, 272, 273, 274,
275, -1, 263, -1, -1, 280, 267, -1, 269, 284,
285, -1, -1, 91, 61, 276, 274, 278, -1, -1,
281, -1, -1, -1, -1, -1, 284, 285, -1, 304,
-1, -1, 307, 308, 309, 310, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 123, 304, 308, 126, 307,
308, 309, 310, 37, 38, -1, 40, 41, 42, 43,
44, 45, -1, 47, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 58, 59, 60, 61, 62, 63,
37, 38, -1, -1, 41, 42, 43, 44, 45, -1,
47, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 58, 59, 60, 61, 62, 63, 91, -1, 93,
94, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 37, 38, -1, -1, 41, 42, 43, 44, 45,
-1, 47, -1, -1, -1, -1, 93, 94, -1, -1,
124, 125, 58, 59, 60, 61, 62, 63, -1, 38,
-1, -1, 41, -1, 43, 44, 45, -1, -1, -1,
-1, -1, -1, -1, 74, -1, -1, 124, 125, 58,
59, 60, 61, 62, 63, -1, -1, 93, 94, 257,
-1, -1, -1, -1, -1, 263, -1, -1, -1, 267,
-1, 269, -1, -1, 41, -1, 274, 44, 276, -1,
278, -1, -1, 281, 93, 94, 284, 285, 124, 125,
-1, 58, 59, -1, 61, -1, 63, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 304, -1, -1, 307,
308, 309, 310, 143, 144, 124, 125, 38, -1, -1,
41, 151, 43, 44, 45, -1, 93, 294, 295, 296,
297, 298, 299, 300, 301, 302, 303, 58, 59, 60,
61, 62, 63, -1, -1, 175, 176, 177, 178, 179,
180, 181, 182, 183, 184, 185, -1, 187, 125, -1,
190, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 93, 94, -1, -1, -1, -1, -1, 283,
284, 285, 286, 287, 288, 289, 290, 291, 292, 293,
294, 295, 296, 297, 298, 299, 300, 301, 302, 303,
-1, 305, 306, 124, 125, -1, -1, 284, 285, 286,
287, 288, 289, 290, 291, 292, 293, 294, 295, 296,
297, 298, 299, 300, 301, 302, 303, -1, 305, 306,
-1, 261, -1, 263, 264, -1, -1, -1, -1, 269,
-1, 271, -1, -1, -1, -1, -1, -1, -1, -1,
286, 287, 288, 289, 290, 291, 292, 293, 294, 295,
296, 297, 298, 299, 300, 301, 302, 303, -1, 305,
306, -1, -1, -1, -1, -1, -1, 286, 287, 288,
289, 290, 291, 292, 293, 294, 295, 296, 297, 298,
299, 300, 301, 302, 303, -1, 305, 306, -1, -1,
38, -1, -1, 41, -1, 43, 44, 45, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
58, 59, 60, 61, 62, 63, 293, 294, 295, 296,
297, 298, 299, 300, 301, 302, 303, 38, 305, 306,
41, -1, -1, 44, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 93, 94, 58, 59, 60,
61, 62, 63, -1, -1, 286, 287, 288, 289, 290,
291, 292, 293, 294, 295, 296, 297, 298, 299, 300,
301, 302, 303, -1, 305, 306, 124, 125, 38, -1,
-1, 41, 93, 94, 44, -1, -1, -1, 4, 5,
-1, -1, -1, -1, -1, -1, -1, -1, 58, 59,
60, 61, 62, 63, 38, -1, -1, 41, -1, -1,
44, -1, -1, 124, 125, 31, -1, -1, -1, -1,
36, -1, -1, -1, 58, 59, 60, 61, 62, 63,
-1, -1, 38, 93, 94, 41, -1, 53, 44, -1,
-1, -1, 58, -1, -1, -1, 62, -1, -1, -1,
-1, -1, 58, 59, 60, 61, 62, 63, -1, 93,
94, -1, -1, -1, 124, 125, -1, -1, -1, -1,
86, -1, -1, 38, -1, -1, 41, -1, -1, 44,
-1, -1, -1, -1, -1, -1, -1, 93, 94, -1,
124, 125, -1, 58, 59, 60, 61, 62, 63, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
38, -1, -1, 41, -1, -1, 44, -1, 124, 125,
-1, -1, -1, -1, -1, -1, -1, -1, 93, 94,
58, 59, 60, 61, 62, 63, 152, -1, 286, 287,
288, 289, 290, 291, 292, 293, 294, 295, 296, 297,
298, 299, 300, 301, 302, 303, -1, 305, 306, 124,
125, -1, -1, -1, -1, 93, 94, -1, -1, -1,
-1, -1, 188, -1, -1, 286, 287, 288, 289, 290,
291, 292, 293, 294, 295, 296, 297, 298, 299, 300,
301, 302, 303, -1, 305, 306, 124, 125, 257, 258,
-1, -1, -1, -1, 263, -1, 265, -1, 267, -1,
269, -1, -1, -1, -1, -1, -1, 276, 277, 278,
279, -1, 281, 282, -1, -1, 286, 287, 288, 289,
290, 291, 292, 293, 294, 295, 296, 297, 298, 299,
300, 301, 302, 303, -1, 305, 306, -1, -1, 308,
-1, -1, 286, 287, 288, 289, 290, 291, 292, 293,
294, 295, 296, 297, 298, 299, 300, 301, 302, 303,
-1, 305, 306, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 288, 289, 290, 291, 292, 293, 294, 295,
296, 297, 298, 299, 300, 301, 302, 303, -1, 305,
306, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 288, 289, 290, 291, 292, 293, 294,
295, 296, 297, 298, 299, 300, 301, 302, 303, -1,
305, 306, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
288, 289, 290, 291, 292, 293, 294, 295, 296, 297,
298, 299, 300, 301, 302, 303, 38, 305, 306, 41,
-1, -1, 44, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 58, 59, 60, 61,
62, 63, 38, -1, -1, 41, -1, -1, 44, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 58, 59, 60, 61, 62, 63, -1, -1,
38, 93, 94, 41, -1, -1, 44, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 38, -1, -1, 41,
58, 59, 44, 61, -1, 63, -1, 93, 94, -1,
-1, -1, 124, 125, -1, -1, 58, 59, -1, 61,
38, 63, -1, 41, -1, -1, 44, -1, -1, -1,
-1, -1, -1, -1, -1, 93, 94, -1, 124, 125,
58, 59, -1, 61, 41, 63, -1, 44, -1, -1,
-1, 93, 94, -1, -1, -1, -1, -1, -1, -1,
-1, 58, 59, -1, 61, 38, 124, 125, 41, -1,
-1, 44, -1, -1, -1, 93, 94, -1, -1, -1,
-1, -1, 124, 125, -1, 58, 59, -1, 61, -1,
63, 41, -1, -1, 44, -1, 93, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 124, 125, 58, 59,
-1, 61, 41, 63, -1, 44, -1, -1, -1, -1,
93, 94, -1, -1, -1, -1, -1, -1, 125, 58,
59, -1, 61, -1, 63, -1, -1, -1, -1, -1,
-1, -1, -1, 93, 94, -1, -1, 257, 258, -1,
-1, 124, 125, 263, -1, 265, -1, 267, -1, 269,
-1, -1, -1, -1, 93, 94, 276, 277, 278, 279,
-1, 281, 282, -1, 124, 125, 288, 289, 290, 291,
292, 293, 294, 295, 296, 297, 298, 299, 300, 301,
302, 303, -1, 305, 306, 124, 125, -1, -1, -1,
-1, -1, 288, 289, 290, 291, 292, 293, 294, 295,
296, 297, 298, 299, 300, 301, 302, 303, -1, 305,
306, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 290, 291, 292, 293, 294, 295, 296, 297,
298, 299, 300, 301, 302, 303, -1, 305, 306, -1,
292, 293, 294, 295, 296, 297, 298, 299, 300, 301,
302, 303, -1, 305, 306, -1, -1, -1, -1, -1,
-1, -1, 290, 291, 292, 293, 294, 295, 296, 297,
298, 299, 300, 301, 302, 303, -1, 305, 306, -1,
-1, -1, -1, -1, -1, -1, -1, 294, 295, 296,
297, 298, 299, 300, 301, 302, 303, -1, 305, 306,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 292,
293, 294, 295, 296, 297, 298, 299, 300, 301, 302,
303, -1, 305, 306, -1, -1, -1, -1, -1, -1,
-1, -1, 292, 293, 294, 295, 296, 297, 298, 299,
300, 301, 302, 303, -1, 305, 306, -1, -1, -1,
-1, -1, -1, 292, 293, 294, 295, 296, 297, 298,
299, 300, 301, 302, 303, 41, 305, 306, 44, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 41, 58, 59, 44, 61, -1, 63, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, 58, 59,
-1, 61, 41, 63, -1, 44, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 93, 41, 58,
59, 44, 61, -1, 63, -1, -1, -1, -1, -1,
-1, -1, -1, 93, -1, 58, 59, -1, 61, 41,
63, -1, 44, -1, -1, -1, -1, -1, 124, 125,
-1, -1, -1, -1, 93, -1, 58, 59, -1, 61,
-1, 63, -1, -1, 124, 125, -1, -1, 257, 258,
93, -1, -1, -1, 263, -1, 265, -1, 267, -1,
269, -1, -1, -1, -1, -1, 125, 276, 277, 278,
279, 93, 281, 282, -1, -1, -1, -1, -1, -1,
-1, -1, 125, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 125, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 292, 293, 294, 295,
296, 297, 298, 299, 300, 301, 302, 303, -1, 305,
306, -1, 292, 293, 294, 295, 296, 297, 298, 299,
300, 301, 302, 303, -1, 305, 306, -1, -1, -1,
-1, -1, -1, 292, 293, 294, 295, 296, 297, 298,
299, 300, 301, 302, 303, -1, 305, 306, -1, 292,
293, 294, 295, 296, 297, 298, 299, 300, 301, 302,
303, -1, 305, 306, -1, -1, -1, -1, -1, -1,
-1, 293, 294, 295, 296, 297, 298, 299, 300, 301,
302, 303, -1, 305, 306,
};
#define YYFINAL 1
#ifndef YYDEBUG
#define YYDEBUG 0
#endif
#define YYMAXTOKEN 315
#if YYDEBUG
char *yyname[] = {
"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
"'!'",0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'","','","'-'",0,"'/'",0,0,0,0,0,
0,0,0,0,0,"':'","';'","'<'","'='","'>'","'?'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,"'['",0,"']'","'^'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,"'{'","'|'","'}'","'~'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"STRING","NOMASK",
"DO","BREAK","ELSE","CASE","OBJECT","DEFAULT","STATIC","CONTINUE","INT",
"RLIMITS","FLOAT","FOR","INHERIT","WHILE","IF","CATCH","SWITCH","MAPPING",
"PRIVATE","VOID","ATOMIC","RETURN","MIXED","VARARGS","ARROW","PLUS_PLUS",
"MIN_MIN","LSHIFT","RSHIFT","LE","GE","EQ","NE","LAND","LOR","PLUS_EQ","MIN_EQ",
"MULT_EQ","DIV_EQ","MOD_EQ","LSHIFT_EQ","RSHIFT_EQ","AND_EQ","XOR_EQ","OR_EQ",
"COLON_COLON","DOT_DOT","ELLIPSIS","STRING_CONST","IDENTIFIER","INT_CONST",
"FLOAT_CONST","MARK","HASH","HASH_HASH","INCL_CONST","NR_TOKENS",
};
char *yyrule[] = {
"$accept : program",
"$$1 :",
"program : $$1 top_level_declarations",
"top_level_declarations :",
"top_level_declarations : top_level_declarations top_level_declaration",
"top_level_declaration : INHERIT opt_inherit_label inherit_string ';'",
"top_level_declaration : data_declaration",
"top_level_declaration : function_declaration",
"opt_inherit_label :",
"opt_inherit_label : ident",
"ident : IDENTIFIER",
"inherit_string : string",
"inherit_string : inherit_string '+' string",
"inherit_string : '(' inherit_string ')'",
"string : STRING_CONST",
"data_declaration : class_specifier_list type_specifier list_dcltr ';'",
"$$2 :",
"function_declaration : class_specifier_list type_specifier function_dcltr $$2 compound_stmt",
"$$3 :",
"function_declaration : class_specifier_list ident '(' formals_declaration ')' $$3 compound_stmt",
"local_data_declaration : class_specifier_list type_specifier list_dcltr ';'",
"formals_declaration :",
"formals_declaration : VOID",
"formals_declaration : formal_declaration_list",
"formals_declaration : formal_declaration_list ELLIPSIS",
"formal_declaration_list : formal_declaration",
"formal_declaration_list : formal_declaration_list ',' formal_declaration",
"formal_declaration : type_specifier data_dcltr",
"formal_declaration : ident",
"class_specifier_list :",
"class_specifier_list : class_specifier_list class_specifier",
"class_specifier : PRIVATE",
"class_specifier : STATIC",
"class_specifier : ATOMIC",
"class_specifier : NOMASK",
"class_specifier : VARARGS",
"type_specifier : INT",
"type_specifier : FLOAT",
"type_specifier : STRING",
"type_specifier : OBJECT",
"type_specifier : MAPPING",
"type_specifier : MIXED",
"type_specifier : VOID",
"star_list :",
"star_list : star_list '*'",
"data_dcltr : star_list ident",
"function_dcltr : star_list ident '(' formals_declaration ')'",
"dcltr : data_dcltr",
"dcltr : function_dcltr",
"list_dcltr : dcltr",
"list_dcltr : list_dcltr ',' dcltr",
"dcltr_or_stmt_list :",
"dcltr_or_stmt_list : dcltr_or_stmt_list dcltr_or_stmt",
"dcltr_or_stmt : local_data_declaration",
"dcltr_or_stmt : stmt",
"dcltr_or_stmt : error ';'",
"stmt : list_exp ';'",
"stmt : compound_stmt",
"stmt : IF '(' f_list_exp ')' stmt",
"stmt : IF '(' f_list_exp ')' stmt ELSE stmt",
"$$4 :",
"stmt : DO $$4 stmt WHILE '(' f_list_exp ')' ';'",
"$$5 :",
"stmt : WHILE '(' f_list_exp ')' $$5 stmt",
"$$6 :",
"stmt : FOR '(' opt_list_exp ';' f_opt_list_exp ';' opt_list_exp ')' $$6 stmt",
"$$7 :",
"stmt : RLIMITS '(' f_list_exp ';' f_list_exp ')' $$7 compound_stmt",
"$$8 :",
"$$9 :",
"stmt : CATCH $$8 compound_stmt $$9 opt_caught_stmt",
"$$10 :",
"stmt : SWITCH '(' f_list_exp ')' $$10 compound_stmt",
"$$11 :",
"stmt : CASE exp ':' $$11 stmt",
"$$12 :",
"stmt : CASE exp DOT_DOT exp ':' $$12 stmt",
"$$13 :",
"stmt : DEFAULT ':' $$13 stmt",
"stmt : BREAK ';'",
"stmt : CONTINUE ';'",
"stmt : RETURN f_opt_list_exp ';'",
"stmt : ';'",
"$$14 :",
"compound_stmt : '{' $$14 dcltr_or_stmt_list '}'",
"opt_caught_stmt :",
"opt_caught_stmt : ':' stmt",
"function_name : ident",
"function_name : COLON_COLON ident",
"function_name : ident COLON_COLON ident",
"primary_p1_exp : INT_CONST",
"primary_p1_exp : FLOAT_CONST",
"primary_p1_exp : string",
"primary_p1_exp : '(' '{' opt_arg_list_comma '}' ')'",
"primary_p1_exp : '(' '[' opt_assoc_arg_list_comma ']' ')'",
"primary_p1_exp : ident",
"primary_p1_exp : '(' list_exp ')'",
"primary_p1_exp : function_name '(' opt_arg_list ')'",
"primary_p1_exp : CATCH '(' list_exp ')'",
"primary_p1_exp : primary_p2_exp ARROW ident '(' opt_arg_list ')'",
"primary_p2_exp : primary_p1_exp",
"primary_p2_exp : primary_p2_exp '[' f_list_exp ']'",
"primary_p2_exp : primary_p2_exp '[' f_opt_list_exp DOT_DOT f_opt_list_exp ']'",
"postfix_exp : primary_p2_exp",
"postfix_exp : postfix_exp PLUS_PLUS",
"postfix_exp : postfix_exp MIN_MIN",
"prefix_exp : postfix_exp",
"prefix_exp : PLUS_PLUS cast_exp",
"prefix_exp : MIN_MIN cast_exp",
"prefix_exp : '-' cast_exp",
"prefix_exp : '+' cast_exp",
"prefix_exp : '!' cast_exp",
"prefix_exp : '~' cast_exp",
"cast_exp : prefix_exp",
"cast_exp : '(' type_specifier star_list ')' cast_exp",
"mult_oper_exp : cast_exp",
"mult_oper_exp : mult_oper_exp '*' cast_exp",
"mult_oper_exp : mult_oper_exp '/' cast_exp",
"mult_oper_exp : mult_oper_exp '%' cast_exp",
"add_oper_exp : mult_oper_exp",
"add_oper_exp : add_oper_exp '+' mult_oper_exp",
"add_oper_exp : add_oper_exp '-' mult_oper_exp",
"shift_oper_exp : add_oper_exp",
"shift_oper_exp : shift_oper_exp LSHIFT add_oper_exp",
"shift_oper_exp : shift_oper_exp RSHIFT add_oper_exp",
"rel_oper_exp : shift_oper_exp",
"rel_oper_exp : rel_oper_exp '<' shift_oper_exp",
"rel_oper_exp : rel_oper_exp '>' shift_oper_exp",
"rel_oper_exp : rel_oper_exp LE shift_oper_exp",
"rel_oper_exp : rel_oper_exp GE shift_oper_exp",
"equ_oper_exp : rel_oper_exp",
"equ_oper_exp : equ_oper_exp EQ rel_oper_exp",
"equ_oper_exp : equ_oper_exp NE rel_oper_exp",
"bitand_oper_exp : equ_oper_exp",
"bitand_oper_exp : bitand_oper_exp '&' equ_oper_exp",
"bitxor_oper_exp : bitand_oper_exp",
"bitxor_oper_exp : bitxor_oper_exp '^' bitand_oper_exp",
"bitor_oper_exp : bitxor_oper_exp",
"bitor_oper_exp : bitor_oper_exp '|' bitxor_oper_exp",
"and_oper_exp : bitor_oper_exp",
"and_oper_exp : and_oper_exp LAND bitor_oper_exp",
"or_oper_exp : and_oper_exp",
"or_oper_exp : or_oper_exp LOR and_oper_exp",
"cond_exp : or_oper_exp",
"cond_exp : or_oper_exp '?' list_exp ':' cond_exp",
"exp : cond_exp",
"exp : cond_exp '=' exp",
"exp : cond_exp PLUS_EQ exp",
"exp : cond_exp MIN_EQ exp",
"exp : cond_exp MULT_EQ exp",
"exp : cond_exp DIV_EQ exp",
"exp : cond_exp MOD_EQ exp",
"exp : cond_exp LSHIFT_EQ exp",
"exp : cond_exp RSHIFT_EQ exp",
"exp : cond_exp AND_EQ exp",
"exp : cond_exp XOR_EQ exp",
"exp : cond_exp OR_EQ exp",
"list_exp : exp",
"list_exp : list_exp ',' exp",
"opt_list_exp :",
"opt_list_exp : list_exp",
"f_list_exp : list_exp",
"f_opt_list_exp : opt_list_exp",
"arg_list : exp",
"arg_list : arg_list ',' exp",
"opt_arg_list :",
"opt_arg_list : arg_list",
"opt_arg_list : arg_list ELLIPSIS",
"opt_arg_list_comma :",
"opt_arg_list_comma : arg_list",
"opt_arg_list_comma : arg_list ','",
"assoc_exp : exp ':' exp",
"assoc_arg_list : assoc_exp",
"assoc_arg_list : assoc_arg_list ',' assoc_exp",
"opt_assoc_arg_list_comma :",
"opt_assoc_arg_list_comma : assoc_arg_list",
"opt_assoc_arg_list_comma : assoc_arg_list ','",
};
#endif
#ifdef YYSTACKSIZE
#undef YYMAXDEPTH
#define YYMAXDEPTH YYSTACKSIZE
#else
#ifdef YYMAXDEPTH
#define YYSTACKSIZE YYMAXDEPTH
#else
#define YYSTACKSIZE 500
#define YYMAXDEPTH 500
#endif
#endif
int yydebug;
int yynerrs;
int yyerrflag;
int yychar;
short *yyssp;
YYSTYPE *yyvsp;
YYSTYPE yyval;
YYSTYPE yylval;
short yyss[YYSTACKSIZE];
YYSTYPE yyvs[YYSTACKSIZE];
#define yystacksize YYSTACKSIZE
#line 732 "parser.y"
/*
* NAME: t_void()
* DESCRIPTION: if the argument is of type void, an error will result
*/
static void t_void(n)
register node *n;
{
if (n != (node *) NULL && n->mod == T_VOID) {
c_error("void value not ignored");
n->mod = T_MIXED;
}
}
/*
* NAME: t_unary()
* DESCRIPTION: typecheck the argument of a unary operator
*/
static bool t_unary(n, name)
register node *n;
char *name;
{
t_void(n);
if (typechecking && !T_ARITHMETIC(n->mod) && n->mod != T_MIXED) {
c_error("bad argument type for %s (%s)", name, i_typename(n->mod));
n->mod = T_MIXED;
return FALSE;
}
return TRUE;
}
/*
* NAME: uassign()
* DESCRIPTION: handle a unary assignment operator
*/
static node *uassign(op, n, name)
int op;
register node *n;
char *name;
{
t_unary(n, name);
return node_mon((n->mod == T_INT) ? op + 1 : op, n->mod, c_lvalue(n, name));
}
/*
* NAME: cast()
* DESCRIPTION: cast an expression to a type
*/
static node *cast(n, type)
register node *n;
register unsigned int type;
{
xfloat flt;
Int i;
char *p, buffer[18];
if (type != n->mod) {
switch (type) {
case T_INT:
switch (n->type) {
case N_FLOAT:
/* cast float constant to int */
NFLT_GET(n, flt);
return node_int(flt_ftoi(&flt));
case N_STR:
/* cast string to int */
i = strtol(n->l.string->text, &p, 10);
if (p == n->l.string->text + n->l.string->len) {
return node_int(i);
} else {
c_error("cast of invalid string constant");
n->mod = T_MIXED;
}
break;
case N_TOFLOAT:
case N_TOSTRING:
if (n->l.left->type == N_INT) {
/* (int) (float) i, (int) (string) i */
return n->l.left;
}
/* fall through */
default:
if (n->mod == T_FLOAT || n->mod == T_STRING ||
n->mod == T_MIXED) {
return node_mon(N_TOINT, T_INT, n);
}
break;
}
break;
case T_FLOAT:
switch (n->type) {
case N_INT:
/* cast int constant to float */
flt_itof(n->l.number, &flt);
return node_float(&flt);
case N_STR:
/* cast string to float */
p = n->l.string->text;
if (flt_atof(&p, &flt) &&
p == n->l.string->text + n->l.string->len) {
return node_float(&flt);
} else {
yyerror("cast of invalid string constant");
n->mod = T_MIXED;
}
break;
case N_TOSTRING:
if (n->l.left->mod == T_INT) {
return node_mon(N_TOFLOAT, T_FLOAT, n->l.left);
}
/* fall through */
default:
if (n->mod == T_INT || n->mod == T_STRING || n->mod == T_MIXED)
{
return node_mon(N_TOFLOAT, T_FLOAT, n);
}
break;
}
break;
case T_STRING:
switch (n->type) {
case N_INT:
/* cast int constant to string */
sprintf(buffer, "%ld", (long) n->l.number);
return node_str(str_new(buffer, (long) strlen(buffer)));
case N_FLOAT:
/* cast float constant to string */
NFLT_GET(n, flt);
flt_ftoa(&flt, buffer);
return node_str(str_new(buffer, (long) strlen(buffer)));
default:
if (n->mod == T_INT || n->mod == T_FLOAT || n->mod == T_MIXED) {
return node_mon(N_TOSTRING, T_STRING, n);
}
break;
}
break;
}
if ((n->mod & T_TYPE) != T_MIXED) {
c_error("cast of invalid type (%s)", i_typename(n->mod));
} else if ((type & T_TYPE) == T_VOID) {
c_error("cannot cast to %s", i_typename(type));
n->mod = T_MIXED;
} else if ((type & T_REF) < (n->mod & T_REF)) {
c_error("illegal cast of array type (%s)", i_typename(n->mod));
} else if ((type & T_REF) == 0 || (n->mod & T_REF) == 0) {
return node_mon(N_CAST, type, n);
}
}
return n;
}
/*
* NAME: idx()
* DESCRIPTION: handle the [ ] operator
*/
static node *idx(n1, n2)
register node *n1, *n2;
{
register unsigned short type;
if (n1->type == N_STR && n2->type == N_INT) {
/* str [ int ] */
if (n2->l.number < 0 || n2->l.number >= (Int) n1->l.string->len) {
c_error("string index out of range");
} else {
n2->l.number =
UCHAR(n1->l.string->text[str_index(n1->l.string,
(long) n2->l.number)]);
}
return n2;
}
if ((n1->mod & T_REF) != 0) {
/*
* array
*/
if (typechecking) {
type = n1->mod - (1 << REFSHIFT);
if (n2->mod != T_INT && n2->mod != T_MIXED) {
c_error("bad index type (%s)", i_typename(n2->mod));
}
if (type != T_MIXED) {
/* you can't trust these arrays */
return node_mon(N_CAST, type, node_bin(N_INDEX, type, n1, n2));
}
}
type = T_MIXED;
} else if (n1->mod == T_STRING) {
/*
* string
*/
if (typechecking && n2->mod != T_INT && n2->mod != T_MIXED) {
c_error("bad index type (%s)", i_typename(n2->mod));
}
type = T_INT;
} else {
if (typechecking && n1->mod != T_MAPPING && n1->mod != T_MIXED) {
c_error("bad indexed type (%s)", i_typename(n1->mod));
}
type = T_MIXED;
}
return node_bin(N_INDEX, type, n1, n2);
}
/*
* NAME: range()
* DESCRIPTION: handle the [ .. ] operator
*/
static node *range(n1, n2, n3)
register node *n1, *n2, *n3;
{
if (n1->type == N_STR && (n2 == (node *) NULL || n2->type == N_INT) &&
(n3 == (node *) NULL || n3->type == N_INT)) {
Int from, to;
/* str [ int .. int ] */
from = (n2 == (node *) NULL) ? 0 : n2->l.number;
to = (n3 == (node *) NULL) ? n1->l.string->len - 1 : n3->l.number;
if (from < 0 || from > to + 1 || to >= n1->l.string->len) {
c_error("invalid string range");
} else {
return node_str(str_range(n1->l.string, (long) from, (long) to));
}
}
if (typechecking && n1->mod != T_MAPPING && n1->mod != T_MIXED) {
/* indices */
if (n2 != (node *) NULL && n2->mod != T_INT && n2->mod != T_MIXED) {
c_error("bad index type (%s)", i_typename(n2->mod));
}
if (n3 != (node *) NULL && n3->mod != T_INT && n3->mod != T_MIXED) {
c_error("bad index type (%s)", i_typename(n3->mod));
}
/* range */
if ((n1->mod & T_REF) == 0 && n1->mod != T_STRING) {
c_error("bad indexed type (%s)", i_typename(n1->mod));
}
}
return node_bin(N_RANGE, n1->mod, n1, node_bin(N_PAIR, 0, n2, n3));
}
/*
* NAME: bini()
* DESCRIPTION: handle a binary int operator
*/
static node *bini(op, n1, n2, name)
int op;
register node *n1, *n2;
char *name;
{
t_void(n1);
t_void(n2);
if (typechecking &&
((n1->mod != T_INT && n1->mod != T_MIXED) ||
(n2->mod != T_INT && n2->mod != T_MIXED))) {
c_error("bad argument types for %s (%s, %s)", name,
i_typename(n1->mod), i_typename(n2->mod));
}
if (n1->mod == T_INT && n2->mod == T_INT) {
op++;
}
return node_bin(op, T_INT, n1, n2);
}
/*
* NAME: bina()
* DESCRIPTION: handle a binary arithmetic operator
*/
static node *bina(op, n1, n2, name)
int op;
register node *n1, *n2;
char *name;
{
register unsigned short type;
t_void(n1);
t_void(n2);
type = T_MIXED;
if (typechecking &&
((n1->mod != n2->mod && n1->mod != T_MIXED && n2->mod != T_MIXED) ||
(!T_ARITHMETIC(n1->mod) && n1->mod != T_MIXED) ||
(!T_ARITHMETIC(n2->mod) && n2->mod != T_MIXED))) {
c_error("bad argument types for %s (%s, %s)", name,
i_typename(n1->mod), i_typename(n2->mod));
} else if (n1->mod == T_INT || n2->mod == T_INT) {
if (n1->mod == T_INT && n2->mod == T_INT) {
op++;
}
type = T_INT;
} else if (n1->mod == T_FLOAT || n2->mod == T_FLOAT) {
type = T_FLOAT;
}
return node_bin(op, type, n1, n2);
}
/*
* NAME: mult()
* DESCRIPTION: handle the * *= operators
*/
static node *mult(op, n1, n2, name)
int op;
register node *n1, *n2;
char *name;
{
xfloat f1, f2;
if (n1->type == N_INT && n2->type == N_INT) {
/* i * i */
n1->l.number *= n2->l.number;
return n1;
}
if (n1->type == N_FLOAT && n2->type == N_FLOAT) {
NFLT_GET(n1, f1);
NFLT_GET(n2, f2);
flt_mult(&f1, &f2);
NFLT_PUT(n1, f1);
return n1;
}
return bina(op, n1, n2, name);
}
/*
* NAME: mdiv()
* DESCRIPTION: handle the / /= operators
*/
static node *mdiv(op, n1, n2, name)
int op;
register node *n1, *n2;
char *name;
{
xfloat f1, f2;
if (n1->type == N_INT && n2->type == N_INT) {
register Int i, d;
/* i / i */
i = n1->l.number;
d = n2->l.number;
if (d == 0) {
/* i / 0 */
c_error("division by zero");
return n1;
}
if ((d | i) < 0) {
Int r;
r = ((Uint) ((i < 0) ? -i : i)) / ((Uint) ((d < 0) ? -d : d));
n1->l.number = ((i ^ d) < 0) ? -r : r;
} else {
n1->l.number = ((Uint) i) / ((Uint) d);
}
return n1;
} else if (n1->type == N_FLOAT && n2->type == N_FLOAT) {
/* f / f */
if (NFLT_ISZERO(n2)) {
/* f / 0.0 */
c_error("division by zero");
return n1;
}
NFLT_GET(n1, f1);
NFLT_GET(n2, f2);
flt_div(&f1, &f2);
NFLT_PUT(n1, f1);
return n1;
}
return bina(op, n1, n2, name);
}
/*
* NAME: mod()
* DESCRIPTION: handle the % %= operators
*/
static node *mod(op, n1, n2, name)
int op;
register node *n1, *n2;
char *name;
{
if (n1->type == N_INT && n2->type == N_INT) {
register Int i, d;
/* i % i */
i = n1->l.number;
d = n2->l.number;
if (d == 0) {
/* i % 0 */
c_error("modulus by zero");
return n1;
}
if ((d | i) < 0) {
Int r;
r = ((Uint) ((i < 0) ? -i : i)) % ((Uint) ((d < 0) ? -d : d));
n1->l.number = ((i ^ d) < 0) ? -r : r;
} else {
n1->l.number = ((Uint) i) % ((Uint) d);
}
return n1;
}
return bini(op, n1, n2, name);
}
/*
* NAME: add()
* DESCRIPTION: handle the + += operators, possibly rearranging the order
* of the expression
*/
static node *add(op, n1, n2, name)
int op;
register node *n1, *n2;
char *name;
{
xfloat f1, f2;
register unsigned short type;
t_void(n1);
t_void(n2);
if (n1->mod == T_STRING) {
if (n2->mod == T_INT || n2->mod == T_FLOAT ||
(n2->mod == T_MIXED && typechecking)) {
n2 = cast(n2, T_STRING);
}
} else if (n2->mod == T_STRING && op == N_ADD) {
if (n1->mod == T_INT || n1->mod == T_FLOAT ||
(n1->mod == T_MIXED && typechecking)) {
n1 = cast(n1, T_STRING);
}
}
if (n1->type == N_INT && n2->type == N_INT) {
/* i + i */
n1->l.number += n2->l.number;
return n1;
}
if (n1->type == N_FLOAT && n2->type == N_FLOAT) {
/* f + f */
NFLT_GET(n1, f1);
NFLT_GET(n2, f2);
flt_add(&f1, &f2);
NFLT_PUT(n1, f1);
return n1;
}
if (n1->type == N_STR && n2->type == N_STR) {
/* s + s */
return node_str(str_add(n1->l.string, n2->l.string));
}
type = c_tmatch(n1->mod, n2->mod);
if (type == T_OBJECT || type == T_INVALID) {
type = T_MIXED;
if (typechecking) {
c_error("bad argument types for %s (%s, %s)", name,
i_typename(n1->mod), i_typename(n2->mod));
}
} else if (type == T_INT) {
op++;
} else if (op == N_ADD_EQ) {
if (n1->mod == T_INT) {
n2 = node_mon(N_CAST, T_INT, n2);
type = T_INT;
op++;
} else if (n1->mod == T_FLOAT && n2->mod != T_FLOAT) {
n2 = node_mon(N_CAST, T_FLOAT, n2);
type = T_FLOAT;
}
}
return node_bin(op, type, n1, n2);
}
/*
* NAME: sub()
* DESCRIPTION: handle the - -= operators
*/
static node *sub(op, n1, n2, name)
int op;
register node *n1, *n2;
char *name;
{
xfloat f1, f2;
register unsigned short type;
t_void(n1);
t_void(n2);
if (n1->type == N_INT && n2->type == N_INT) {
/* i - i */
n1->l.number -= n2->l.number;
return n1;
}
if (n1->type == N_FLOAT && n2->type == N_FLOAT) {
/* f - f */
NFLT_GET(n1, f1);
NFLT_GET(n2, f2);
flt_sub(&f1, &f2);
NFLT_PUT(n1, f1);
return n1;
}
type = c_tmatch(n1->mod, n2->mod);
if (type == T_STRING || type == T_OBJECT || type == T_MAPPING ||
type == T_INVALID) {
if ((type=n1->mod) != T_MAPPING ||
(n2->mod != T_MIXED && (n2->mod & T_REF) == 0)) {
type = T_MIXED;
if (typechecking) {
c_error("bad argument types for %s (%s, %s)", name,
i_typename(n1->mod), i_typename(n2->mod));
}
}
} else if (type == T_INT) {
op++;
} else if (type == T_MIXED) {
type = (n1->mod == T_MIXED) ? n2->mod : n1->mod;
}
return node_bin(op, type, n1, n2);
}
/*
* NAME: umin()
* DESCRIPTION: handle unary minus
*/
static node *umin(n)
register node *n;
{
xfloat flt;
if (t_unary(n, "unary -")) {
if (n->mod == T_FLOAT) {
FLT_ZERO(flt.high, flt.low);
n = sub(N_SUB, node_float(&flt), n, "-");
} else {
n = sub(N_SUB, node_int((Int) 0), n, "-");
}
}
return n;
}
/*
* NAME: lshift()
* DESCRIPTION: handle the << <<= operators
*/
static node *lshift(op, n1, n2, name)
int op;
register node *n1, *n2;
char *name;
{
if (n1->type == N_INT && n2->type == N_INT) {
/* i << i */
n1->l.number = (Uint) n1->l.number << n2->l.number;
return n1;
}
return bini(op, n1, n2, name);
}
/*
* NAME: rshift()
* DESCRIPTION: handle the >> >>= operators
*/
static node *rshift(op, n1, n2, name)
int op;
register node *n1, *n2;
char *name;
{
if (n1->type == N_INT && n2->type == N_INT) {
/* i >> i */
n1->l.number = (Uint) n1->l.number >> n2->l.number;
return n1;
}
return bini(op, n1, n2, name);
}
/*
* NAME: rel()
* DESCRIPTION: handle the < > <= >= operators
*/
static node *rel(op, n1, n2, name)
int op;
register node *n1, *n2;
char *name;
{
t_void(n1);
t_void(n2);
if (n1->type == N_INT && n2->type == N_INT) {
/* i . i */
switch (op) {
case N_GE:
n1->l.number = (n1->l.number >= n2->l.number);
break;
case N_GT:
n1->l.number = (n1->l.number > n2->l.number);
break;
case N_LE:
n1->l.number = (n1->l.number <= n2->l.number);
break;
case N_LT:
n1->l.number = (n1->l.number < n2->l.number);
break;
}
return n1;
}
if (n1->type == N_FLOAT && n2->type == N_FLOAT) {
xfloat f1, f2;
/* f . f */
NFLT_GET(n1, f1);
NFLT_GET(n2, f2);
switch (op) {
case N_GE:
return node_int((Int) (flt_cmp(&f1, &f2) >= 0));
case N_GT:
return node_int((Int) (flt_cmp(&f1, &f2) > 0));
case N_LE:
return node_int((Int) (flt_cmp(&f1, &f2) <= 0));
case N_LT:
return node_int((Int) (flt_cmp(&f1, &f2) < 0));
}
return n1;
}
if (n1->type == N_STR && n2->type == N_STR) {
/* s . s */
switch (op) {
case N_GE:
return node_int((Int) (str_cmp(n1->l.string, n2->l.string) >= 0));
case N_GT:
return node_int((Int) (str_cmp(n1->l.string, n2->l.string) > 0));
case N_LE:
return node_int((Int) (str_cmp(n1->l.string, n2->l.string) <= 0));
case N_LT:
return node_int((Int) (str_cmp(n1->l.string, n2->l.string) < 0));
}
}
if (typechecking &&
((n1->mod != n2->mod && n1->mod != T_MIXED && n2->mod != T_MIXED) ||
(!T_ARITHSTR(n1->mod) && n1->mod != T_MIXED) ||
(!T_ARITHSTR(n2->mod) && n2->mod != T_MIXED))) {
c_error("bad argument types for %s (%s, %s)", name,
i_typename(n1->mod), i_typename(n2->mod));
} else if (n1->mod == T_INT && n2->mod == T_INT) {
op++;
}
return node_bin(op, T_INT, n1, n2);
}
/*
* NAME: eq()
* DESCRIPTION: handle the == operator
*/
static node *eq(n1, n2)
register node *n1, *n2;
{
xfloat f1, f2;
int op;
t_void(n1);
t_void(n2);
switch (n1->type) {
case N_INT:
if (n2->type == N_INT) {
/* i == i */
n1->l.number = (n1->l.number == n2->l.number);
return n1;
}
if (n1->l.number == 0) {
if (n2->type == N_FLOAT && NFLT_ISZERO(n2)) {
/* 0 == 0.0 */
n1->l.number = TRUE;
return n1;
}
if (n2->type == N_STR) {
/* 0 == s */
return n1; /* FALSE */
}
}
break;
case N_FLOAT:
if (n2->type == N_FLOAT) {
/* f == f */
NFLT_GET(n1, f1);
NFLT_GET(n2, f2);
return node_int((Int) (flt_cmp(&f1, &f2) == 0));
}
if (NFLT_ISZERO(n1) && n2->type == N_INT && n2->l.number == 0) {
/* 0.0 == 0 */
n2->l.number = TRUE;
return n2;
}
break;
case N_STR:
if (n2->type == N_STR) {
/* s == s */
return node_int((Int) (str_cmp(n1->l.string, n2->l.string) == 0));
}
if (n2->type == N_INT && n2->l.number == 0) {
/* s == 0 */
return n2; /* FALSE */
}
break;
}
op = N_EQ;
if (n1->mod != n2->mod && n1->mod != T_MIXED && n2->mod != T_MIXED &&
(!c_zero(n1) || n2->mod == T_FLOAT) &&
(!c_zero(n2) || n1->mod == T_FLOAT)) {
if (typechecking) {
c_error("incompatible types for equality (%s, %s)",
i_typename(n1->mod), i_typename(n2->mod));
}
} else if (n1->mod == T_INT && n2->mod == T_INT) {
op++;
}
return node_bin(op, T_INT, n1, n2);
}
/*
* NAME: and()
* DESCRIPTION: handle the & &= operators
*/
static node *and(op, n1, n2, name)
int op;
register node *n1, *n2;
char *name;
{
register unsigned short type;
if (n1->type == N_INT && n2->type == N_INT) {
/* i & i */
n1->l.number &= n2->l.number;
return n1;
}
if ((((type=n1->mod) == T_MIXED || type == T_MAPPING) &&
((n2->mod & T_REF) != 0 || n2->mod == T_MIXED)) ||
((type=c_tmatch(n1->mod, n2->mod)) & T_REF) != 0) {
/*
* possibly array & array or mapping & array
*/
return node_bin(op, type, n1, n2);
}
return bini(op, n1, n2, name);
}
/*
* NAME: xor()
* DESCRIPTION: handle the ^ ^= operators
*/
static node *xor(op, n1, n2, name)
int op;
register node *n1, *n2;
char *name;
{
register unsigned short type;
if (n1->type == N_INT && n2->type == N_INT) {
/* i ^ i */
n1->l.number ^= n2->l.number;
return n1;
}
if (((type=n1->mod) == T_MIXED && n2->mod == T_MIXED) ||
((type=c_tmatch(n1->mod, n2->mod)) & T_REF) != 0) {
/*
* possibly array ^ array
*/
return node_bin(op, type, n1, n2);
}
return bini(op, n1, n2, name);
}
/*
* NAME: or()
* DESCRIPTION: handle the | |= operators
*/
static node *or(op, n1, n2, name)
int op;
register node *n1, *n2;
char *name;
{
register unsigned short type;
if (n1->type == N_INT && n2->type == N_INT) {
/* i | i */
n1->l.number |= n2->l.number;
return n1;
}
if (((type=n1->mod) == T_MIXED && n2->mod == T_MIXED) ||
((type=c_tmatch(n1->mod, n2->mod)) & T_REF) != 0) {
/*
* possibly array | array
*/
return node_bin(op, type, n1, n2);
}
return bini(op, n1, n2, name);
}
/*
* NAME: land()
* DESCRIPTION: handle the && operator
*/
static node *land(n1, n2)
register node *n1, *n2;
{
t_void(n1);
t_void(n2);
if ((n1->flags & F_CONST) && (n2->flags & F_CONST)) {
n1 = c_tst(n1);
n2 = c_tst(n2);
n1->l.number &= n2->l.number;
return n1;
}
return node_bin(N_LAND, T_INT, n1, n2);
}
/*
* NAME: lor()
* DESCRIPTION: handle the || operator
*/
static node *lor(n1, n2)
register node *n1, *n2;
{
t_void(n1);
t_void(n2);
if ((n1->flags & F_CONST) && (n2->flags & F_CONST)) {
n1 = c_tst(n1);
n2 = c_tst(n2);
n1->l.number |= n2->l.number;
return n1;
}
return node_bin(N_LOR, T_INT, n1, n2);
}
/*
* NAME: quest()
* DESCRIPTION: handle the ? : operator
*/
static node *quest(n1, n2, n3)
register node *n1, *n2, *n3;
{
register unsigned short type;
t_void(n1);
if ((n2->flags & F_CONST) && n3->type == n2->type) {
switch (n1->type) {
case N_INT:
return (n1->l.number == 0) ? n3 : n2;
case N_FLOAT:
return (NFLT_ISZERO(n1)) ? n3 : n2;
case N_STR:
return n2;
}
}
type = T_MIXED;
if (c_zero(n2) && n3->mod != T_FLOAT) {
/*
* expr ? 0 : expr
*/
type = n3->mod;
} else if (c_zero(n3) && n2->mod != T_FLOAT) {
/*
* expr ? expr : 0;
*/
type = n2->mod;
} else if (typechecking) {
/*
* typechecked
*/
if (n2->mod == T_VOID || n3->mod == T_VOID) {
/* result can never be used */
type = T_VOID;
} else {
type = c_tmatch(n2->mod, n3->mod);
if (type == T_INVALID) {
/* no typechecking here, just let the result be mixed */
type = T_MIXED;
}
}
}
return node_bin(N_QUEST, type, n1, node_bin(N_PAIR, 0, n2, n3));
}
/*
* NAME: assign()
* DESCRIPTION: handle the assignment operator
*/
static node *assign(n1, n2)
register node *n1, *n2;
{
if (typechecking && (!c_zero(n2) || n1->mod == T_FLOAT)) {
/*
* typechecked
*/
if (c_tmatch(n1->mod, n2->mod) == T_INVALID) {
c_error("incompatible types for = (%s, %s)",
i_typename(n1->mod), i_typename(n2->mod));
} else if (n1->mod != T_MIXED && n2->mod == T_MIXED) {
n2 = node_mon(N_CAST, n1->mod, n2);
}
}
return node_bin(N_ASSIGN, n1->mod, n1, n2);
}
/*
* NAME: comma()
* DESCRIPTION: handle the comma operator, rearranging the order of the
* expression if needed
*/
static node *comma(n1, n2)
register node *n1, *n2;
{
if (n2->type == N_COMMA) {
/* a, (b, c) --> (a, b), c */
n2->l.left = comma(n1, n2->l.left);
return n2;
} else {
return node_bin(N_COMMA, n2->mod, n1, n2);
}
}
#line 1902 "y.tab.c"
#define YYABORT goto yyabort
#define YYREJECT goto yyabort
#define YYACCEPT goto yyaccept
#define YYERROR goto yyerrlab
int
yyparse()
{
register int yym, yyn, yystate;
#if YYDEBUG
register char *yys;
extern char *getenv();
if (yys = getenv("YYDEBUG"))
{
yyn = *yys;
if (yyn >= '0' && yyn <= '9')
yydebug = yyn - '0';
}
#endif
yynerrs = 0;
yyerrflag = 0;
yychar = (-1);
yyssp = yyss;
yyvsp = yyvs;
*yyssp = yystate = 0;
yyloop:
if (yyn = yydefred[yystate]) goto yyreduce;
if (yychar < 0)
{
if ((yychar = yylex()) < 0) yychar = 0;
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
#endif
}
if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
{
#if YYDEBUG
if (yydebug)
printf("%sdebug: state %d, shifting to state %d\n",
YYPREFIX, yystate, yytable[yyn]);
#endif
if (yyssp >= yyss + yystacksize - 1)
{
goto yyoverflow;
}
*++yyssp = yystate = yytable[yyn];
*++yyvsp = yylval;
yychar = (-1);
if (yyerrflag > 0) --yyerrflag;
goto yyloop;
}
if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
{
yyn = yytable[yyn];
goto yyreduce;
}
if (yyerrflag) goto yyinrecovery;
#ifdef lint
goto yynewerror;
#endif
yynewerror:
yyerror("syntax error");
#ifdef lint
goto yyerrlab;
#endif
yyerrlab:
++yynerrs;
yyinrecovery:
if (yyerrflag < 3)
{
yyerrflag = 3;
for (;;)
{
if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
{
#if YYDEBUG
if (yydebug)
printf("%sdebug: state %d, error recovery shifting\
to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
#endif
if (yyssp >= yyss + yystacksize - 1)
{
goto yyoverflow;
}
*++yyssp = yystate = yytable[yyn];
*++yyvsp = yylval;
goto yyloop;
}
else
{
#if YYDEBUG
if (yydebug)
printf("%sdebug: error recovery discarding state %d\n",
YYPREFIX, *yyssp);
#endif
if (yyssp <= yyss) goto yyabort;
--yyssp;
--yyvsp;
}
}
}
else
{
if (yychar == 0) goto yyabort;
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
#endif
yychar = (-1);
goto yyloop;
}
yyreduce:
#if YYDEBUG
if (yydebug)
printf("%sdebug: state %d, reducing by rule %d (%s)\n",
YYPREFIX, yystate, yyn, yyrule[yyn]);
#endif
yym = yylen[yyn];
yyval = yyvsp[1-yym];
switch (yyn)
{
case 1:
#line 110 "parser.y"
{
nerrors = 0;
ndeclarations = 0;
}
break;
case 2:
#line 115 "parser.y"
{
if (nerrors > 0) {
YYABORT;
}
}
break;
case 4:
#line 125 "parser.y"
{
if (nerrors > 0) {
YYABORT;
}
}
break;
case 5:
#line 134 "parser.y"
{
if (ndeclarations > 0) {
c_error("inherit must precede all declarations");
} else if (nerrors > 0 || !c_inherit(yyvsp[-1].node->l.string->text, yyvsp[-2].node))
{
/*
* The object to be inherited may have been compiled;
* abort this compilation and possibly restart later.
*/
YYABORT;
}
}
break;
case 6:
#line 147 "parser.y"
{ ndeclarations++; }
break;
case 7:
#line 149 "parser.y"
{ ndeclarations++; }
break;
case 8:
#line 154 "parser.y"
{ yyval.node = (node *) NULL; }
break;
case 10:
#line 160 "parser.y"
{ yyval.node = node_str(str_new(yytext, (long) yyleng)); }
break;
case 12:
#line 166 "parser.y"
{ yyval.node = node_str(str_add(yyvsp[-2].node->l.string, yyvsp[0].node->l.string)); }
break;
case 13:
#line 168 "parser.y"
{ yyval.node = yyvsp[-1].node; }
break;
case 14:
#line 173 "parser.y"
{ yyval.node = node_str(str_new(yytext, (long) yyleng)); }
break;
case 15:
#line 178 "parser.y"
{ c_global(yyvsp[-3].type, yyvsp[-2].type, yyvsp[-1].node); }
break;
case 16:
#line 183 "parser.y"
{
typechecking = TRUE;
c_function(yyvsp[-2].type, yyvsp[-1].type, yyvsp[0].node);
}
break;
case 17:
#line 188 "parser.y"
{
if (nerrors == 0) {
c_funcbody(yyvsp[0].node);
}
}
break;
case 18:
#line 194 "parser.y"
{
typechecking = c_typechecking();
c_function(yyvsp[-4].type, (typechecking) ? T_VOID : T_INVALID,
node_bin(N_FUNC, 0, yyvsp[-3].node, yyvsp[-1].node));
}
break;
case 19:
#line 200 "parser.y"
{
if (nerrors == 0) {
c_funcbody(yyvsp[0].node);
}
}
break;
case 20:
#line 209 "parser.y"
{ c_local(yyvsp[-3].type, yyvsp[-2].type, yyvsp[-1].node); }
break;
case 21:
#line 214 "parser.y"
{ yyval.node = (node *) NULL; }
break;
case 22:
#line 215 "parser.y"
{ yyval.node = (node *) NULL; }
break;
case 24:
#line 218 "parser.y"
{
yyval.node = yyvsp[-1].node;
if (yyval.node->type == N_PAIR) {
yyval.node->r.right->mod |= T_ELLIPSIS;
} else {
yyval.node->mod |= T_ELLIPSIS;
}
}
break;
case 26:
#line 231 "parser.y"
{ yyval.node = node_bin(N_PAIR, 0, yyvsp[-2].node, yyvsp[0].node); }
break;
case 27:
#line 236 "parser.y"
{
yyval.node = yyvsp[0].node;
yyval.node->mod |= yyvsp[-1].type;
}
break;
case 28:
#line 240 "parser.y"
{
yyval.node = yyvsp[0].node;
yyval.node->mod = T_INVALID; /* only if typechecking, though */
}
break;
case 29:
#line 248 "parser.y"
{ yyval.type = 0; }
break;
case 30:
#line 250 "parser.y"
{ yyval.type = yyvsp[-1].type | yyvsp[0].type; }
break;
case 31:
#line 255 "parser.y"
{ yyval.type = C_STATIC | C_PRIVATE; }
break;
case 32:
#line 257 "parser.y"
{ yyval.type = C_STATIC; }
break;
case 33:
#line 259 "parser.y"
{ yyval.type = C_ATOMIC; }
break;
case 34:
#line 261 "parser.y"
{ yyval.type = C_NOMASK; }
break;
case 35:
#line 263 "parser.y"
{ yyval.type = C_VARARGS; }
break;
case 36:
#line 267 "parser.y"
{ yyval.type = T_INT; }
break;
case 37:
#line 268 "parser.y"
{ yyval.type = T_FLOAT; }
break;
case 38:
#line 270 "parser.y"
{ yyval.type = T_STRING; }
break;
case 39:
#line 272 "parser.y"
{ yyval.type = T_OBJECT; }
break;
case 40:
#line 274 "parser.y"
{ yyval.type = T_MAPPING; }
break;
case 41:
#line 275 "parser.y"
{ yyval.type = T_MIXED; }
break;
case 42:
#line 276 "parser.y"
{ yyval.type = T_VOID; }
break;
case 43:
#line 281 "parser.y"
{ yyval.type = 0; }
break;
case 44:
#line 283 "parser.y"
{
yyval.type = yyvsp[-1].type + 1;
if (yyval.type == 1 << (8 - REFSHIFT)) {
c_error("too deep indirection");
}
}
break;
case 45:
#line 293 "parser.y"
{
yyval.node = yyvsp[0].node;
yyval.node->mod = (yyvsp[-1].type << REFSHIFT) & T_REF;
}
break;
case 46:
#line 301 "parser.y"
{ yyval.node = node_bin(N_FUNC, (yyvsp[-4].type << REFSHIFT) & T_REF, yyvsp[-3].node, yyvsp[-1].node); }
break;
case 50:
#line 312 "parser.y"
{ yyval.node = node_bin(N_PAIR, 0, yyvsp[-2].node, yyvsp[0].node); }
break;
case 51:
#line 317 "parser.y"
{ yyval.node = (node *) NULL; }
break;
case 52:
#line 319 "parser.y"
{ yyval.node = c_concat(yyvsp[-1].node, yyvsp[0].node); }
break;
case 53:
#line 324 "parser.y"
{
if (nstatements > 0) {
c_error("declaration after statement");
}
yyval.node = (node *) NULL;
}
break;
case 54:
#line 330 "parser.y"
{
nstatements++;
yyval.node = yyvsp[0].node;
}
break;
case 55:
#line 335 "parser.y"
{
if (nerrors >= MAX_ERRORS) {
YYABORT;
}
yyval.node = (node *) NULL;
}
break;
case 56:
#line 345 "parser.y"
{ yyval.node = c_exp_stmt(yyvsp[-1].node); }
break;
case 58:
#line 348 "parser.y"
{ yyval.node = c_if(yyvsp[-2].node, yyvsp[0].node, (node *) NULL); }
break;
case 59:
#line 351 "parser.y"
{ yyval.node = c_if(yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); }
break;
case 60:
#line 352 "parser.y"
{ c_loop(); }
break;
case 61:
#line 354 "parser.y"
{ yyval.node = c_do(yyvsp[-2].node, yyvsp[-5].node); }
break;
case 62:
#line 356 "parser.y"
{ c_loop(); }
break;
case 63:
#line 357 "parser.y"
{ yyval.node = c_while(yyvsp[-3].node, yyvsp[0].node); }
break;
case 64:
#line 359 "parser.y"
{ c_loop(); }
break;
case 65:
#line 360 "parser.y"
{ yyval.node = c_for(c_exp_stmt(yyvsp[-7].node), yyvsp[-5].node, c_exp_stmt(yyvsp[-3].node), yyvsp[0].node); }
break;
case 66:
#line 362 "parser.y"
{
if (typechecking) {
if (yyvsp[-3].node->mod != T_INT && yyvsp[-3].node->mod != T_MIXED) {
c_error("bad type for stack rlimit (%s)",
i_typename(yyvsp[-3].node->mod));
}
if (yyvsp[-1].node->mod != T_INT && yyvsp[-1].node->mod != T_MIXED) {
c_error("bad type for ticks rlimit (%s)",
i_typename(yyvsp[-1].node->mod));
}
}
c_startrlimits();
}
break;
case 67:
#line 376 "parser.y"
{ yyval.node = c_endrlimits(yyvsp[-5].node, yyvsp[-3].node, yyvsp[0].node); }
break;
case 68:
#line 377 "parser.y"
{ c_startcatch(); }
break;
case 69:
#line 379 "parser.y"
{ c_endcatch(); }
break;
case 70:
#line 381 "parser.y"
{ yyval.node = c_donecatch(yyvsp[-2].node, yyvsp[0].node); }
break;
case 71:
#line 383 "parser.y"
{ c_startswitch(yyvsp[-1].node, typechecking); }
break;
case 72:
#line 385 "parser.y"
{ yyval.node = c_endswitch(yyvsp[-3].node, yyvsp[0].node); }
break;
case 73:
#line 387 "parser.y"
{ yyvsp[-1].node = c_case(yyvsp[-1].node, (node *) NULL); }
break;
case 74:
#line 388 "parser.y"
{
yyval.node = yyvsp[-3].node;
if (yyval.node != (node *) NULL) {
yyval.node->l.left = yyvsp[0].node;
} else {
yyval.node = yyvsp[0].node;
}
}
break;
case 75:
#line 397 "parser.y"
{ yyvsp[-3].node = c_case(yyvsp[-3].node, yyvsp[-1].node); }
break;
case 76:
#line 398 "parser.y"
{
yyval.node = yyvsp[-5].node;
if (yyval.node != (node *) NULL) {
yyval.node->l.left = yyvsp[0].node;
} else {
yyval.node = yyvsp[0].node;
}
}
break;
case 77:
#line 407 "parser.y"
{ yyvsp[0].node = c_default(); }
break;
case 78:
#line 408 "parser.y"
{
yyval.node = yyvsp[-2].node;
if (yyval.node != (node *) NULL) {
yyval.node->l.left = yyvsp[0].node;
} else {
yyval.node = yyvsp[0].node;
}
}
break;
case 79:
#line 417 "parser.y"
{
yyval.node = c_break();
}
break;
case 80:
#line 421 "parser.y"
{
yyval.node = c_continue();
}
break;
case 81:
#line 425 "parser.y"
{ yyval.node = c_return(yyvsp[-1].node, typechecking); }
break;
case 82:
#line 426 "parser.y"
{ yyval.node = (node *) NULL; }
break;
case 83:
#line 430 "parser.y"
{
nstatements = 0;
c_startcompound();
}
break;
case 84:
#line 435 "parser.y"
{
nstatements = 1; /* any non-zero value will do */
yyval.node = c_endcompound(yyvsp[-1].node);
}
break;
case 85:
#line 443 "parser.y"
{ yyval.node = (node *) NULL; }
break;
case 86:
#line 445 "parser.y"
{ yyval.node = yyvsp[0].node; }
break;
case 87:
#line 449 "parser.y"
{ yyval.node = c_flookup(yyvsp[0].node, typechecking); }
break;
case 88:
#line 451 "parser.y"
{ yyval.node = c_iflookup(yyvsp[0].node, (node *) NULL); }
break;
case 89:
#line 453 "parser.y"
{ yyval.node = c_iflookup(yyvsp[0].node, yyvsp[-2].node); }
break;
case 90:
#line 458 "parser.y"
{ yyval.node = node_int(yyvsp[0].number); }
break;
case 91:
#line 460 "parser.y"
{ yyval.node = node_float(&yyvsp[0].real); }
break;
case 93:
#line 463 "parser.y"
{ yyval.node = c_aggregate(yyvsp[-2].node, T_MIXED | (1 << REFSHIFT)); }
break;
case 94:
#line 465 "parser.y"
{ yyval.node = c_aggregate(yyvsp[-2].node, T_MAPPING); }
break;
case 95:
#line 466 "parser.y"
{
yyval.node = c_variable(yyvsp[0].node);
if (typechecking) {
if (yyval.node->type == N_GLOBAL && yyval.node->mod != T_MIXED &&
!conf_typechecking()) {
/*
* global vars might be modified by untypechecked
* functions...
*/
yyval.node = node_mon(N_CAST, yyval.node->mod, yyval.node);
}
} else {
/* the variable could be anything */
yyval.node->mod = T_MIXED;
}
}
break;
case 96:
#line 483 "parser.y"
{ yyval.node = yyvsp[-1].node; }
break;
case 97:
#line 485 "parser.y"
{ yyval.node = c_checkcall(c_funcall(yyvsp[-3].node, yyvsp[-1].node), typechecking); }
break;
case 98:
#line 487 "parser.y"
{ yyval.node = node_mon(N_CATCH, T_STRING, yyvsp[-1].node); }
break;
case 99:
#line 489 "parser.y"
{
t_void(yyvsp[-5].node);
yyval.node = c_checkcall(c_arrow(yyvsp[-5].node, yyvsp[-3].node, yyvsp[-1].node), typechecking);
}
break;
case 101:
#line 498 "parser.y"
{ yyval.node = idx(yyvsp[-3].node, yyvsp[-1].node); }
break;
case 102:
#line 500 "parser.y"
{ yyval.node = range(yyvsp[-5].node, yyvsp[-3].node, yyvsp[-1].node); }
break;
case 104:
#line 506 "parser.y"
{ yyval.node = uassign(N_PLUS_PLUS, yyvsp[-1].node, "++"); }
break;
case 105:
#line 508 "parser.y"
{ yyval.node = uassign(N_MIN_MIN, yyvsp[-1].node, "--"); }
break;
case 107:
#line 514 "parser.y"
{ yyval.node = uassign(N_ADD_EQ_1, yyvsp[0].node, "++"); }
break;
case 108:
#line 516 "parser.y"
{ yyval.node = uassign(N_SUB_EQ_1, yyvsp[0].node, "--"); }
break;
case 109:
#line 518 "parser.y"
{ yyval.node = umin(yyvsp[0].node); }
break;
case 110:
#line 520 "parser.y"
{ yyval.node = node_mon(N_UPLUS, yyvsp[0].node->mod, yyvsp[0].node); }
break;
case 111:
#line 522 "parser.y"
{
t_void(yyvsp[0].node);
yyval.node = c_not(yyvsp[0].node);
}
break;
case 112:
#line 527 "parser.y"
{
yyval.node = yyvsp[0].node;
t_void(yyval.node);
if (typechecking && yyval.node->mod != T_INT && yyval.node->mod != T_MIXED) {
c_error("bad argument type for ~ (%s)",
i_typename(yyval.node->mod));
yyval.node->mod = T_MIXED;
} else {
yyval.node = xor(N_XOR, yyval.node, node_int((Int) -1), "^");
}
}
break;
case 114:
#line 543 "parser.y"
{ yyval.node = cast(yyvsp[0].node, yyvsp[-3].type | ((yyvsp[-2].type << REFSHIFT) & T_REF)); }
break;
case 116:
#line 549 "parser.y"
{ yyval.node = mult(N_MULT, yyvsp[-2].node, yyvsp[0].node, "*"); }
break;
case 117:
#line 551 "parser.y"
{ yyval.node = mdiv(N_DIV, yyvsp[-2].node, yyvsp[0].node, "/"); }
break;
case 118:
#line 553 "parser.y"
{ yyval.node = mod(N_MOD, yyvsp[-2].node, yyvsp[0].node, "%"); }
break;
case 120:
#line 559 "parser.y"
{ yyval.node = add(N_ADD, yyvsp[-2].node, yyvsp[0].node, "+"); }
break;
case 121:
#line 561 "parser.y"
{ yyval.node = sub(N_SUB, yyvsp[-2].node, yyvsp[0].node, "-"); }
break;
case 123:
#line 567 "parser.y"
{ yyval.node = lshift(N_LSHIFT, yyvsp[-2].node, yyvsp[0].node, "<<"); }
break;
case 124:
#line 569 "parser.y"
{ yyval.node = rshift(N_RSHIFT, yyvsp[-2].node, yyvsp[0].node, ">>"); }
break;
case 126:
#line 575 "parser.y"
{ yyval.node = rel(N_LT, yyval.node, yyvsp[0].node, "<"); }
break;
case 127:
#line 577 "parser.y"
{ yyval.node = rel(N_GT, yyval.node, yyvsp[0].node, ">"); }
break;
case 128:
#line 579 "parser.y"
{ yyval.node = rel(N_LE, yyval.node, yyvsp[0].node, "<="); }
break;
case 129:
#line 581 "parser.y"
{ yyval.node = rel(N_GE, yyval.node, yyvsp[0].node, ">="); }
break;
case 131:
#line 587 "parser.y"
{ yyval.node = eq(yyvsp[-2].node, yyvsp[0].node); }
break;
case 132:
#line 589 "parser.y"
{ yyval.node = c_not(eq(yyvsp[-2].node, yyvsp[0].node)); }
break;
case 134:
#line 595 "parser.y"
{ yyval.node = and(N_AND, yyvsp[-2].node, yyvsp[0].node, "&"); }
break;
case 136:
#line 601 "parser.y"
{ yyval.node = xor(N_XOR, yyvsp[-2].node, yyvsp[0].node, "^"); }
break;
case 138:
#line 607 "parser.y"
{ yyval.node = or(N_OR, yyvsp[-2].node, yyvsp[0].node, "|"); }
break;
case 140:
#line 613 "parser.y"
{ yyval.node = land(yyvsp[-2].node, yyvsp[0].node); }
break;
case 142:
#line 619 "parser.y"
{ yyval.node = lor(yyvsp[-2].node, yyvsp[0].node); }
break;
case 144:
#line 625 "parser.y"
{ yyval.node = quest(yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); }
break;
case 146:
#line 631 "parser.y"
{ yyval.node = assign(c_lvalue(yyvsp[-2].node, "assignment"), yyvsp[0].node); }
break;
case 147:
#line 633 "parser.y"
{ yyval.node = add(N_ADD_EQ, c_lvalue(yyvsp[-2].node, "+="), yyvsp[0].node, "+="); }
break;
case 148:
#line 635 "parser.y"
{ yyval.node = sub(N_SUB_EQ, c_lvalue(yyvsp[-2].node, "-="), yyvsp[0].node, "-="); }
break;
case 149:
#line 637 "parser.y"
{ yyval.node = mult(N_MULT_EQ, c_lvalue(yyvsp[-2].node, "*="), yyvsp[0].node, "*="); }
break;
case 150:
#line 639 "parser.y"
{ yyval.node = mdiv(N_DIV_EQ, c_lvalue(yyvsp[-2].node, "/="), yyvsp[0].node, "/="); }
break;
case 151:
#line 641 "parser.y"
{ yyval.node = mod(N_MOD_EQ, c_lvalue(yyvsp[-2].node, "%="), yyvsp[0].node, "%="); }
break;
case 152:
#line 643 "parser.y"
{ yyval.node = lshift(N_LSHIFT_EQ, c_lvalue(yyvsp[-2].node, "<<="), yyvsp[0].node, "<<="); }
break;
case 153:
#line 645 "parser.y"
{ yyval.node = rshift(N_RSHIFT_EQ, c_lvalue(yyvsp[-2].node, ">>="), yyvsp[0].node, ">>="); }
break;
case 154:
#line 647 "parser.y"
{ yyval.node = and(N_AND_EQ, c_lvalue(yyvsp[-2].node, "&="), yyvsp[0].node, "&="); }
break;
case 155:
#line 649 "parser.y"
{ yyval.node = xor(N_XOR_EQ, c_lvalue(yyvsp[-2].node, "^="), yyvsp[0].node, "^="); }
break;
case 156:
#line 651 "parser.y"
{ yyval.node = or(N_OR_EQ, c_lvalue(yyvsp[-2].node, "|="), yyvsp[0].node, "|="); }
break;
case 158:
#line 657 "parser.y"
{ yyval.node = comma(yyvsp[-2].node, yyvsp[0].node); }
break;
case 159:
#line 662 "parser.y"
{ yyval.node = (node *) NULL; }
break;
case 161:
#line 668 "parser.y"
{ t_void(yyval.node = yyvsp[0].node); }
break;
case 162:
#line 673 "parser.y"
{ t_void(yyval.node = yyvsp[0].node); }
break;
case 163:
#line 677 "parser.y"
{ t_void(yyval.node = yyvsp[0].node); }
break;
case 164:
#line 679 "parser.y"
{
t_void(yyvsp[0].node);
yyval.node = node_bin(N_PAIR, 0, yyvsp[-2].node, yyvsp[0].node);
}
break;
case 165:
#line 687 "parser.y"
{ yyval.node = (node *) NULL; }
break;
case 167:
#line 690 "parser.y"
{
yyval.node = yyvsp[-1].node;
if (yyval.node->type == N_PAIR) {
yyval.node->r.right = node_mon(N_SPREAD, -1, yyval.node->r.right);
} else {
yyval.node = node_mon(N_SPREAD, -1, yyval.node);
}
}
break;
case 168:
#line 702 "parser.y"
{ yyval.node = (node *) NULL; }
break;
case 170:
#line 705 "parser.y"
{ yyval.node = yyvsp[-1].node; }
break;
case 171:
#line 710 "parser.y"
{
t_void(yyvsp[-2].node);
t_void(yyvsp[0].node);
yyval.node = node_bin(N_COMMA, 0, yyvsp[-2].node, yyvsp[0].node);
}
break;
case 173:
#line 720 "parser.y"
{ yyval.node = node_bin(N_PAIR, 0, yyvsp[-2].node, yyvsp[0].node); }
break;
case 174:
#line 725 "parser.y"
{ yyval.node = (node *) NULL; }
break;
case 176:
#line 728 "parser.y"
{ yyval.node = yyvsp[-1].node; }
break;
#line 2778 "y.tab.c"
}
yyssp -= yym;
yystate = *yyssp;
yyvsp -= yym;
yym = yylhs[yyn];
if (yystate == 0 && yym == 0)
{
#if YYDEBUG
if (yydebug)
printf("%sdebug: after reduction, shifting from state 0 to\
state %d\n", YYPREFIX, YYFINAL);
#endif
yystate = YYFINAL;
*++yyssp = YYFINAL;
*++yyvsp = yyval;
if (yychar < 0)
{
if ((yychar = yylex()) < 0) yychar = 0;
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, YYFINAL, yychar, yys);
}
#endif
}
if (yychar == 0) goto yyaccept;
goto yyloop;
}
if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
yystate = yytable[yyn];
else
yystate = yydgoto[yym];
#if YYDEBUG
if (yydebug)
printf("%sdebug: after reduction, shifting from state %d \
to state %d\n", YYPREFIX, *yyssp, yystate);
#endif
if (yyssp >= yyss + yystacksize - 1)
{
goto yyoverflow;
}
*++yyssp = yystate;
*++yyvsp = yyval;
goto yyloop;
yyoverflow:
yyerror("yacc stack overflow");
yyabort:
return (1);
yyaccept:
return (0);
}