#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 node *varargs P((node*, node*)); 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 75 "parser.y" typedef union { Int number; /* lex input */ xfloat real; /* lex input */ unsigned short type; /* internal */ struct _node_ *node; /* internal */ } YYSTYPE; #line 77 "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 ARROW 284 #define PLUS_PLUS 285 #define MIN_MIN 286 #define LSHIFT 287 #define RSHIFT 288 #define LE 289 #define GE 290 #define EQ 291 #define NE 292 #define LAND 293 #define LOR 294 #define PLUS_EQ 295 #define MIN_EQ 296 #define MULT_EQ 297 #define DIV_EQ 298 #define MOD_EQ 299 #define LSHIFT_EQ 300 #define RSHIFT_EQ 301 #define AND_EQ 302 #define XOR_EQ 303 #define OR_EQ 304 #define COLON_COLON 305 #define DOT_DOT 306 #define ELLIPSIS 307 #define STRING_CONST 308 #define IDENTIFIER 309 #define INT_CONST 310 #define FLOAT_CONST 311 #define MARK 312 #define HASH 313 #define HASH_HASH 314 #define INCL_CONST 315 #define NR_TOKENS 316 #define YYERRCODE 256 short yylhs[] = { -1, 53, 0, 52, 52, 54, 54, 54, 8, 8, 51, 10, 10, 10, 9, 55, 57, 56, 58, 56, 59, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 13, 13, 1, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7, 14, 15, 16, 16, 17, 17, 18, 18, 19, 19, 19, 20, 20, 20, 20, 60, 20, 61, 20, 62, 20, 63, 20, 64, 65, 20, 66, 20, 67, 20, 68, 20, 69, 20, 20, 20, 20, 20, 70, 21, 22, 22, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 28, 28, 29, 29, 29, 29, 30, 30, 30, 31, 31, 31, 32, 32, 32, 32, 32, 33, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 41, 41, 42, 42, 43, 44, 45, 45, 46, 46, 46, 47, 47, 47, 48, 49, 49, 50, 50, 50, }; 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, 2, 3, 4, 5, 1, 3, 2, 1, 1, 1, 2, 1, 2, 1, 1, 0, 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, 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, 44, 42, 45, 0, 43, 0, 0, 0, 0, 4, 6, 7, 48, 46, 47, 52, 50, 51, 49, 10, 53, 0, 38, 0, 36, 39, 0, 0, 57, 0, 59, 0, 0, 37, 0, 9, 54, 0, 0, 15, 53, 0, 0, 53, 0, 0, 29, 32, 14, 0, 11, 0, 0, 93, 17, 58, 60, 0, 0, 31, 18, 24, 0, 0, 5, 0, 0, 61, 26, 0, 55, 0, 0, 30, 13, 12, 56, 0, 19, 0, 0, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 70, 0, 0, 0, 0, 100, 101, 92, 0, 0, 94, 0, 0, 0, 0, 33, 103, 62, 64, 67, 0, 111, 0, 0, 124, 126, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 168, 0, 0, 63, 28, 65, 89, 0, 0, 0, 87, 90, 0, 0, 0, 0, 0, 0, 0, 0, 173, 0, 118, 119, 98, 121, 0, 0, 53, 0, 120, 122, 123, 53, 0, 0, 0, 115, 116, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 66, 0, 0, 0, 83, 0, 0, 0, 0, 0, 0, 0, 79, 0, 0, 91, 174, 0, 0, 0, 183, 0, 0, 0, 107, 0, 0, 0, 0, 0, 0, 0, 127, 128, 129, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 157, 169, 99, 0, 0, 72, 88, 0, 0, 0, 109, 0, 81, 0, 0, 0, 0, 0, 0, 0, 20, 178, 0, 108, 0, 112, 0, 0, 85, 84, 0, 0, 0, 0, 0, 80, 0, 0, 175, 104, 182, 184, 105, 125, 0, 0, 155, 0, 73, 76, 0, 0, 96, 82, 0, 110, 113, 86, 0, 0, 69, 0, 77, 74, 71, 0, 75, }; short yydgoto[] = { 1, 9, 27, 10, 11, 12, 47, 31, 38, 112, 55, 48, 49, 50, 32, 59, 34, 35, 81, 113, 114, 115, 298, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 153, 208, 154, 228, 229, 220, 222, 223, 224, 135, 3, 2, 13, 14, 15, 42, 75, 136, 151, 293, 328, 321, 149, 274, 299, 267, 310, 209, 71, }; short yysindex[] = { 0, 0, 0, -99, 0, 0, 0, 0, 0, 800, -95, -257, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, -95, 0, 0, -256, -40, 0, 0, 0, -10, 243, 0, -33, 0, 0, 61, 7, 0, 0, 0, 800, 0, 72, -26, 0, 0, 0, -33, 0, 34, 243, 0, 0, 0, 0, -25, -40, 0, 0, 0, 266, 79, 0, -187, 86, 0, 0, 800, 0, 7, 800, 0, 0, 0, 0, 151, 0, -15, 74, 0, 115, 350, 135, 122, 129, 152, 153, 155, 157, 158, 0, 350, 350, 350, -256, 0, 0, 0, 350, 297, 0, 350, 350, 350, -186, 0, 0, 0, 0, 0, 164, 0, -85, -259, 0, 0, 57, 108, -146, -3, -145, 167, 112, 83, -82, -58, 461, 0, 4, -96, 0, 0, 0, 0, 157, -50, 350, 0, 0, 350, 350, 350, 350, 7, 350, -20, 168, 0, 154, 0, 0, 0, 0, 350, 350, 0, 64, 0, 0, 0, 0, 350, -256, 350, 0, 0, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 0, 350, -256, 350, 0, 168, 173, -20, 156, 165, 175, 70, 0, 176, -37, 0, 0, 179, 102, 170, 0, 185, 137, 116, 0, 43, 16, 190, 193, 168, 141, -71, 0, 0, 0, 57, 57, 108, 108, -146, -146, -146, -146, -3, -3, -145, 167, 112, 83, -82, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 180, -20, 0, 0, 350, 350, -20, 0, 183, 0, 197, 350, 204, 350, 350, 206, 350, 0, 0, 350, 0, 350, 0, 350, 350, 0, 0, -20, 208, 192, -9, -20, 0, 7, 350, 0, 0, 0, 0, 0, 0, 220, 169, 0, -20, 0, 0, 350, -20, 0, 0, 222, 0, 0, 0, 7, 223, 0, 267, 0, 0, 0, -20, 0, }; short yyrindex[] = { 0, 0, 0, 1, 0, 0, 0, 555, 0, 0, 0, 947, -133, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1144, 0, 0, -28, 0, 0, -23, 0, 0, 226, 0, 0, 0, 0, 51, 0, 0, 0, -38, 0, 0, 0, 286, 0, 0, 0, 0, 0, 0, 226, 0, 0, 0, 0, 287, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 397, 0, 288, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 209, 0, 0, 272, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 443, 552, 0, 0, 589, 856, 1040, 1371, 1566, 1654, 1713, 1837, 1977, 627, -13, 0, 0, 405, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 272, 0, 0, 0, 0, 0, -4, 0, 0, 0, 0, 0, 0, 210, 240, 0, 0, 0, 0, 0, 0, 293, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 213, 0, 0, 0, 246, 0, 0, 0, 0, 300, 0, 0, -84, 0, 0, 0, 0, 0, 710, 736, 894, 1003, 1078, 1187, 1224, 1345, 1491, 1529, 1638, 1675, 1866, 1939, 1993, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 272, 0, 0, 39, 0, 0, 218, 0, 0, 252, 0, 0, 0, 0, 0, 0, 293, 0, 253, 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 315, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; short yygindex[] = { 0, 285, 0, 46, 298, 65, 13, -32, 0, 5, 329, 328, -6, 12, 338, 362, 343, 225, 0, 0, -141, -42, 0, 0, 0, 0, 0, 0, -57, -8, -17, 21, -12, 207, 203, 211, 214, 205, 0, 106, 1898, -81, -135, -115, -152, 238, 114, 0, 119, 0, 0, 2273, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; #define YYTABLESIZE 2477 short yytable[] = { 58, 2, 40, 22, 52, 190, 169, 53, 206, 172, 216, 211, 8, 108, 30, 62, 152, 233, 66, 73, 105, 58, 24, 104, 162, 107, 170, 171, 156, 73, 210, 156, 212, 82, 44, 215, 58, 171, 36, 103, 61, 155, 156, 54, 172, 156, 156, 158, 203, 43, 163, 164, 165, 23, 232, 171, 28, 181, 54, 182, 285, 207, 172, 202, 207, 152, 207, 213, 269, 207, 83, 16, 95, 37, 79, 29, 203, 69, 77, 95, 156, 17, 95, 18, 95, 77, 19, 44, 231, 171, 290, 20, 29, 68, 174, 55, 21, 22, 95, 172, 16, 56, 283, 57, 173, 226, 109, 214, 203, 252, 55, 273, 156, 64, 203, 234, 235, 236, 161, 295, 78, 52, 69, 166, 34, 39, 292, 80, 68, 225, 57, 296, 39, 138, 34, 68, 34, 308, 68, 34, 68, 177, 178, 39, 34, 39, 183, 184, 39, 34, 34, 175, 311, 176, 68, 294, 315, 282, 40, 4, 239, 240, 95, 4, 95, 95, 5, 237, 238, 320, 5, 245, 246, 323, 139, 142, 34, 6, 322, 7, 143, 6, 8, 26, 108, 317, 8, 329, 144, 207, 152, 105, 145, 146, 104, 147, 107, 148, 150, 168, 241, 242, 243, 244, 167, 185, 186, 187, 152, 204, 103, 188, 203, 217, 268, 270, 272, 275, 68, 207, 68, 68, 171, 277, 271, 306, 276, 278, 279, 280, 281, 286, 152, 287, 288, 289, 189, 300, 291, 85, 86, 297, 87, 88, 89, 302, 90, 305, 91, 312, 92, 313, 314, 93, 94, 95, 205, 316, 40, 96, 97, 318, 319, 324, 326, 98, 99, 21, 40, 23, 40, 52, 40, 40, 57, 52, 106, 109, 40, 325, 8, 65, 72, 40, 40, 100, 179, 180, 52, 23, 101, 102, 137, 156, 156, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 40, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 284, 95, 95, 327, 23, 25, 27, 108, 170, 78, 185, 176, 179, 170, 105, 180, 186, 104, 177, 107, 181, 95, 187, 170, 95, 95, 95, 95, 68, 68, 68, 68, 68, 170, 68, 68, 68, 68, 68, 68, 68, 68, 68, 110, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 111, 68, 68, 67, 108, 70, 63, 33, 60, 160, 248, 105, 227, 247, 104, 251, 107, 309, 219, 249, 304, 68, 307, 250, 68, 68, 68, 68, 84, 0, 4, 85, 86, 0, 87, 88, 89, 5, 90, 0, 91, 159, 92, 0, 109, 93, 94, 95, 6, 0, 7, 96, 97, 8, 0, 0, 0, 98, 99, 0, 0, 0, 0, 106, 106, 0, 97, 106, 106, 106, 106, 106, 0, 106, 0, 0, 0, 100, 0, 0, 52, 23, 101, 102, 106, 106, 106, 106, 106, 106, 0, 0, 0, 0, 0, 0, 0, 109, 0, 0, 0, 114, 114, 0, 0, 114, 114, 114, 114, 114, 0, 114, 0, 0, 0, 0, 0, 106, 0, 106, 106, 16, 114, 114, 114, 114, 114, 114, 0, 0, 0, 17, 0, 18, 0, 0, 45, 0, 0, 0, 46, 20, 0, 201, 16, 0, 21, 22, 0, 0, 106, 106, 0, 0, 17, 0, 18, 114, 114, 19, 0, 0, 0, 76, 20, 0, 0, 0, 0, 21, 22, 0, 0, 23, 0, 16, 0, 85, 0, 0, 0, 0, 0, 0, 0, 17, 0, 18, 114, 114, 19, 0, 140, 0, 0, 20, 23, 0, 0, 0, 21, 22, 0, 98, 99, 0, 0, 0, 0, 0, 117, 117, 0, 0, 117, 117, 117, 117, 117, 0, 117, 0, 0, 100, 0, 0, 52, 23, 101, 102, 85, 117, 117, 117, 117, 117, 117, 0, 0, 0, 0, 0, 0, 0, 0, 140, 0, 0, 130, 0, 0, 130, 0, 130, 130, 130, 98, 99, 0, 0, 0, 0, 0, 0, 0, 0, 117, 117, 130, 130, 130, 130, 130, 130, 0, 40, 100, 0, 0, 52, 23, 101, 102, 0, 0, 40, 0, 40, 0, 154, 40, 0, 154, 0, 0, 40, 0, 117, 117, 0, 40, 40, 0, 130, 130, 0, 154, 154, 0, 154, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 0, 106, 106, 130, 130, 0, 0, 0, 0, 0, 154, 0, 0, 0, 0, 0, 0, 0, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 131, 114, 114, 131, 154, 131, 131, 131, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 0, 0, 131, 131, 131, 131, 131, 131, 132, 0, 0, 132, 0, 132, 132, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 132, 132, 132, 132, 132, 132, 0, 0, 0, 131, 131, 0, 0, 0, 0, 0, 0, 0, 41, 38, 0, 0, 0, 0, 0, 0, 38, 0, 41, 0, 41, 0, 41, 41, 0, 132, 132, 38, 41, 38, 131, 131, 38, 41, 41, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 0, 117, 117, 132, 132, 0, 0, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 133, 130, 130, 133, 0, 0, 133, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 133, 133, 133, 133, 133, 0, 0, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 134, 154, 154, 134, 0, 0, 134, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 133, 0, 134, 134, 134, 134, 134, 134, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 133, 0, 0, 0, 0, 0, 134, 134, 0, 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, 134, 134, 0, 0, 0, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 135, 132, 132, 135, 0, 0, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 135, 135, 135, 135, 135, 135, 17, 0, 18, 0, 0, 19, 0, 0, 0, 0, 20, 136, 0, 0, 136, 21, 22, 136, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 135, 135, 136, 136, 136, 136, 136, 136, 0, 0, 0, 0, 0, 23, 0, 0, 0, 0, 0, 0, 139, 0, 0, 139, 0, 0, 139, 0, 0, 0, 0, 135, 135, 0, 0, 0, 0, 136, 136, 0, 139, 139, 139, 139, 139, 139, 0, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 0, 133, 133, 136, 136, 0, 0, 0, 0, 0, 139, 139, 0, 0, 0, 0, 0, 0, 0, 0, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 0, 134, 134, 139, 139, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 33, 0, 33, 0, 0, 33, 0, 0, 0, 0, 33, 140, 0, 0, 140, 33, 33, 140, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 140, 140, 140, 140, 140, 140, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 137, 0, 0, 137, 0, 0, 137, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 140, 140, 137, 137, 137, 137, 137, 137, 0, 0, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 0, 135, 135, 140, 140, 0, 0, 0, 0, 137, 137, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 0, 136, 136, 137, 137, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 138, 139, 139, 138, 0, 0, 138, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 35, 0, 138, 138, 138, 138, 138, 138, 141, 0, 35, 141, 35, 0, 141, 35, 0, 0, 0, 0, 35, 0, 0, 0, 0, 35, 35, 0, 141, 141, 0, 141, 0, 141, 0, 0, 0, 138, 138, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 141, 141, 0, 0, 0, 138, 138, 0, 0, 0, 0, 0, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 0, 140, 140, 141, 141, 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, 142, 137, 137, 142, 0, 0, 142, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 142, 142, 0, 142, 0, 142, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 143, 0, 0, 143, 0, 0, 143, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 142, 142, 0, 143, 143, 0, 143, 0, 143, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 144, 0, 0, 144, 0, 0, 144, 0, 0, 0, 0, 142, 142, 0, 0, 0, 0, 0, 143, 143, 144, 144, 0, 144, 0, 144, 0, 0, 0, 0, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 0, 138, 138, 143, 143, 0, 0, 0, 0, 144, 144, 0, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 145, 141, 141, 145, 0, 0, 145, 0, 0, 0, 0, 0, 0, 0, 144, 144, 0, 0, 0, 146, 145, 145, 146, 145, 0, 145, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 146, 146, 0, 146, 147, 146, 0, 147, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 145, 145, 147, 147, 0, 147, 0, 147, 0, 0, 0, 0, 0, 0, 0, 0, 146, 146, 0, 0, 0, 0, 0, 148, 0, 0, 148, 0, 0, 0, 0, 145, 145, 0, 0, 0, 0, 147, 147, 0, 148, 148, 0, 148, 0, 148, 0, 146, 146, 0, 0, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 0, 142, 142, 147, 147, 0, 0, 0, 0, 0, 148, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 0, 143, 143, 148, 148, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 0, 144, 144, 0, 0, 0, 0, 150, 0, 0, 150, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 150, 150, 0, 150, 0, 150, 0, 0, 0, 0, 0, 0, 149, 0, 0, 149, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 149, 149, 0, 149, 0, 149, 150, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 0, 145, 145, 0, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 149, 146, 146, 150, 0, 0, 0, 0, 0, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 151, 147, 147, 151, 0, 141, 0, 0, 0, 0, 149, 149, 0, 0, 0, 0, 0, 151, 151, 0, 151, 0, 151, 0, 0, 0, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 152, 148, 148, 152, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 151, 0, 153, 152, 152, 153, 152, 0, 152, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 153, 153, 0, 153, 0, 153, 218, 221, 0, 0, 0, 0, 0, 151, 218, 0, 0, 0, 0, 152, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 153, 0, 0, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 0, 264, 152, 266, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 153, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 0, 150, 150, 0, 0, 0, 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, 301, 0, 303, 221, 0, 0, 0, 0, 301, 0, 218, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 0, 151, 151, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 25, 152, 152, 0, 0, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 0, 153, 153, 0, 0, 39, 41, 0, 0, 0, 0, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, 0, 0, 0, 0, 0, 74, 0, 0, 0, 51, 0, 0, 0, 0, 0, 0, 51, 0, 0, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 157, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 230, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 265, }; short yycheck[] = { 42, 0, 42, 41, 42, 63, 91, 40, 58, 93, 151, 146, 40, 33, 271, 47, 97, 169, 44, 44, 40, 44, 9, 43, 105, 45, 285, 286, 41, 44, 145, 44, 147, 75, 44, 150, 59, 41, 40, 59, 46, 98, 99, 38, 41, 58, 59, 104, 44, 59, 107, 108, 109, 309, 169, 59, 10, 60, 53, 62, 44, 142, 59, 59, 145, 146, 147, 148, 209, 150, 76, 257, 33, 27, 69, 10, 44, 43, 66, 40, 93, 267, 43, 269, 45, 73, 272, 44, 169, 93, 58, 277, 27, 59, 37, 44, 282, 283, 59, 42, 123, 40, 59, 123, 47, 41, 126, 149, 44, 190, 59, 41, 125, 41, 44, 172, 173, 174, 105, 271, 41, 308, 43, 110, 257, 258, 267, 41, 33, 161, 123, 272, 265, 59, 267, 40, 269, 289, 43, 272, 45, 287, 288, 276, 277, 278, 291, 292, 281, 282, 283, 43, 293, 45, 59, 270, 297, 41, 42, 258, 177, 178, 123, 258, 125, 126, 265, 175, 176, 310, 265, 183, 184, 314, 59, 40, 309, 276, 313, 278, 58, 276, 281, 278, 33, 300, 281, 328, 59, 270, 271, 40, 40, 40, 43, 40, 45, 40, 40, 284, 179, 180, 181, 182, 40, 38, 94, 124, 289, 305, 59, 293, 44, 59, 41, 59, 41, 41, 123, 300, 125, 126, 306, 44, 59, 282, 263, 125, 58, 44, 93, 41, 313, 40, 93, 306, 294, 40, 58, 259, 260, 58, 262, 263, 264, 41, 266, 41, 268, 41, 270, 59, 261, 273, 274, 275, 306, 299, 257, 279, 280, 41, 93, 41, 41, 285, 286, 41, 267, 309, 269, 309, 271, 272, 123, 308, 125, 126, 277, 321, 308, 307, 307, 282, 283, 305, 289, 290, 308, 309, 310, 311, 307, 306, 307, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 309, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 307, 285, 286, 59, 41, 41, 41, 33, 59, 123, 93, 41, 125, 306, 40, 125, 93, 43, 41, 45, 125, 305, 93, 93, 308, 309, 310, 311, 256, 257, 258, 259, 260, 41, 262, 263, 264, 265, 266, 267, 268, 269, 270, 81, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 81, 285, 286, 53, 33, 56, 47, 24, 44, 91, 186, 40, 166, 185, 43, 189, 45, 290, 159, 187, 280, 305, 287, 188, 308, 309, 310, 311, 256, -1, 258, 259, 260, -1, 262, 263, 264, 265, 266, -1, 268, 123, 270, -1, 126, 273, 274, 275, 276, -1, 278, 279, 280, 281, -1, -1, -1, 285, 286, -1, -1, -1, -1, 37, 38, -1, 40, 41, 42, 43, 44, 45, -1, 47, -1, -1, -1, 305, -1, -1, 308, 309, 310, 311, 58, 59, 60, 61, 62, 63, -1, -1, -1, -1, -1, -1, -1, 126, -1, -1, -1, 37, 38, -1, -1, 41, 42, 43, 44, 45, -1, 47, -1, -1, -1, -1, -1, 91, -1, 93, 94, 257, 58, 59, 60, 61, 62, 63, -1, -1, -1, 267, -1, 269, -1, -1, 272, -1, -1, -1, 276, 277, -1, 61, 257, -1, 282, 283, -1, -1, 124, 125, -1, -1, 267, -1, 269, 93, 94, 272, -1, -1, -1, 276, 277, -1, -1, -1, -1, 282, 283, -1, -1, 309, -1, 257, -1, 259, -1, -1, -1, -1, -1, -1, -1, 267, -1, 269, 124, 125, 272, -1, 274, -1, -1, 277, 309, -1, -1, -1, 282, 283, -1, 285, 286, -1, -1, -1, -1, -1, 37, 38, -1, -1, 41, 42, 43, 44, 45, -1, 47, -1, -1, 305, -1, -1, 308, 309, 310, 311, 259, 58, 59, 60, 61, 62, 63, -1, -1, -1, -1, -1, -1, -1, -1, 274, -1, -1, 38, -1, -1, 41, -1, 43, 44, 45, 285, 286, -1, -1, -1, -1, -1, -1, -1, -1, 93, 94, 58, 59, 60, 61, 62, 63, -1, 257, 305, -1, -1, 308, 309, 310, 311, -1, -1, 267, -1, 269, -1, 41, 272, -1, 44, -1, -1, 277, -1, 124, 125, -1, 282, 283, -1, 93, 94, -1, 58, 59, -1, 61, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, -1, 306, 307, 124, 125, -1, -1, -1, -1, -1, 93, -1, -1, -1, -1, -1, -1, -1, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 38, 306, 307, 41, 125, 43, 44, 45, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, -1, -1, 58, 59, 60, 61, 62, 63, 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, -1, -1, -1, 93, 94, -1, -1, -1, -1, -1, -1, -1, 257, 258, -1, -1, -1, -1, -1, -1, 265, -1, 267, -1, 269, -1, 271, 272, -1, 93, 94, 276, 277, 278, 124, 125, 281, 282, 283, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, -1, 306, 307, 124, 125, -1, -1, 309, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 38, 306, 307, 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, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 38, 306, 307, 41, -1, -1, 44, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 93, 94, -1, 58, 59, 60, 61, 62, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 124, 125, -1, -1, -1, -1, -1, 93, 94, -1, -1, -1, -1, -1, -1, -1, -1, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, -1, 306, 307, 124, 125, -1, -1, -1, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 38, 306, 307, 41, -1, -1, 44, -1, -1, -1, -1, -1, -1, -1, -1, -1, 257, -1, -1, -1, 58, 59, 60, 61, 62, 63, 267, -1, 269, -1, -1, 272, -1, -1, -1, -1, 277, 38, -1, -1, 41, 282, 283, 44, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 93, 94, 58, 59, 60, 61, 62, 63, -1, -1, -1, -1, -1, 309, -1, -1, -1, -1, -1, -1, 38, -1, -1, 41, -1, -1, 44, -1, -1, -1, -1, 124, 125, -1, -1, -1, -1, 93, 94, -1, 58, 59, 60, 61, 62, 63, -1, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, -1, 306, 307, 124, 125, -1, -1, -1, -1, -1, 93, 94, -1, -1, -1, -1, -1, -1, -1, -1, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, -1, 306, 307, 124, 125, 257, -1, -1, -1, -1, -1, -1, -1, -1, -1, 267, -1, 269, -1, -1, 272, -1, -1, -1, -1, 277, 38, -1, -1, 41, 282, 283, 44, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 58, 59, 60, 61, 62, 63, -1, -1, -1, -1, -1, 309, -1, -1, -1, -1, -1, 38, -1, -1, 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, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, -1, 306, 307, 124, 125, -1, -1, -1, -1, 93, 94, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, -1, 306, 307, 124, 125, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 38, 306, 307, 41, -1, -1, 44, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 257, -1, 58, 59, 60, 61, 62, 63, 38, -1, 267, 41, 269, -1, 44, 272, -1, -1, -1, -1, 277, -1, -1, -1, -1, 282, 283, -1, 58, 59, -1, 61, -1, 63, -1, -1, -1, 93, 94, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 309, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 93, 94, -1, -1, -1, 124, 125, -1, -1, -1, -1, -1, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, -1, 306, 307, 124, 125, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 38, 306, 307, 41, -1, -1, 44, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 58, 59, -1, 61, -1, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 38, -1, -1, 41, -1, -1, 44, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 93, 94, -1, 58, 59, -1, 61, -1, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 38, -1, -1, 41, -1, -1, 44, -1, -1, -1, -1, 124, 125, -1, -1, -1, -1, -1, 93, 94, 58, 59, -1, 61, -1, 63, -1, -1, -1, -1, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, -1, 306, 307, 124, 125, -1, -1, -1, -1, 93, 94, -1, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 38, 306, 307, 41, -1, -1, 44, -1, -1, -1, -1, -1, -1, -1, 124, 125, -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, 94, 58, 59, -1, 61, -1, 63, -1, -1, -1, -1, -1, -1, -1, -1, 93, 94, -1, -1, -1, -1, -1, 41, -1, -1, 44, -1, -1, -1, -1, 124, 125, -1, -1, -1, -1, 93, 94, -1, 58, 59, -1, 61, -1, 63, -1, 124, 125, -1, -1, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, -1, 306, 307, 124, 125, -1, -1, -1, -1, -1, 93, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, -1, 306, 307, 124, 125, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, -1, 306, 307, -1, -1, -1, -1, 41, -1, -1, 44, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 58, 59, -1, 61, -1, 63, -1, -1, -1, -1, -1, -1, 41, -1, -1, 44, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 58, 59, -1, 61, -1, 63, 93, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, -1, 306, 307, -1, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 93, 306, 307, 125, -1, -1, -1, -1, -1, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 41, 306, 307, 44, -1, 87, -1, -1, -1, -1, 124, 125, -1, -1, -1, -1, -1, 58, 59, -1, 61, -1, 63, -1, -1, -1, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 41, 306, 307, 44, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 93, -1, 41, 58, 59, 44, 61, -1, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 58, 59, -1, 61, -1, 63, 159, 160, -1, -1, -1, -1, -1, 125, 167, -1, -1, -1, -1, 93, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 93, -1, -1, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, -1, 203, 125, 205, -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, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, -1, 306, 307, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, -1, 306, 307, -1, 277, -1, 279, 280, -1, -1, -1, -1, 285, -1, 287, -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, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, -1, 306, 307, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 9, 306, 307, -1, -1, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, -1, 306, 307, -1, -1, 30, 31, -1, -1, -1, -1, 36, -1, -1, -1, -1, -1, -1, -1, -1, -1, 46, -1, -1, -1, -1, -1, -1, -1, -1, -1, 56, -1, -1, -1, -1, -1, 62, -1, -1, -1, 66, -1, -1, -1, -1, -1, -1, 73, -1, -1, 76, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 100, -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, 168, -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, 204, }; #define YYFINAL 1 #ifndef YYDEBUG #define YYDEBUG 0 #endif #define YYMAXTOKEN 316 #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","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 : opt_private 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", "formals_declaration : VARARGS formal_declaration_list", "formals_declaration : VARARGS formal_declaration_list ELLIPSIS", "formals_declaration : formal_declaration_list ',' VARARGS formal_declaration_list", "formals_declaration : formal_declaration_list ',' VARARGS 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 : 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 : 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 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 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 778 "parser.y" /* * NAME: varargs() * DESCRIPTION: deal with varargs in a formals declaration */ static node *varargs(n1, n2) register node *n1, *n2; { register node *n; if (n1->type == N_PAIR) { n1->r.right->mod |= T_VARARGS; } else { n1->mod |= T_VARARGS; } if (n2->type == N_PAIR) { for (n = n2; n->l.left->type == N_PAIR; n = n->l.left) ; n->l.left = node_bin(N_PAIR, 0, n1, n->l.left); return n2; } else { return node_bin(N_PAIR, 0, n1, n2); } } /* * 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; 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(buffer, n->mod)); } else if ((type & T_TYPE) == T_VOID) { c_error("cannot cast to %s", i_typename(buffer, type)); n->mod = T_MIXED; } else if ((type & T_REF) < (n->mod & T_REF)) { c_error("illegal cast of array type (%s)", i_typename(buffer, 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; { 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 */ 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(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 | 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; { 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, 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_NIL) { 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_STRING || type == T_OBJECT || type == T_MAPPING || type == T_NIL) { 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; } } } 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; { 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) { 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 2059 "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].type, yyvsp[-1].node); } break; case 16: #line 185 "parser.y" { typechecking = TRUE; c_function(yyvsp[-2].type, yyvsp[-1].type, 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, (typechecking) ? T_VOID : T_NIL, node_bin(N_FUNC, 0, yyvsp[-3].node, yyvsp[-1].node)); } break; case 19: #line 202 "parser.y" { if (nerrors == 0) { c_funcbody(yyvsp[0].node); } } break; case 20: #line 211 "parser.y" { c_local(yyvsp[-3].type, yyvsp[-2].type, yyvsp[-1].node); } break; case 21: #line 216 "parser.y" { yyval.node = (node *) NULL; } break; case 22: #line 217 "parser.y" { yyval.node = (node *) NULL; } break; case 24: #line 220 "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 25: #line 229 "parser.y" { yyval.node = yyvsp[0].node; yyval.node->flags |= F_VARARGS; } break; case 26: #line 234 "parser.y" { yyval.node = yyvsp[-1].node; yyval.node->flags |= F_VARARGS; if (yyval.node->type == N_PAIR) { yyval.node->r.right->mod |= T_ELLIPSIS; } else { yyval.node->mod |= T_ELLIPSIS; } } break; case 27: #line 244 "parser.y" { yyval.node = varargs(yyvsp[-3].node, yyvsp[0].node); } break; case 28: #line 246 "parser.y" { yyval.node = varargs(yyvsp[-4].node, yyvsp[-1].node); yyval.node->r.right->mod |= T_ELLIPSIS; } break; case 30: #line 255 "parser.y" { yyval.node = node_bin(N_PAIR, 0, yyvsp[-2].node, yyvsp[0].node); } break; case 31: #line 260 "parser.y" { yyval.node = yyvsp[0].node; yyval.node->mod |= yyvsp[-1].type; } break; case 32: #line 264 "parser.y" { yyval.node = yyvsp[0].node; yyval.node->mod = T_NIL; /* only if typechecking, though */ } break; case 35: #line 274 "parser.y" { yyval.type = yyvsp[-1].type | yyvsp[0].type; } break; case 37: #line 280 "parser.y" { yyval.type = yyvsp[-1].type | yyvsp[0].type; } break; case 38: #line 285 "parser.y" { yyval.type = C_STATIC | C_PRIVATE; } break; case 40: #line 291 "parser.y" { yyval.type = 0; } break; case 41: #line 293 "parser.y" { yyval.type = C_STATIC | C_PRIVATE; } break; case 42: #line 298 "parser.y" { yyval.type = C_STATIC; } break; case 43: #line 300 "parser.y" { yyval.type = C_ATOMIC; } break; case 44: #line 302 "parser.y" { yyval.type = C_NOMASK; } break; case 45: #line 304 "parser.y" { yyval.type = C_VARARGS; } break; case 46: #line 308 "parser.y" { yyval.type = T_INT; } break; case 47: #line 309 "parser.y" { yyval.type = T_FLOAT; } break; case 48: #line 311 "parser.y" { yyval.type = T_STRING; } break; case 49: #line 313 "parser.y" { yyval.type = T_OBJECT; } break; case 50: #line 315 "parser.y" { yyval.type = T_MAPPING; } break; case 51: #line 316 "parser.y" { yyval.type = T_MIXED; } break; case 52: #line 317 "parser.y" { yyval.type = T_VOID; } break; case 53: #line 322 "parser.y" { yyval.type = 0; } break; case 54: #line 324 "parser.y" { yyval.type = yyvsp[-1].type + 1; if (yyval.type == 1 << (8 - REFSHIFT)) { c_error("too deep indirection"); } } break; case 55: #line 334 "parser.y" { yyval.node = yyvsp[0].node; yyval.node->mod = (yyvsp[-1].type << REFSHIFT) & T_REF; } break; case 56: #line 342 "parser.y" { yyval.node = node_bin(N_FUNC, (yyvsp[-4].type << REFSHIFT) & T_REF, yyvsp[-3].node, yyvsp[-1].node); } break; case 60: #line 353 "parser.y" { yyval.node = node_bin(N_PAIR, 0, yyvsp[-2].node, yyvsp[0].node); } break; case 61: #line 358 "parser.y" { yyval.node = (node *) NULL; } break; case 62: #line 360 "parser.y" { yyval.node = c_concat(yyvsp[-1].node, yyvsp[0].node); } break; case 63: #line 365 "parser.y" { if (nstatements > 0) { c_error("declaration after statement"); } yyval.node = (node *) NULL; } break; case 64: #line 371 "parser.y" { nstatements++; yyval.node = yyvsp[0].node; } break; case 65: #line 376 "parser.y" { if (nerrors >= MAX_ERRORS) { YYABORT; } yyval.node = (node *) NULL; } break; case 66: #line 386 "parser.y" { yyval.node = c_exp_stmt(yyvsp[-1].node); } break; case 68: #line 389 "parser.y" { yyval.node = c_if(yyvsp[-2].node, yyvsp[0].node, (node *) NULL); } break; case 69: #line 392 "parser.y" { yyval.node = c_if(yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); } break; case 70: #line 393 "parser.y" { c_loop(); } break; case 71: #line 395 "parser.y" { yyval.node = c_do(yyvsp[-2].node, yyvsp[-5].node); } break; case 72: #line 397 "parser.y" { c_loop(); } break; case 73: #line 398 "parser.y" { yyval.node = c_while(yyvsp[-3].node, yyvsp[0].node); } break; case 74: #line 400 "parser.y" { c_loop(); } break; case 75: #line 401 "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 76: #line 403 "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 77: #line 419 "parser.y" { yyval.node = c_endrlimits(yyvsp[-5].node, yyvsp[-3].node, yyvsp[0].node); } break; case 78: #line 420 "parser.y" { c_startcatch(); } break; case 79: #line 422 "parser.y" { c_endcatch(); } break; case 80: #line 424 "parser.y" { yyval.node = c_donecatch(yyvsp[-2].node, yyvsp[0].node); } break; case 81: #line 426 "parser.y" { c_startswitch(yyvsp[-1].node, typechecking); } break; case 82: #line 428 "parser.y" { yyval.node = c_endswitch(yyvsp[-3].node, yyvsp[0].node); } break; case 83: #line 430 "parser.y" { yyvsp[-1].node = c_case(yyvsp[-1].node, (node *) NULL); } break; case 84: #line 431 "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 85: #line 440 "parser.y" { yyvsp[-3].node = c_case(yyvsp[-3].node, yyvsp[-1].node); } break; case 86: #line 441 "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 87: #line 450 "parser.y" { yyvsp[0].node = c_default(); } break; case 88: #line 451 "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 89: #line 460 "parser.y" { yyval.node = c_break(); } break; case 90: #line 464 "parser.y" { yyval.node = c_continue(); } break; case 91: #line 468 "parser.y" { yyval.node = c_return(yyvsp[-1].node, typechecking); } break; case 92: #line 469 "parser.y" { yyval.node = (node *) NULL; } break; case 93: #line 473 "parser.y" { nstatements = 0; c_startcompound(); } break; case 94: #line 478 "parser.y" { nstatements = 1; /* any non-zero value will do */ yyval.node = c_endcompound(yyvsp[-1].node); } break; case 95: #line 486 "parser.y" { yyval.node = (node *) NULL; } break; case 96: #line 488 "parser.y" { yyval.node = yyvsp[0].node; } break; case 97: #line 492 "parser.y" { yyval.node = c_flookup(yyvsp[0].node, typechecking); } break; case 98: #line 494 "parser.y" { yyval.node = c_iflookup(yyvsp[0].node, (node *) NULL); } break; case 99: #line 496 "parser.y" { yyval.node = c_iflookup(yyvsp[0].node, yyvsp[-2].node); } break; case 100: #line 501 "parser.y" { yyval.node = node_int(yyvsp[0].number); } break; case 101: #line 503 "parser.y" { yyval.node = node_float(&yyvsp[0].real); } break; case 102: #line 504 "parser.y" { yyval.node = node_nil(); } break; case 104: #line 507 "parser.y" { yyval.node = c_aggregate(yyvsp[-2].node, T_MIXED | (1 << REFSHIFT)); } break; case 105: #line 509 "parser.y" { yyval.node = c_aggregate(yyvsp[-2].node, T_MAPPING); } break; case 106: #line 510 "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 107: #line 527 "parser.y" { yyval.node = yyvsp[-1].node; } break; case 108: #line 529 "parser.y" { yyval.node = c_checkcall(c_funcall(yyvsp[-3].node, yyvsp[-1].node), typechecking); } break; case 109: #line 531 "parser.y" { yyval.node = node_mon(N_CATCH, T_STRING, yyvsp[-1].node); } break; case 110: #line 533 "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 112: #line 542 "parser.y" { yyval.node = idx(yyvsp[-3].node, yyvsp[-1].node); } break; case 113: #line 544 "parser.y" { yyval.node = range(yyvsp[-5].node, yyvsp[-3].node, yyvsp[-1].node); } break; case 115: #line 550 "parser.y" { yyval.node = uassign(N_PLUS_PLUS, yyvsp[-1].node, "++"); } break; case 116: #line 552 "parser.y" { yyval.node = uassign(N_MIN_MIN, yyvsp[-1].node, "--"); } break; case 118: #line 558 "parser.y" { yyval.node = uassign(N_ADD_EQ_1, yyvsp[0].node, "++"); } break; case 119: #line 560 "parser.y" { yyval.node = uassign(N_SUB_EQ_1, yyvsp[0].node, "--"); } break; case 120: #line 562 "parser.y" { yyval.node = umin(yyvsp[0].node); } break; case 121: #line 564 "parser.y" { yyval.node = node_mon(N_UPLUS, yyvsp[0].node->mod, yyvsp[0].node); } break; case 122: #line 566 "parser.y" { t_void(yyvsp[0].node); yyval.node = c_not(yyvsp[0].node); } break; case 123: #line 571 "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 125: #line 589 "parser.y" { yyval.node = cast(yyvsp[0].node, yyvsp[-3].type | ((yyvsp[-2].type << REFSHIFT) & T_REF)); } break; case 127: #line 595 "parser.y" { yyval.node = mult(N_MULT, yyvsp[-2].node, yyvsp[0].node, "*"); } break; case 128: #line 597 "parser.y" { yyval.node = mdiv(N_DIV, yyvsp[-2].node, yyvsp[0].node, "/"); } break; case 129: #line 599 "parser.y" { yyval.node = mod(N_MOD, yyvsp[-2].node, yyvsp[0].node, "%"); } break; case 131: #line 605 "parser.y" { yyval.node = add(N_ADD, yyvsp[-2].node, yyvsp[0].node, "+"); } break; case 132: #line 607 "parser.y" { yyval.node = sub(N_SUB, yyvsp[-2].node, yyvsp[0].node, "-"); } break; case 134: #line 613 "parser.y" { yyval.node = lshift(N_LSHIFT, yyvsp[-2].node, yyvsp[0].node, "<<"); } break; case 135: #line 615 "parser.y" { yyval.node = rshift(N_RSHIFT, yyvsp[-2].node, yyvsp[0].node, ">>"); } break; case 137: #line 621 "parser.y" { yyval.node = rel(N_LT, yyval.node, yyvsp[0].node, "<"); } break; case 138: #line 623 "parser.y" { yyval.node = rel(N_GT, yyval.node, yyvsp[0].node, ">"); } break; case 139: #line 625 "parser.y" { yyval.node = rel(N_LE, yyval.node, yyvsp[0].node, "<="); } break; case 140: #line 627 "parser.y" { yyval.node = rel(N_GE, yyval.node, yyvsp[0].node, ">="); } break; case 142: #line 633 "parser.y" { yyval.node = eq(yyvsp[-2].node, yyvsp[0].node); } break; case 143: #line 635 "parser.y" { yyval.node = c_not(eq(yyvsp[-2].node, yyvsp[0].node)); } break; case 145: #line 641 "parser.y" { yyval.node = and(N_AND, yyvsp[-2].node, yyvsp[0].node, "&"); } break; case 147: #line 647 "parser.y" { yyval.node = xor(N_XOR, yyvsp[-2].node, yyvsp[0].node, "^"); } break; case 149: #line 653 "parser.y" { yyval.node = or(N_OR, yyvsp[-2].node, yyvsp[0].node, "|"); } break; case 151: #line 659 "parser.y" { yyval.node = land(yyvsp[-2].node, yyvsp[0].node); } break; case 153: #line 665 "parser.y" { yyval.node = lor(yyvsp[-2].node, yyvsp[0].node); } break; case 155: #line 671 "parser.y" { yyval.node = quest(yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); } break; case 157: #line 677 "parser.y" { yyval.node = assign(c_lvalue(yyvsp[-2].node, "assignment"), yyvsp[0].node); } break; case 158: #line 679 "parser.y" { yyval.node = add(N_ADD_EQ, c_lvalue(yyvsp[-2].node, "+="), yyvsp[0].node, "+="); } break; case 159: #line 681 "parser.y" { yyval.node = sub(N_SUB_EQ, c_lvalue(yyvsp[-2].node, "-="), yyvsp[0].node, "-="); } break; case 160: #line 683 "parser.y" { yyval.node = mult(N_MULT_EQ, c_lvalue(yyvsp[-2].node, "*="), yyvsp[0].node, "*="); } break; case 161: #line 685 "parser.y" { yyval.node = mdiv(N_DIV_EQ, c_lvalue(yyvsp[-2].node, "/="), yyvsp[0].node, "/="); } break; case 162: #line 687 "parser.y" { yyval.node = mod(N_MOD_EQ, c_lvalue(yyvsp[-2].node, "%="), yyvsp[0].node, "%="); } break; case 163: #line 689 "parser.y" { yyval.node = lshift(N_LSHIFT_EQ, c_lvalue(yyvsp[-2].node, "<<="), yyvsp[0].node, "<<="); } break; case 164: #line 691 "parser.y" { yyval.node = rshift(N_RSHIFT_EQ, c_lvalue(yyvsp[-2].node, ">>="), yyvsp[0].node, ">>="); } break; case 165: #line 693 "parser.y" { yyval.node = and(N_AND_EQ, c_lvalue(yyvsp[-2].node, "&="), yyvsp[0].node, "&="); } break; case 166: #line 695 "parser.y" { yyval.node = xor(N_XOR_EQ, c_lvalue(yyvsp[-2].node, "^="), yyvsp[0].node, "^="); } break; case 167: #line 697 "parser.y" { yyval.node = or(N_OR_EQ, c_lvalue(yyvsp[-2].node, "|="), yyvsp[0].node, "|="); } break; case 169: #line 703 "parser.y" { yyval.node = comma(yyvsp[-2].node, yyvsp[0].node); } break; case 170: #line 708 "parser.y" { yyval.node = (node *) NULL; } break; case 172: #line 714 "parser.y" { t_void(yyval.node = yyvsp[0].node); } break; case 173: #line 719 "parser.y" { t_void(yyval.node = yyvsp[0].node); } break; case 174: #line 723 "parser.y" { t_void(yyval.node = yyvsp[0].node); } break; case 175: #line 725 "parser.y" { t_void(yyvsp[0].node); yyval.node = node_bin(N_PAIR, 0, yyvsp[-2].node, yyvsp[0].node); } break; case 176: #line 733 "parser.y" { yyval.node = (node *) NULL; } break; case 178: #line 736 "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 179: #line 748 "parser.y" { yyval.node = (node *) NULL; } break; case 181: #line 751 "parser.y" { yyval.node = yyvsp[-1].node; } break; case 182: #line 756 "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 184: #line 766 "parser.y" { yyval.node = node_bin(N_PAIR, 0, yyvsp[-2].node, yyvsp[0].node); } break; case 185: #line 771 "parser.y" { yyval.node = (node *) NULL; } break; case 187: #line 774 "parser.y" { yyval.node = yyvsp[-1].node; } break; #line 2980 "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); }