#ifndef lint #if 0 static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93"; #else static char yyrcsid[] = "$NetBSD: skeleton.c,v 1.10 1996/03/25 00:36:18 mrg Exp $"; #endif #endif #include <stdlib.h> #define YYBYACC 1 #define YYMAJOR 1 #define YYMINOR 9 #define YYLEX yylex() #define YYEMPTY -1 #define yyclearin (yychar=(YYEMPTY)) #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*, node*)); 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 76 "y.tab.c" #define STRING 257 #define NOMASK 258 #define NIL 259 #define BREAK 260 #define ELSE 261 #define CASE 262 #define WHILE 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 VOID 272 #define IF 273 #define CATCH 274 #define SWITCH 275 #define VARARGS 276 #define MAPPING 277 #define PRIVATE 278 #define DO 279 #define RETURN 280 #define ATOMIC 281 #define MIXED 282 #define OBJECT 283 #define LARROW 284 #define RARROW 285 #define PLUS_PLUS 286 #define MIN_MIN 287 #define LSHIFT 288 #define RSHIFT 289 #define LE 290 #define GE 291 #define EQ 292 #define NE 293 #define LAND 294 #define LOR 295 #define PLUS_EQ 296 #define MIN_EQ 297 #define MULT_EQ 298 #define DIV_EQ 299 #define MOD_EQ 300 #define LSHIFT_EQ 301 #define RSHIFT_EQ 302 #define AND_EQ 303 #define XOR_EQ 304 #define OR_EQ 305 #define COLON_COLON 306 #define DOT_DOT 307 #define ELLIPSIS 308 #define STRING_CONST 309 #define IDENTIFIER 310 #define INT_CONST 311 #define FLOAT_CONST 312 #define MARK 313 #define HASH 314 #define HASH_HASH 315 #define INCL_CONST 316 #define NR_TOKENS 317 #define YYERRCODE 256 short yylhs[] = { -1, 54, 0, 53, 53, 55, 55, 55, 7, 7, 52, 9, 9, 9, 8, 56, 58, 57, 59, 57, 60, 10, 10, 10, 10, 11, 11, 12, 12, 13, 13, 1, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 5, 5, 14, 14, 14, 14, 14, 14, 14, 14, 6, 6, 15, 16, 17, 17, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 21, 61, 21, 62, 21, 63, 21, 64, 21, 65, 66, 21, 67, 21, 68, 21, 69, 21, 70, 21, 21, 21, 21, 21, 71, 22, 23, 23, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 29, 29, 30, 30, 30, 30, 31, 31, 31, 32, 32, 32, 33, 33, 33, 33, 33, 34, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39, 40, 40, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 42, 42, 43, 43, 44, 45, 46, 46, 47, 47, 47, 48, 48, 48, 49, 50, 50, 51, 51, 51, }; short yylen[] = { 2, 0, 2, 0, 2, 5, 1, 1, 0, 1, 1, 1, 3, 3, 1, 4, 0, 5, 0, 7, 4, 0, 1, 1, 2, 1, 3, 2, 1, 2, 1, 1, 1, 2, 1, 2, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 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, 1, 5, 5, 1, 3, 4, 4, 6, 3, 5, 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, 42, 40, 43, 0, 41, 0, 0, 0, 0, 4, 6, 7, 46, 44, 45, 51, 49, 50, 0, 10, 52, 0, 36, 0, 34, 37, 0, 14, 0, 11, 0, 0, 56, 0, 58, 0, 0, 35, 0, 9, 0, 0, 53, 0, 0, 15, 52, 0, 0, 0, 0, 25, 28, 52, 30, 0, 13, 12, 0, 92, 17, 57, 59, 27, 18, 24, 0, 0, 29, 5, 0, 60, 0, 26, 54, 55, 0, 19, 0, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 69, 0, 0, 0, 0, 99, 100, 91, 0, 0, 93, 0, 0, 0, 0, 31, 102, 61, 63, 66, 0, 112, 0, 0, 125, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 169, 0, 0, 62, 64, 88, 0, 0, 0, 86, 89, 0, 0, 0, 0, 0, 0, 0, 0, 174, 0, 119, 120, 97, 122, 0, 0, 52, 0, 121, 123, 124, 52, 0, 0, 0, 0, 116, 117, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, 0, 0, 0, 82, 0, 0, 0, 0, 0, 0, 0, 78, 0, 0, 90, 175, 0, 0, 0, 184, 0, 0, 0, 106, 0, 0, 0, 0, 110, 0, 0, 0, 0, 128, 129, 130, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 158, 170, 98, 0, 0, 71, 87, 0, 0, 0, 108, 0, 80, 0, 0, 0, 0, 0, 0, 0, 20, 179, 0, 107, 0, 0, 113, 0, 0, 84, 83, 0, 0, 0, 0, 0, 79, 0, 0, 176, 103, 183, 185, 104, 126, 111, 0, 0, 156, 0, 72, 75, 0, 0, 95, 81, 0, 109, 114, 85, 0, 0, 68, 0, 76, 73, 70, 0, 74, }; short yydgoto[] = { 1, 9, 27, 10, 11, 12, 35, 42, 110, 34, 53, 54, 55, 56, 57, 36, 65, 38, 39, 80, 111, 112, 113, 299, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 150, 206, 151, 226, 227, 218, 220, 221, 222, 133, 3, 2, 13, 14, 15, 48, 76, 134, 148, 294, 330, 323, 146, 274, 300, 267, 312, 207, 75, }; short yysindex[] = { 0, 0, 0, -216, 0, 0, 0, 0, 0, -151, -88, -245, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -40, 0, 0, 19, 0, -88, 0, 0, -273, 0, -40, 0, 27, -17, 0, 0, 0, 12, -185, 0, -40, 0, 3, -221, 0, 72, -22, 0, 0, 0, -151, 93, -20, 0, 0, 0, 0, 35, 0, 0, -185, 0, 0, 0, 0, 0, 0, 0, 742, -17, 0, 0, 110, 0, -22, 0, 0, 0, 97, 0, 99, 0, 109, 159, 129, 127, 124, 149, 158, 160, 161, 163, 0, 159, 159, 159, -273, 0, 0, 0, 159, 297, 0, 159, 159, 159, -214, 0, 0, 0, 0, 0, 168, 0, -79, -236, 0, 0, 125, 36, -141, -29, -148, 171, 117, 88, -80, -54, 203, 0, 45, -91, 0, 0, 0, 161, -53, 159, 0, 0, 159, 159, 159, 159, -22, 159, 151, 173, 0, 157, 0, 0, 0, 0, 159, 159, 0, 69, 0, 0, 0, 0, 159, -38, -273, 159, 0, 0, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 0, 159, -273, 159, 0, 173, 180, 151, 165, 166, 214, 92, 0, 218, 2, 0, 0, 222, 142, 232, 0, 250, 202, 108, 0, 56, -16, 260, -40, 0, 284, 173, 235, 18, 0, 0, 0, 125, 125, 36, 36, -141, -141, -141, -141, -29, -29, -148, 171, 117, 88, -80, 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 271, 151, 0, 0, 159, 159, 151, 0, 273, 0, 292, 159, 293, 159, 159, 294, 159, 0, 0, 159, 0, 100, 159, 0, 159, 159, 0, 0, 151, 295, 274, 77, 151, 0, -22, 159, 0, 0, 0, 0, 0, 0, 0, 298, 248, 0, 151, 0, 0, 159, 151, 0, 0, 302, 0, 0, 0, -22, 303, 0, 286, 0, 0, 0, 151, 0, }; short yyrindex[] = { 0, 0, 0, 1, 0, 0, 0, 1618, 0, 0, 0, 845, 1445, 0, 0, 0, 0, 0, 0, 0, 0, 0, -35, 0, 0, 0, 0, 890, 0, 0, -18, 0, 0, 0, -23, 0, 0, -12, 0, 0, 306, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, -21, 0, 0, 307, 0, 0, 0, 0, 0, 0, 0, 306, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 172, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 231, 0, 0, 299, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 474, 573, 0, 0, 532, 888, 982, 1349, 1365, 1515, 1728, 1784, 94, 504, 61, 0, 0, 435, 0, 0, 0, 0, 0, 0, 0, 0, 0, 299, 0, 0, 0, 0, 0, -7, 0, 0, 0, 0, 0, 0, 239, 281, 0, 0, 0, 0, 0, 0, 325, 0, 0, 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 254, 0, 0, 0, 288, 0, 0, 0, 0, 341, 0, 0, 0, 0, -89, 0, 0, 0, 0, 0, 620, 841, 914, 942, 1027, 1250, 1295, 1321, 1389, 1437, 1657, 1702, 1744, 1800, 1821, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 299, 0, 0, -30, 0, 0, 261, 0, 0, 311, 0, 0, 0, 0, 0, 0, 0, 325, 0, 312, 0, 0, 0, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 344, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; short yygindex[] = { 0, 320, 0, 80, 332, 112, -41, 0, 32, -15, 354, 0, 317, 370, 21, 371, 403, 382, 272, 0, 0, 374, -37, 0, 0, 0, 0, 0, 0, 687, -13, 6, -4, -3, 251, 252, 255, 256, 263, 0, 152, 1779, 1967, -135, -106, -144, 291, 164, 0, 176, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; #define YYTABLESIZE 2282 short yytable[] = { 32, 2, 228, 94, 173, 204, 47, 47, 209, 188, 94, 64, 167, 94, 25, 94, 71, 44, 48, 48, 22, 51, 8, 233, 70, 46, 30, 59, 285, 94, 24, 179, 57, 180, 172, 43, 208, 23, 210, 81, 47, 213, 4, 16, 60, 58, 45, 57, 173, 5, 168, 169, 172, 17, 33, 18, 50, 58, 19, 40, 6, 232, 7, 20, 33, 8, 173, 58, 21, 22, 45, 49, 16, 67, 33, 58, 78, 61, 45, 173, 67, 174, 17, 67, 18, 67, 172, 51, 31, 201, 28, 52, 20, 94, 73, 94, 94, 21, 22, 67, 50, 63, 157, 154, 200, 157, 16, 41, 54, 212, 224, 16, 62, 201, 201, 283, 17, 223, 18, 157, 157, 19, 29, 54, 158, 23, 20, 296, 291, 163, 106, 21, 22, 273, 68, 153, 201, 103, 153, 29, 102, 308, 105, 45, 181, 182, 310, 175, 176, 282, 46, 79, 153, 153, 157, 153, 101, 153, 135, 23, 237, 238, 172, 67, 295, 67, 67, 170, 136, 139, 4, 230, 171, 241, 242, 243, 244, 5, 245, 246, 324, 239, 240, 141, 106, 140, 157, 153, 6, 142, 26, 103, 106, 8, 102, 319, 105, 229, 143, 103, 144, 145, 102, 147, 105, 165, 166, 265, 164, 183, 101, 184, 185, 287, 186, 202, 215, 201, 172, 153, 63, 268, 104, 107, 270, 271, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 187, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 203, 272, 94, 94, 38, 275, 33, 177, 178, 318, 199, 276, 277, 278, 38, 31, 38, 31, 38, 38, 63, 47, 94, 107, 38, 94, 94, 94, 94, 38, 38, 107, 327, 48, 69, 51, 279, 8, 284, 23, 280, 281, 67, 67, 67, 67, 67, 286, 67, 67, 67, 67, 67, 67, 67, 67, 67, 38, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 288, 290, 67, 67, 289, 292, 106, 298, 301, 315, 303, 306, 314, 103, 316, 320, 102, 321, 105, 326, 328, 329, 67, 21, 23, 67, 67, 67, 67, 82, 77, 4, 83, 84, 171, 85, 86, 87, 5, 88, 180, 89, 177, 90, 157, 157, 91, 92, 93, 6, 186, 7, 94, 95, 8, 181, 171, 187, 178, 96, 97, 171, 182, 77, 157, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 108, 153, 153, 98, 188, 171, 31, 23, 99, 100, 83, 84, 109, 85, 86, 87, 74, 88, 83, 89, 156, 90, 67, 107, 91, 92, 93, 37, 72, 38, 94, 95, 66, 137, 247, 225, 248, 96, 97, 38, 249, 38, 250, 311, 38, 96, 97, 217, 0, 38, 251, 0, 309, 0, 38, 38, 305, 98, 0, 0, 31, 23, 99, 100, 0, 98, 0, 0, 31, 23, 99, 100, 105, 105, 0, 96, 105, 105, 105, 105, 105, 0, 105, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 105, 105, 105, 105, 105, 105, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 0, 0, 115, 115, 0, 0, 115, 115, 115, 115, 115, 0, 115, 214, 0, 0, 0, 105, 0, 105, 105, 0, 0, 115, 115, 115, 115, 115, 115, 0, 0, 0, 0, 0, 0, 0, 155, 0, 0, 155, 0, 0, 0, 0, 0, 16, 0, 83, 0, 0, 105, 105, 0, 155, 155, 17, 155, 18, 115, 115, 19, 131, 137, 0, 131, 20, 131, 131, 131, 0, 21, 22, 269, 0, 96, 97, 0, 0, 0, 0, 0, 131, 131, 131, 131, 131, 131, 0, 155, 115, 115, 0, 0, 0, 98, 0, 0, 31, 23, 99, 100, 118, 118, 0, 0, 118, 118, 118, 118, 118, 0, 118, 0, 0, 0, 0, 131, 131, 0, 0, 155, 0, 118, 118, 118, 118, 118, 118, 0, 0, 0, 0, 293, 0, 0, 0, 0, 297, 0, 0, 0, 0, 0, 0, 0, 0, 0, 131, 131, 132, 0, 0, 132, 0, 132, 132, 132, 118, 118, 313, 0, 0, 0, 317, 0, 0, 0, 0, 0, 132, 132, 132, 132, 132, 132, 0, 0, 322, 0, 0, 0, 325, 0, 0, 0, 0, 0, 0, 118, 118, 0, 0, 0, 0, 0, 331, 0, 0, 0, 0, 0, 0, 0, 0, 132, 132, 0, 0, 0, 0, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 0, 105, 105, 132, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 0, 115, 115, 152, 153, 0, 0, 0, 0, 155, 0, 0, 160, 161, 162, 0, 0, 0, 0, 0, 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, 0, 155, 155, 0, 0, 0, 0, 0, 0, 0, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 0, 131, 131, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 234, 235, 236, 0, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 133, 118, 118, 133, 0, 133, 133, 133, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 133, 133, 133, 133, 133, 0, 0, 0, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 134, 132, 132, 134, 0, 0, 134, 0, 133, 133, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 134, 134, 134, 134, 134, 134, 135, 0, 0, 135, 0, 0, 135, 0, 0, 0, 0, 0, 0, 133, 133, 0, 0, 307, 0, 0, 135, 135, 135, 135, 135, 135, 0, 0, 136, 134, 134, 136, 0, 0, 136, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 136, 136, 136, 136, 136, 136, 0, 135, 135, 17, 0, 18, 134, 134, 19, 0, 0, 0, 52, 20, 137, 0, 0, 137, 21, 22, 137, 0, 0, 0, 0, 0, 0, 0, 0, 136, 136, 0, 135, 135, 137, 137, 137, 137, 137, 137, 0, 0, 0, 0, 0, 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 140, 136, 136, 140, 0, 0, 140, 0, 0, 0, 137, 137, 0, 0, 0, 0, 0, 0, 0, 0, 140, 140, 140, 140, 140, 140, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 0, 0, 0, 137, 137, 0, 0, 0, 0, 31, 0, 31, 0, 0, 31, 0, 0, 140, 140, 31, 0, 0, 0, 0, 31, 31, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 33, 133, 133, 0, 140, 140, 0, 0, 31, 0, 33, 0, 33, 0, 0, 33, 0, 0, 0, 0, 33, 0, 0, 0, 0, 33, 33, 0, 0, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 0, 134, 134, 0, 0, 0, 33, 0, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 0, 135, 135, 0, 0, 0, 0, 0, 0, 0, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 0, 136, 136, 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, 137, 137, 137, 137, 141, 137, 137, 141, 0, 0, 141, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 141, 141, 141, 141, 141, 141, 0, 0, 0, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 138, 140, 140, 138, 0, 0, 138, 0, 0, 0, 141, 141, 0, 0, 0, 0, 0, 0, 0, 0, 138, 138, 138, 138, 138, 138, 139, 0, 0, 139, 0, 0, 139, 0, 0, 0, 0, 0, 0, 0, 0, 141, 141, 0, 0, 0, 139, 139, 139, 139, 139, 139, 0, 0, 142, 138, 138, 142, 0, 0, 142, 0, 0, 0, 0, 0, 0, 0, 0, 0, 145, 0, 0, 145, 142, 142, 145, 142, 0, 142, 0, 139, 139, 0, 0, 0, 138, 138, 0, 0, 145, 145, 0, 145, 143, 145, 0, 143, 0, 0, 143, 0, 0, 0, 0, 0, 0, 0, 0, 142, 142, 0, 139, 139, 143, 143, 0, 143, 0, 143, 0, 0, 0, 0, 0, 145, 145, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 142, 142, 144, 0, 0, 144, 0, 0, 144, 143, 143, 0, 0, 0, 0, 0, 145, 145, 0, 0, 0, 0, 144, 144, 0, 144, 0, 144, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 143, 143, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 144, 144, 0, 0, 0, 0, 0, 0, 0, 0, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 147, 141, 141, 147, 0, 144, 144, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 147, 147, 0, 147, 0, 147, 0, 0, 0, 0, 0, 0, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 0, 138, 138, 0, 0, 0, 0, 147, 147, 0, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 0, 139, 139, 0, 0, 0, 0, 0, 0, 0, 0, 0, 147, 147, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 0, 142, 142, 0, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 0, 145, 145, 0, 0, 0, 0, 0, 0, 0, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 146, 143, 143, 146, 0, 0, 146, 32, 37, 0, 0, 0, 0, 0, 0, 37, 0, 32, 0, 32, 146, 146, 32, 146, 0, 146, 37, 32, 37, 0, 0, 37, 32, 32, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 148, 144, 144, 148, 0, 0, 0, 146, 146, 0, 0, 0, 32, 0, 0, 0, 0, 148, 148, 0, 148, 0, 148, 0, 0, 0, 149, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 0, 146, 146, 0, 0, 150, 149, 149, 150, 149, 0, 149, 0, 0, 0, 148, 148, 0, 0, 0, 0, 0, 150, 150, 0, 150, 0, 150, 0, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 149, 147, 147, 0, 151, 148, 148, 151, 0, 0, 0, 0, 0, 0, 0, 0, 150, 0, 0, 0, 152, 151, 151, 152, 151, 0, 151, 0, 0, 0, 0, 149, 149, 0, 0, 0, 0, 152, 152, 0, 152, 154, 152, 138, 154, 0, 0, 150, 150, 0, 0, 0, 0, 0, 39, 36, 151, 0, 154, 154, 0, 154, 36, 154, 39, 0, 39, 0, 39, 39, 0, 0, 152, 36, 39, 36, 0, 0, 36, 39, 39, 0, 0, 0, 0, 0, 0, 0, 151, 0, 0, 0, 0, 154, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 152, 0, 0, 39, 0, 0, 0, 0, 0, 0, 216, 219, 0, 0, 0, 0, 0, 0, 216, 0, 0, 154, 0, 0, 0, 0, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 0, 146, 146, 0, 0, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 0, 264, 0, 266, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 0, 148, 148, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 0, 149, 149, 0, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 0, 150, 150, 0, 0, 0, 302, 0, 304, 219, 0, 0, 149, 0, 302, 0, 0, 216, 0, 0, 159, 0, 0, 0, 0, 0, 0, 0, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 0, 151, 151, 0, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 205, 152, 152, 205, 149, 205, 211, 0, 205, 0, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 0, 154, 154, 0, 0, 0, 0, 231, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 252, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 205, 149, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 205, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 149, }; short yycheck[] = { 40, 0, 40, 33, 93, 58, 41, 42, 143, 63, 40, 48, 91, 43, 9, 45, 57, 32, 41, 42, 41, 42, 40, 167, 44, 42, 271, 42, 44, 59, 9, 60, 44, 62, 41, 30, 142, 310, 144, 76, 35, 147, 258, 257, 41, 40, 43, 59, 41, 265, 286, 287, 59, 267, 22, 269, 44, 52, 272, 40, 276, 167, 278, 277, 32, 281, 59, 62, 282, 283, 43, 59, 257, 33, 42, 70, 71, 45, 43, 43, 40, 45, 267, 43, 269, 45, 93, 272, 309, 44, 10, 276, 277, 123, 59, 125, 126, 282, 283, 59, 44, 123, 41, 98, 59, 44, 257, 27, 44, 146, 41, 123, 40, 44, 44, 59, 267, 158, 269, 58, 59, 272, 10, 59, 103, 310, 277, 271, 58, 108, 33, 282, 283, 41, 41, 41, 44, 40, 44, 27, 43, 41, 45, 43, 292, 293, 290, 288, 289, 41, 42, 41, 58, 59, 93, 61, 59, 63, 59, 310, 173, 174, 37, 123, 270, 125, 126, 42, 59, 40, 258, 166, 47, 177, 178, 179, 180, 265, 181, 182, 315, 175, 176, 59, 33, 58, 125, 93, 276, 40, 278, 40, 33, 281, 43, 301, 45, 165, 40, 40, 40, 40, 43, 40, 45, 284, 285, 202, 40, 38, 59, 94, 124, 228, 294, 306, 59, 44, 307, 125, 123, 41, 125, 126, 59, 59, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 295, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 307, 41, 286, 287, 257, 41, 228, 290, 291, 300, 61, 263, 44, 125, 267, 309, 269, 309, 271, 272, 123, 310, 306, 126, 277, 309, 310, 311, 312, 282, 283, 126, 323, 310, 308, 310, 58, 309, 308, 310, 44, 93, 256, 257, 258, 259, 260, 41, 262, 263, 264, 265, 266, 267, 268, 269, 270, 310, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 40, 307, 286, 287, 93, 58, 33, 58, 40, 59, 41, 41, 41, 40, 261, 41, 43, 93, 45, 41, 41, 59, 306, 41, 41, 309, 310, 311, 312, 256, 123, 258, 259, 260, 59, 262, 263, 264, 265, 266, 125, 268, 41, 270, 307, 308, 273, 274, 275, 276, 93, 278, 279, 280, 281, 125, 307, 93, 41, 286, 287, 41, 125, 70, 91, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 80, 307, 308, 306, 93, 93, 309, 310, 311, 312, 259, 260, 80, 262, 263, 264, 62, 266, 259, 268, 123, 270, 52, 126, 273, 274, 275, 24, 57, 257, 279, 280, 50, 274, 183, 163, 184, 286, 287, 267, 185, 269, 186, 291, 272, 286, 287, 156, -1, 277, 187, -1, 288, -1, 282, 283, 280, 306, -1, -1, 309, 310, 311, 312, -1, 306, -1, -1, 309, 310, 311, 312, 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, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, -1, -1, 37, 38, -1, -1, 41, 42, 43, 44, 45, -1, 47, 148, -1, -1, -1, 91, -1, 93, 94, -1, -1, 58, 59, 60, 61, 62, 63, -1, -1, -1, -1, -1, -1, -1, 41, -1, -1, 44, -1, -1, -1, -1, -1, 257, -1, 259, -1, -1, 124, 125, -1, 58, 59, 267, 61, 269, 93, 94, 272, 38, 274, -1, 41, 277, 43, 44, 45, -1, 282, 283, 207, -1, 286, 287, -1, -1, -1, -1, -1, 58, 59, 60, 61, 62, 63, -1, 93, 124, 125, -1, -1, -1, 306, -1, -1, 309, 310, 311, 312, 37, 38, -1, -1, 41, 42, 43, 44, 45, -1, 47, -1, -1, -1, -1, 93, 94, -1, -1, 125, -1, 58, 59, 60, 61, 62, 63, -1, -1, -1, -1, 267, -1, -1, -1, -1, 272, -1, -1, -1, -1, -1, -1, -1, -1, -1, 124, 125, 38, -1, -1, 41, -1, 43, 44, 45, 93, 94, 294, -1, -1, -1, 298, -1, -1, -1, -1, -1, 58, 59, 60, 61, 62, 63, -1, -1, 312, -1, -1, -1, 316, -1, -1, -1, -1, -1, -1, 124, 125, -1, -1, -1, -1, -1, 330, -1, -1, -1, -1, -1, -1, -1, -1, 93, 94, -1, -1, -1, -1, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, -1, 307, 308, 124, 125, -1, -1, -1, -1, -1, -1, -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, 304, 305, -1, 307, 308, 96, 97, -1, -1, -1, -1, 102, -1, -1, 105, 106, 107, -1, -1, -1, -1, -1, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, -1, 307, 308, -1, -1, -1, -1, -1, -1, -1, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, -1, 307, 308, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 170, 171, 172, -1, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 38, 307, 308, 41, -1, 43, 44, 45, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 58, 59, 60, 61, 62, 63, -1, -1, -1, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 38, 307, 308, 41, -1, -1, 44, -1, 93, 94, -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, 124, 125, -1, -1, 282, -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, -1, -1, -1, 257, 58, 59, 60, 61, 62, 63, -1, 93, 94, 267, -1, 269, 124, 125, 272, -1, -1, -1, 276, 277, 38, -1, -1, 41, 282, 283, 44, -1, -1, -1, -1, -1, -1, -1, -1, 93, 94, -1, 124, 125, 58, 59, 60, 61, 62, 63, -1, -1, -1, -1, -1, -1, 310, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 38, 124, 125, 41, -1, -1, 44, -1, -1, -1, 93, 94, -1, -1, -1, -1, -1, -1, -1, -1, 58, 59, 60, 61, 62, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 257, -1, -1, -1, 124, 125, -1, -1, -1, -1, 267, -1, 269, -1, -1, 272, -1, -1, 93, 94, 277, -1, -1, -1, -1, 282, 283, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 257, 307, 308, -1, 124, 125, -1, -1, 310, -1, 267, -1, 269, -1, -1, 272, -1, -1, -1, -1, 277, -1, -1, -1, -1, 282, 283, -1, -1, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, -1, 307, 308, -1, -1, -1, 310, -1, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, -1, 307, 308, -1, -1, -1, -1, -1, -1, -1, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, -1, 307, 308, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -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, 304, 305, 38, 307, 308, 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, -1, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 38, 307, 308, 41, -1, -1, 44, -1, -1, -1, 93, 94, -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, 124, 125, -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, -1, 63, -1, -1, -1, -1, -1, 93, 94, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 124, 125, 38, -1, -1, 41, -1, -1, 44, 93, 94, -1, -1, -1, -1, -1, 124, 125, -1, -1, -1, -1, 58, 59, -1, 61, -1, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 124, 125, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 93, 94, -1, -1, -1, -1, -1, -1, -1, -1, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 41, 307, 308, 44, -1, 124, 125, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 58, 59, -1, 61, -1, 63, -1, -1, -1, -1, -1, -1, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, -1, 307, 308, -1, -1, -1, -1, 93, 94, -1, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, -1, 307, 308, -1, -1, -1, -1, -1, -1, -1, -1, -1, 124, 125, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, -1, 307, 308, -1, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, -1, 307, 308, -1, -1, -1, -1, -1, -1, -1, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 38, 307, 308, 41, -1, -1, 44, 257, 258, -1, -1, -1, -1, -1, -1, 265, -1, 267, -1, 269, 58, 59, 272, 61, -1, 63, 276, 277, 278, -1, -1, 281, 282, 283, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 41, 307, 308, 44, -1, -1, -1, 93, 94, -1, -1, -1, 310, -1, -1, -1, -1, 58, 59, -1, 61, -1, 63, -1, -1, -1, 41, -1, -1, 44, -1, -1, -1, -1, -1, -1, -1, -1, 124, 125, -1, -1, 41, 58, 59, 44, 61, -1, 63, -1, -1, -1, 93, 94, -1, -1, -1, -1, -1, 58, 59, -1, 61, -1, 63, -1, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 93, 307, 308, -1, 41, 124, 125, 44, -1, -1, -1, -1, -1, -1, -1, -1, 93, -1, -1, -1, 41, 58, 59, 44, 61, -1, 63, -1, -1, -1, -1, 124, 125, -1, -1, -1, -1, 58, 59, -1, 61, 41, 63, 85, 44, -1, -1, 124, 125, -1, -1, -1, -1, -1, 257, 258, 93, -1, 58, 59, -1, 61, 265, 63, 267, -1, 269, -1, 271, 272, -1, -1, 93, 276, 277, 278, -1, -1, 281, 282, 283, -1, -1, -1, -1, -1, -1, -1, 125, -1, -1, -1, -1, 93, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 125, -1, -1, 310, -1, -1, -1, -1, -1, -1, 156, 157, -1, -1, -1, -1, -1, -1, 164, -1, -1, 125, -1, -1, -1, -1, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, -1, 307, 308, -1, -1, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, -1, 201, -1, 203, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, -1, 307, 308, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, -1, 307, 308, -1, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, -1, 307, 308, -1, -1, -1, 277, -1, 279, 280, -1, -1, 95, -1, 285, -1, -1, 288, -1, -1, 103, -1, -1, -1, -1, -1, -1, -1, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, -1, 307, 308, -1, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 139, 307, 308, 142, 143, 144, 145, -1, 147, -1, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, -1, 307, 308, -1, -1, -1, -1, 167, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 188, -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, 270, 271, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 290, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 301, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 315, }; #define YYFINAL 1 #ifndef YYDEBUG #define YYDEBUG 0 #endif #define YYMAXTOKEN 317 #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", "NIL","BREAK","ELSE","CASE","WHILE","DEFAULT","STATIC","CONTINUE","INT", "RLIMITS","FLOAT","FOR","INHERIT","VOID","IF","CATCH","SWITCH","VARARGS", "MAPPING","PRIVATE","DO","RETURN","ATOMIC","MIXED","OBJECT","LARROW","RARROW", "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 : opt_private INHERIT opt_inherit_label composite_string ';'", "top_level_declaration : data_declaration", "top_level_declaration : function_declaration", "opt_inherit_label :", "opt_inherit_label : ident", "ident : IDENTIFIER", "composite_string : string", "composite_string : composite_string '+' string", "composite_string : '(' composite_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 : varargs_formal_declaration", "formal_declaration_list : formal_declaration_list ',' varargs_formal_declaration", "varargs_formal_declaration : VARARGS formal_declaration", "varargs_formal_declaration : formal_declaration", "formal_declaration : type_specifier data_dcltr", "formal_declaration : ident", "class_specifier_list : opt_private", "class_specifier_list : non_private", "class_specifier_list : class_specifier class_specifier_list2", "class_specifier_list2 : class_specifier", "class_specifier_list2 : class_specifier_list2 class_specifier", "class_specifier : PRIVATE", "class_specifier : non_private", "opt_private :", "opt_private : PRIVATE", "non_private : STATIC", "non_private : ATOMIC", "non_private : NOMASK", "non_private : VARARGS", "type_specifier : INT", "type_specifier : FLOAT", "type_specifier : STRING", "type_specifier : OBJECT", "type_specifier : OBJECT composite_string", "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 : NIL", "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 RARROW ident '(' opt_arg_list ')'", "primary_p1_exp : primary_p2_exp LARROW string", "primary_p1_exp : primary_p2_exp LARROW '(' composite_string ')'", "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 10000 #define YYMAXDEPTH 10000 #endif #endif int yydebug; int yynerrs; int yyerrflag; int yychar; short *yyssp; YYSTYPE *yyvsp; YYSTYPE yyval; YYSTYPE yylval; short yyss[YYSTACKSIZE]; #define yysslim (&yyss[YYSTACKSIZE - 1]) YYSTYPE yyvs[YYSTACKSIZE]; #define yystacksize YYSTACKSIZE #line 773 "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; { char tnbuf[17]; t_void(n); if (typechecking && !T_ARITHMETIC(n->mod) && n->mod != T_MIXED) { c_error("bad argument type for %s (%s)", name, i_typename(tnbuf, 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, *type; { xfloat flt; Int i; char *p, buffer[18]; if (type->mod != n->mod) { switch (type->mod) { 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 */ p = n->l.string->text; i = strtoint(&p); 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 (type->mod == T_MIXED || (type->mod & T_TYPE) == T_VOID) { /* (mixed), (void), (void *) */ c_error("cannot cast to %s", i_typename(buffer, type->mod)); n->mod = T_MIXED; } else if ((type->mod & T_REF) < (n->mod & T_REF)) { /* (mixed *) of (mixed **) */ c_error("illegal cast of array type (%s)", i_typename(buffer, n->mod)); } else if ((n->mod & T_TYPE) != T_MIXED && ((type->mod & T_TYPE) != T_CLASS || ((n->mod & T_TYPE) != T_OBJECT && (n->mod & T_TYPE) != T_CLASS) || (type->mod & T_REF) != (n->mod & T_REF))) { /* can only cast from mixed, or object/class to class */ c_error("cast of invalid type (%s)", i_typename(buffer, n->mod)); } else { if ((type->mod & T_REF) == 0 || (n->mod & T_REF) == 0) { /* runtime cast */ n = node_mon(N_CAST, type->mod, n); } else { n->mod = type->mod; } n->class = type->class; } } else if (type->mod == T_CLASS && str_cmp(type->class, n->class) != 0) { /* * cast to different object class */ n = node_mon(N_CAST, type->mod, n); n->class = type->class; } return n; } /* * NAME: idx() * DESCRIPTION: handle the [ ] operator */ static node *idx(n1, n2) register node *n1, *n2; { char tnbuf[17]; 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(tnbuf, n2->mod)); } if (type != T_MIXED) { /* you can't trust these arrays */ n2 = node_mon(N_CAST, type, node_bin(N_INDEX, type, n1, n2)); n2->class = n1->class; return 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(tnbuf, n2->mod)); } type = T_INT; } else { if (typechecking && n1->mod != T_MAPPING && n1->mod != T_MIXED) { c_error("bad indexed type (%s)", i_typename(tnbuf, 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) { char tnbuf[17]; /* indices */ if (n2 != (node *) NULL && n2->mod != T_INT && n2->mod != T_MIXED) { c_error("bad index type (%s)", i_typename(tnbuf, n2->mod)); } if (n3 != (node *) NULL && n3->mod != T_INT && n3->mod != T_MIXED) { c_error("bad index type (%s)", i_typename(tnbuf, n3->mod)); } /* range */ if ((n1->mod & T_REF) == 0 && n1->mod != T_STRING) { c_error("bad indexed type (%s)", i_typename(tnbuf, 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; { char tnbuf1[17], tnbuf2[17]; 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(tnbuf1, n1->mod), i_typename(tnbuf2, 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; { char tnbuf1[17], tnbuf2[17]; 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(tnbuf1, n1->mod), i_typename(tnbuf2, 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 < 0) { d = -d; } if (i < 0) { n1->l.number = - (Int) (((Uint) -i) % ((Uint) d)); } 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; { char tnbuf1[17], tnbuf2[17]; 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, node_type(T_STRING, (string *) NULL)); } } 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, node_type(T_STRING, (string *) NULL)); } } 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_NIL || type == T_OBJECT || type == T_CLASS) { type = T_MIXED; if (typechecking) { c_error("bad argument types for %s (%s, %s)", name, i_typename(tnbuf1, n1->mod), i_typename(tnbuf2, 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; { char tnbuf1[17], tnbuf2[17]; 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_NIL || type == T_STRING || type == T_OBJECT || type == T_CLASS || type == T_MAPPING) { 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(tnbuf1, n1->mod), i_typename(tnbuf2, n2->mod)); } } } else if (type == T_INT) { op++; } else if (type == T_MIXED) { type = (n1->mod == T_MIXED) ? n2->mod : n1->mod; } else if (n1->mod == T_MIXED && (n2->mod & T_REF)) { type = T_MIXED; } 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 (n2->type == N_INT) { if (n2->l.number < 0) { c_error("negative left shift"); n2->l.number = 0; } if (n1->type == N_INT) { /* i << i */ n1->l.number = (n2->l.number < 32) ? (Uint) n1->l.number << n2->l.number : 0; 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 (n2->type == N_INT) { if (n2->l.number < 0) { c_error("negative right shift"); n2->l.number = 0; } if (n1->type == N_INT) { /* i >> i */ n1->l.number = (n2->l.number < 32) ? (Uint) n1->l.number >> n2->l.number : 0; 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; { char tnbuf1[17], tnbuf2[17]; 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(tnbuf1, n1->mod), i_typename(tnbuf2, 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; { char tnbuf1[17], tnbuf2[17]; 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 (nil_node == N_INT && n1->l.number == 0 && n2->type == N_STR) { /* nil == str */ return node_int((Int) 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)); } 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 == nil_node && n2->l.number == 0) { /* s == nil */ return node_int((Int) FALSE); } break; case N_NIL: if (n2->type == N_NIL) { /* nil == nil */ return node_int((Int) TRUE); } if (n2->type == N_STR) { /* nil == str */ return node_int((Int) FALSE); } break; } op = N_EQ; if (n1->mod != n2->mod && n1->mod != T_MIXED && n2->mod != T_MIXED && (!c_nil(n1) || !T_POINTER(n2->mod)) && (!c_nil(n2) || !T_POINTER(n1->mod))) { if (typechecking) { c_error("incompatible types for equality (%s, %s)", i_typename(tnbuf1, n1->mod), i_typename(tnbuf2, 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) != T_NIL) { /* * 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) != T_NIL) { /* * 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) != T_NIL) { /* * 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; case N_NIL: return n3; } } type = T_MIXED; if (c_nil(n2) && T_POINTER(n3->mod)) { /* * expr ? nil : expr */ type = n3->mod; } else if (c_nil(n3) && T_POINTER(n2->mod)) { /* * expr ? expr : nil; */ 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_NIL) { /* no typechecking here, just let the result be mixed */ type = T_MIXED; } } } n1 = node_bin(N_QUEST, type, n1, node_bin(N_PAIR, 0, n2, n3)); if ((type & T_TYPE) == T_CLASS && str_cmp(n2->class, n3->class) == 0) { n1->class = n2->class; } return n1; } /* * NAME: assign() * DESCRIPTION: handle the assignment operator */ static node *assign(n1, n2) register node *n1, *n2; { char tnbuf1[17], tnbuf2[17]; if (typechecking && (!c_nil(n2) || !T_POINTER(n1->mod))) { /* * typechecked */ if (c_tmatch(n1->mod, n2->mod) == T_NIL) { c_error("incompatible types for = (%s, %s)", i_typename(tnbuf1, n1->mod), i_typename(tnbuf2, n2->mod)); } else if ((n1->mod != T_MIXED && n2->mod == T_MIXED) || (n1->mod == T_CLASS && (n2->mod != T_CLASS || str_cmp(n1->class, n2->class) != 0))) { n2 = node_mon(N_CAST, n1->mod, n2); n2->class = n1->class; } } n2 = node_bin(N_ASSIGN, n1->mod, n1, n2); n2->class = n1->class; return 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 { n1 = node_bin(N_COMMA, n2->mod, n1, n2); n1->class = n2->class; return n1; } } #line 2037 "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; 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]) != 0) 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 >= yysslim) { 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 >= yysslim) { 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 112 "parser.y" { nerrors = 0; ndeclarations = 0; } break; case 2: #line 117 "parser.y" { if (nerrors > 0) { YYABORT; } } break; case 4: #line 127 "parser.y" { if (nerrors > 0) { YYABORT; } } break; case 5: #line 136 "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, yyvsp[-4].type != 0)) { /* * The object to be inherited may have been compiled; * abort this compilation and possibly restart later. */ YYABORT; } } break; case 6: #line 149 "parser.y" { ndeclarations++; } break; case 7: #line 151 "parser.y" { ndeclarations++; } break; case 8: #line 156 "parser.y" { yyval.node = (node *) NULL; } break; case 10: #line 162 "parser.y" { yyval.node = node_str(str_new(yytext, (long) yyleng)); } break; case 12: #line 168 "parser.y" { yyval.node = node_str(str_add(yyvsp[-2].node->l.string, yyvsp[0].node->l.string)); } break; case 13: #line 170 "parser.y" { yyval.node = yyvsp[-1].node; } break; case 14: #line 175 "parser.y" { yyval.node = node_str(str_new(yytext, (long) yyleng)); } break; case 15: #line 180 "parser.y" { c_global(yyvsp[-3].type, yyvsp[-2].node, yyvsp[-1].node); } break; case 16: #line 185 "parser.y" { typechecking = TRUE; c_function(yyvsp[-2].type, yyvsp[-1].node, yyvsp[0].node); } break; case 17: #line 190 "parser.y" { if (nerrors == 0) { c_funcbody(yyvsp[0].node); } } break; case 18: #line 196 "parser.y" { typechecking = c_typechecking(); c_function(yyvsp[-4].type, node_type((typechecking) ? T_VOID : T_NIL, (string *) NULL), node_bin(N_FUNC, 0, yyvsp[-3].node, yyvsp[-1].node)); } break; case 19: #line 203 "parser.y" { if (nerrors == 0) { c_funcbody(yyvsp[0].node); } } break; case 20: #line 212 "parser.y" { c_local(yyvsp[-3].type, yyvsp[-2].node, yyvsp[-1].node); } break; case 21: #line 217 "parser.y" { yyval.node = (node *) NULL; } break; case 22: #line 218 "parser.y" { yyval.node = (node *) NULL; } break; case 24: #line 221 "parser.y" { yyval.node = yyvsp[-1].node; yyval.node->flags |= F_ELLIPSIS; } break; case 26: #line 230 "parser.y" { yyval.node = node_bin(N_PAIR, 0, yyvsp[-2].node, yyvsp[0].node); } break; case 27: #line 235 "parser.y" { yyval.node = yyvsp[0].node; yyval.node->flags |= F_VARARGS; } break; case 29: #line 244 "parser.y" { yyval.node = yyvsp[0].node; yyval.node->mod |= yyvsp[-1].node->mod; yyval.node->class = yyvsp[-1].node->class; } break; case 30: #line 249 "parser.y" { yyval.node = yyvsp[0].node; yyval.node->mod = T_NIL; /* only if typechecking, though */ } break; case 33: #line 259 "parser.y" { yyval.type = yyvsp[-1].type | yyvsp[0].type; } break; case 35: #line 265 "parser.y" { yyval.type = yyvsp[-1].type | yyvsp[0].type; } break; case 36: #line 270 "parser.y" { yyval.type = C_STATIC | C_PRIVATE; } break; case 38: #line 276 "parser.y" { yyval.type = 0; } break; case 39: #line 278 "parser.y" { yyval.type = C_STATIC | C_PRIVATE; } break; case 40: #line 283 "parser.y" { yyval.type = C_STATIC; } break; case 41: #line 285 "parser.y" { yyval.type = C_ATOMIC; } break; case 42: #line 287 "parser.y" { yyval.type = C_NOMASK; } break; case 43: #line 289 "parser.y" { yyval.type = C_VARARGS; } break; case 44: #line 293 "parser.y" { yyval.node = node_type(T_INT, (string *) NULL); } break; case 45: #line 294 "parser.y" { yyval.node = node_type(T_FLOAT, (string *) NULL); } break; case 46: #line 296 "parser.y" { yyval.node = node_type(T_STRING, (string *) NULL); } break; case 47: #line 298 "parser.y" { yyval.node = node_type(T_OBJECT, (string *) NULL); } break; case 48: #line 300 "parser.y" { yyval.node = node_type(T_CLASS, c_objecttype(yyvsp[0].node)); } break; case 49: #line 302 "parser.y" { yyval.node = node_type(T_MAPPING, (string *) NULL); } break; case 50: #line 303 "parser.y" { yyval.node = node_type(T_MIXED, (string *) NULL); } break; case 51: #line 304 "parser.y" { yyval.node = node_type(T_VOID, (string *) NULL); } break; case 52: #line 309 "parser.y" { yyval.type = 0; } break; case 53: #line 311 "parser.y" { yyval.type = yyvsp[-1].type + 1; if (yyval.type == 1 << (8 - REFSHIFT)) { c_error("too deep indirection"); } } break; case 54: #line 321 "parser.y" { yyval.node = yyvsp[0].node; yyval.node->mod = (yyvsp[-1].type << REFSHIFT) & T_REF; } break; case 55: #line 329 "parser.y" { yyval.node = node_bin(N_FUNC, (yyvsp[-4].type << REFSHIFT) & T_REF, yyvsp[-3].node, yyvsp[-1].node); } break; case 59: #line 340 "parser.y" { yyval.node = node_bin(N_PAIR, 0, yyvsp[-2].node, yyvsp[0].node); } break; case 60: #line 345 "parser.y" { yyval.node = (node *) NULL; } break; case 61: #line 347 "parser.y" { yyval.node = c_concat(yyvsp[-1].node, yyvsp[0].node); } break; case 62: #line 352 "parser.y" { if (nstatements > 0) { c_error("declaration after statement"); } yyval.node = (node *) NULL; } break; case 63: #line 358 "parser.y" { nstatements++; yyval.node = yyvsp[0].node; } break; case 64: #line 363 "parser.y" { if (nerrors >= MAX_ERRORS) { YYABORT; } yyval.node = (node *) NULL; } break; case 65: #line 373 "parser.y" { yyval.node = c_exp_stmt(yyvsp[-1].node); } break; case 67: #line 376 "parser.y" { yyval.node = c_if(yyvsp[-2].node, yyvsp[0].node, (node *) NULL); } break; case 68: #line 379 "parser.y" { yyval.node = c_if(yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); } break; case 69: #line 380 "parser.y" { c_loop(); } break; case 70: #line 382 "parser.y" { yyval.node = c_do(yyvsp[-2].node, yyvsp[-5].node); } break; case 71: #line 384 "parser.y" { c_loop(); } break; case 72: #line 385 "parser.y" { yyval.node = c_while(yyvsp[-3].node, yyvsp[0].node); } break; case 73: #line 387 "parser.y" { c_loop(); } break; case 74: #line 388 "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 75: #line 390 "parser.y" { if (typechecking) { char tnbuf[17]; if (yyvsp[-3].node->mod != T_INT && yyvsp[-3].node->mod != T_MIXED) { c_error("bad type for stack rlimit (%s)", i_typename(tnbuf, 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(tnbuf, yyvsp[-1].node->mod)); } } c_startrlimits(); } break; case 76: #line 406 "parser.y" { yyval.node = c_endrlimits(yyvsp[-5].node, yyvsp[-3].node, yyvsp[0].node); } break; case 77: #line 407 "parser.y" { c_startcatch(); } break; case 78: #line 409 "parser.y" { c_endcatch(); } break; case 79: #line 411 "parser.y" { yyval.node = c_donecatch(yyvsp[-2].node, yyvsp[0].node); } break; case 80: #line 413 "parser.y" { c_startswitch(yyvsp[-1].node, typechecking); } break; case 81: #line 415 "parser.y" { yyval.node = c_endswitch(yyvsp[-3].node, yyvsp[0].node); } break; case 82: #line 417 "parser.y" { yyvsp[-1].node = c_case(yyvsp[-1].node, (node *) NULL); } break; case 83: #line 418 "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 84: #line 427 "parser.y" { yyvsp[-3].node = c_case(yyvsp[-3].node, yyvsp[-1].node); } break; case 85: #line 428 "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 86: #line 437 "parser.y" { yyvsp[0].node = c_default(); } break; case 87: #line 438 "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 88: #line 447 "parser.y" { yyval.node = c_break(); } break; case 89: #line 451 "parser.y" { yyval.node = c_continue(); } break; case 90: #line 455 "parser.y" { yyval.node = c_return(yyvsp[-1].node, typechecking); } break; case 91: #line 456 "parser.y" { yyval.node = (node *) NULL; } break; case 92: #line 460 "parser.y" { nstatements = 0; c_startcompound(); } break; case 93: #line 465 "parser.y" { nstatements = 1; /* any non-zero value will do */ yyval.node = c_endcompound(yyvsp[-1].node); } break; case 94: #line 473 "parser.y" { yyval.node = (node *) NULL; } break; case 95: #line 475 "parser.y" { yyval.node = yyvsp[0].node; } break; case 96: #line 479 "parser.y" { yyval.node = c_flookup(yyvsp[0].node, typechecking); } break; case 97: #line 481 "parser.y" { yyval.node = c_iflookup(yyvsp[0].node, (node *) NULL); } break; case 98: #line 483 "parser.y" { yyval.node = c_iflookup(yyvsp[0].node, yyvsp[-2].node); } break; case 99: #line 488 "parser.y" { yyval.node = node_int(yyvsp[0].number); } break; case 100: #line 490 "parser.y" { yyval.node = node_float(&yyvsp[0].real); } break; case 101: #line 491 "parser.y" { yyval.node = node_nil(); } break; case 103: #line 494 "parser.y" { yyval.node = c_aggregate(yyvsp[-2].node, T_MIXED | (1 << REFSHIFT)); } break; case 104: #line 496 "parser.y" { yyval.node = c_aggregate(yyvsp[-2].node, T_MAPPING); } break; case 105: #line 497 "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); yyval.node->class = yyval.node->l.left->class; } } else { /* the variable could be anything */ yyval.node->mod = T_MIXED; } } break; case 106: #line 515 "parser.y" { yyval.node = yyvsp[-1].node; } break; case 107: #line 517 "parser.y" { yyval.node = c_checkcall(c_funcall(yyvsp[-3].node, yyvsp[-1].node), typechecking); } break; case 108: #line 519 "parser.y" { yyval.node = node_mon(N_CATCH, T_STRING, yyvsp[-1].node); } break; case 109: #line 521 "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 110: #line 526 "parser.y" { yyval.node = c_instanceof(yyvsp[-2].node, yyvsp[0].node); } break; case 111: #line 528 "parser.y" { yyval.node = c_instanceof(yyvsp[-4].node, yyvsp[-1].node); } break; case 113: #line 534 "parser.y" { yyval.node = idx(yyvsp[-3].node, yyvsp[-1].node); } break; case 114: #line 536 "parser.y" { yyval.node = range(yyvsp[-5].node, yyvsp[-3].node, yyvsp[-1].node); } break; case 116: #line 542 "parser.y" { yyval.node = uassign(N_PLUS_PLUS, yyvsp[-1].node, "++"); } break; case 117: #line 544 "parser.y" { yyval.node = uassign(N_MIN_MIN, yyvsp[-1].node, "--"); } break; case 119: #line 550 "parser.y" { yyval.node = uassign(N_ADD_EQ_1, yyvsp[0].node, "++"); } break; case 120: #line 552 "parser.y" { yyval.node = uassign(N_SUB_EQ_1, yyvsp[0].node, "--"); } break; case 121: #line 554 "parser.y" { yyval.node = umin(yyvsp[0].node); } break; case 122: #line 556 "parser.y" { yyval.node = yyvsp[0].node; } break; case 123: #line 558 "parser.y" { t_void(yyvsp[0].node); yyval.node = c_not(yyvsp[0].node); } break; case 124: #line 563 "parser.y" { yyval.node = yyvsp[0].node; t_void(yyval.node); if (typechecking && yyval.node->mod != T_INT && yyval.node->mod != T_MIXED) { char tnbuf[17]; c_error("bad argument type for ~ (%s)", i_typename(tnbuf, yyval.node->mod)); yyval.node->mod = T_MIXED; } else { yyval.node = xor(N_XOR, yyval.node, node_int((Int) -1), "^"); } } break; case 126: #line 581 "parser.y" { yyvsp[-3].node->mod |= (yyvsp[-2].type << REFSHIFT) & T_REF; yyval.node = cast(yyvsp[0].node, yyvsp[-3].node); } break; case 128: #line 590 "parser.y" { yyval.node = mult(N_MULT, yyvsp[-2].node, yyvsp[0].node, "*"); } break; case 129: #line 592 "parser.y" { yyval.node = mdiv(N_DIV, yyvsp[-2].node, yyvsp[0].node, "/"); } break; case 130: #line 594 "parser.y" { yyval.node = mod(N_MOD, yyvsp[-2].node, yyvsp[0].node, "%"); } break; case 132: #line 600 "parser.y" { yyval.node = add(N_ADD, yyvsp[-2].node, yyvsp[0].node, "+"); } break; case 133: #line 602 "parser.y" { yyval.node = sub(N_SUB, yyvsp[-2].node, yyvsp[0].node, "-"); } break; case 135: #line 608 "parser.y" { yyval.node = lshift(N_LSHIFT, yyvsp[-2].node, yyvsp[0].node, "<<"); } break; case 136: #line 610 "parser.y" { yyval.node = rshift(N_RSHIFT, yyvsp[-2].node, yyvsp[0].node, ">>"); } break; case 138: #line 616 "parser.y" { yyval.node = rel(N_LT, yyval.node, yyvsp[0].node, "<"); } break; case 139: #line 618 "parser.y" { yyval.node = rel(N_GT, yyval.node, yyvsp[0].node, ">"); } break; case 140: #line 620 "parser.y" { yyval.node = rel(N_LE, yyval.node, yyvsp[0].node, "<="); } break; case 141: #line 622 "parser.y" { yyval.node = rel(N_GE, yyval.node, yyvsp[0].node, ">="); } break; case 143: #line 628 "parser.y" { yyval.node = eq(yyvsp[-2].node, yyvsp[0].node); } break; case 144: #line 630 "parser.y" { yyval.node = c_not(eq(yyvsp[-2].node, yyvsp[0].node)); } break; case 146: #line 636 "parser.y" { yyval.node = and(N_AND, yyvsp[-2].node, yyvsp[0].node, "&"); } break; case 148: #line 642 "parser.y" { yyval.node = xor(N_XOR, yyvsp[-2].node, yyvsp[0].node, "^"); } break; case 150: #line 648 "parser.y" { yyval.node = or(N_OR, yyvsp[-2].node, yyvsp[0].node, "|"); } break; case 152: #line 654 "parser.y" { yyval.node = land(yyvsp[-2].node, yyvsp[0].node); } break; case 154: #line 660 "parser.y" { yyval.node = lor(yyvsp[-2].node, yyvsp[0].node); } break; case 156: #line 666 "parser.y" { yyval.node = quest(yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); } break; case 158: #line 672 "parser.y" { yyval.node = assign(c_lvalue(yyvsp[-2].node, "assignment"), yyvsp[0].node); } break; case 159: #line 674 "parser.y" { yyval.node = add(N_ADD_EQ, c_lvalue(yyvsp[-2].node, "+="), yyvsp[0].node, "+="); } break; case 160: #line 676 "parser.y" { yyval.node = sub(N_SUB_EQ, c_lvalue(yyvsp[-2].node, "-="), yyvsp[0].node, "-="); } break; case 161: #line 678 "parser.y" { yyval.node = mult(N_MULT_EQ, c_lvalue(yyvsp[-2].node, "*="), yyvsp[0].node, "*="); } break; case 162: #line 680 "parser.y" { yyval.node = mdiv(N_DIV_EQ, c_lvalue(yyvsp[-2].node, "/="), yyvsp[0].node, "/="); } break; case 163: #line 682 "parser.y" { yyval.node = mod(N_MOD_EQ, c_lvalue(yyvsp[-2].node, "%="), yyvsp[0].node, "%="); } break; case 164: #line 684 "parser.y" { yyval.node = lshift(N_LSHIFT_EQ, c_lvalue(yyvsp[-2].node, "<<="), yyvsp[0].node, "<<="); } break; case 165: #line 686 "parser.y" { yyval.node = rshift(N_RSHIFT_EQ, c_lvalue(yyvsp[-2].node, ">>="), yyvsp[0].node, ">>="); } break; case 166: #line 688 "parser.y" { yyval.node = and(N_AND_EQ, c_lvalue(yyvsp[-2].node, "&="), yyvsp[0].node, "&="); } break; case 167: #line 690 "parser.y" { yyval.node = xor(N_XOR_EQ, c_lvalue(yyvsp[-2].node, "^="), yyvsp[0].node, "^="); } break; case 168: #line 692 "parser.y" { yyval.node = or(N_OR_EQ, c_lvalue(yyvsp[-2].node, "|="), yyvsp[0].node, "|="); } break; case 170: #line 698 "parser.y" { yyval.node = comma(yyvsp[-2].node, yyvsp[0].node); } break; case 171: #line 703 "parser.y" { yyval.node = (node *) NULL; } break; case 173: #line 709 "parser.y" { t_void(yyval.node = yyvsp[0].node); } break; case 174: #line 714 "parser.y" { t_void(yyval.node = yyvsp[0].node); } break; case 175: #line 718 "parser.y" { t_void(yyval.node = yyvsp[0].node); } break; case 176: #line 720 "parser.y" { t_void(yyvsp[0].node); yyval.node = node_bin(N_PAIR, 0, yyvsp[-2].node, yyvsp[0].node); } break; case 177: #line 728 "parser.y" { yyval.node = (node *) NULL; } break; case 179: #line 731 "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 180: #line 743 "parser.y" { yyval.node = (node *) NULL; } break; case 182: #line 746 "parser.y" { yyval.node = yyvsp[-1].node; } break; case 183: #line 751 "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 185: #line 761 "parser.y" { yyval.node = node_bin(N_PAIR, 0, yyvsp[-2].node, yyvsp[0].node); } break; case 186: #line 766 "parser.y" { yyval.node = (node *) NULL; } break; case 188: #line 769 "parser.y" { yyval.node = yyvsp[-1].node; } break; #line 2949 "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 >= yysslim) { goto yyoverflow; } *++yyssp = yystate; *++yyvsp = yyval; goto yyloop; yyoverflow: yyerror("yacc stack overflow"); yyabort: return (1); yyaccept: return (0); }