home *** CD-ROM | disk | FTP | other *** search
- extern char *malloc(), *realloc();
-
- # line 19 "parser.y"
- #ifndef lint
- #define lint
- #endif
- #define defTycon(n,l,lhs,rhs,w) tyconDefn(intOf(l),lhs,rhs,w); sp-=n
- #define sigdecl(l,vs,t) ap(SIGDECL,triple(l,vs,t))
- #define grded(gs) ap(GUARDED,gs)
- #define letrec(bs,e) (nonNull(bs) ? ap(LETREC,pair(bs,e)) : e)
- #define yyerror(s) /* errors handled elsewhere */
- #define YYSTYPE Cell
-
- static Cell local gcShadow Args((Int,Cell));
- static Void local syntaxError Args((String));
- static String local unexpected Args((Void));
- static Cell local checkPrec Args((Cell));
- static Void local fixDefn Args((Syntax,Cell,Cell,List));
- static Void local setSyntax Args((Int,Syntax,Cell));
- #if MAC
- Cell local buildTuple Args((List));
- #else
- static Cell local buildTuple Args((List));
- #endif
- static Cell local checkClass Args((Cell));
- static List local checkContext Args((List));
- static Cell local tidyInfix Args((Cell));
-
- /* For the purposes of reasonably portable garbage collection, it is
- * necessary to simulate the YACC stack on the Gofer stack to keep
- * track of all intermediate constructs. The lexical analyser
- * pushes a token onto the stack for each token that is found, with
- * these elements being removed as reduce actions are performed,
- * taking account of look-ahead tokens as described by gcShadow()
- * below.
- *
- * Of the non-terminals used below, only start, topDecl & begin do not leave
- * any values on the Gofer stack. The same is true for the terminals
- * EVALEX and SCRIPT. At the end of a successful parse, there should only
- * be one element left on the stack, containing the result of the parse.
- */
-
- #define gc0(e) gcShadow(0,e)
- #define gc1(e) gcShadow(1,e)
- #define gc2(e) gcShadow(2,e)
- #define gc3(e) gcShadow(3,e)
- #define gc4(e) gcShadow(4,e)
- #define gc5(e) gcShadow(5,e)
- #define gc6(e) gcShadow(6,e)
- #define gc7(e) gcShadow(7,e)
-
- # define EVALEX 257
- # define SCRIPT 258
- # define COCO 259
- # define INFIXL 260
- # define INFIXR 261
- # define INFIX 262
- # define FUNARROW 263
- # define UPTO 264
- # define CASEXP 265
- # define OF 266
- # define IF 267
- # define THEN 268
- # define ELSE 269
- # define WHERE 270
- # define TYPE 271
- # define DATA 272
- # define FROM 273
- # define LET 274
- # define IN 275
- # define VAROP 276
- # define VARID 277
- # define NUMLIT 278
- # define CHARLIT 279
- # define STRINGLIT 280
- # define REPEAT 281
- # define CONOP 282
- # define CONID 283
- # define TCLASS 284
- # define IMPLIES 285
- # define TINSTANCE 286
- # define DO 287
- # define END 288
- # define PRIMITIVE 289
- # define DEFAULT 290
- # define DERIVING 291
- # define HIDING 292
- # define IMPORT 293
- # define INTERFACE 294
- # define MODULE 295
- # define RENAMING 296
- # define TO 297
- #define yyclearin yychar = -1
- #define yyerrok yyerrflag = 0
- extern int yychar;
- extern int yyerrflag;
- #ifndef YYMAXDEPTH
- #define YYMAXDEPTH 150
- #endif
- #ifndef YYSTYPE
- #define YYSTYPE int
- #endif
- YYSTYPE yylval, yyval;
- # define YYERRCODE 256
-
- # line 513 "parser.y"
-
-
- static Cell local gcShadow(n,e) /* keep parsed fragments on stack */
- Int n;
- Cell e; {
- /* If a look ahead token is held then the required stack transformation
- * is:
- * pushed: n 1 0 1 0
- * x1 | ... | xn | la ===> e | la
- * top() top()
- *
- * Othwerwise, the transformation is:
- * pushed: n-1 0 0
- * x1 | ... | xn ===> e
- * top() top()
- */
- if (yychar>=0) {
- pushed(n-1) = top();
- pushed(n) = e;
- }
- else
- pushed(n-1) = e;
- sp -= (n-1);
- return e;
- }
-
- static Void local syntaxError(s) /* report on syntax error */
- String s; {
- ERROR(row) "Syntax error in %s (unexpected %s)", s, unexpected()
- EEND;
- }
-
- static String local unexpected() { /* find name for unexpected token */
- static char buffer[100];
- static char *fmt = "%s \"%s\"";
- static char *kwd = "keyword";
- static char *hkw = "(Haskell) keyword";
-
- switch (yychar) {
- case 0 : return "end of input";
-
- #define keyword(kw) sprintf(buffer,fmt,kwd,kw); return buffer;
- case INFIXL : keyword("infixl");
- case INFIXR : keyword("infixr");
- case INFIX : keyword("infix");
- case TINSTANCE : keyword("instance");
- case TCLASS : keyword("class");
- case PRIMITIVE : keyword("primitive");
- case CASEXP : keyword("case");
- case OF : keyword("of");
- case DO : keyword("do");
- case END : keyword("end");
- case IF : keyword("if");
- case THEN : keyword("then");
- case ELSE : keyword("else");
- case WHERE : keyword("where");
- case TYPE : keyword("type");
- case DATA : keyword("data");
- case LET : keyword("let");
- case IN : keyword("in");
- #undef keyword
-
- #define hasword(kw) sprintf(buffer,fmt,hkw,kw); return buffer;
- case DEFAULT : hasword("default");
- case DERIVING : hasword("deriving");
- case HIDING : hasword("hiding");
- case IMPORT : hasword("import");
- case INTERFACE : hasword("interface");
- case MODULE : hasword("module");
- case RENAMING : hasword("renaming");
- case TO : hasword("to");
- #undef hasword
-
- case FUNARROW : return "`->'";
- case '=' : return "`='";
- case COCO : return "`::'";
- case '-' : return "`-'";
- case ',' : return "comma";
- case '@' : return "`@'";
- case '(' : return "`('";
- case ')' : return "`)'";
- case '|' : return "`|'";
- case ';' : return "`;'";
- case UPTO : return "`..'";
- case '[' : return "`['";
- case ']' : return "`]'";
- case FROM : return "`<-'";
- case '\\' : return "backslash (lambda)";
- case '~' : return "tilde";
- case '`' : return "backquote";
- case VAROP :
- case VARID :
- case CONOP :
- case CONID : sprintf(buffer,"symbol \"%s\"",
- textToStr(textOf(yylval)));
- return buffer;
- case NUMLIT : return "numeric literal";
- case CHARLIT : return "character literal";
- case STRINGLIT : return "string literal";
- case IMPLIES : return "`=>";
- default : return "token";
- }
- }
-
- static Cell local checkPrec(p) /* Check for valid precedence value */
- Cell p; {
- if (!isInt(p) || intOf(p)<MIN_PREC || intOf(p)>MAX_PREC) {
- ERROR(row) "Precedence value must be an integer in the range [%d..%d]",
- MIN_PREC, MAX_PREC
- EEND;
- }
- return p;
- }
-
- static Void local fixDefn(a,line,p,ops)/* Declare syntax of operators */
- Syntax a;
- Cell line;
- Cell p;
- List ops; {
- Int l = intOf(line);
- a = mkSyntax(a,intOf(p));
- map2Proc(setSyntax,l,a,ops);
- }
-
- static Void local setSyntax(line,sy,op)/* set syntax of individ. operator */
- Int line;
- Syntax sy;
- Cell op; {
- addSyntax(line,textOf(op),sy);
- opDefns = cons(op,opDefns);
- }
-
- #if MAC
- Cell local buildTuple(tup)
- #else
- static Cell local buildTuple(tup) /* build tuple (x1,...,xn) from list*/
- #endif
- List tup; { /* [xn,...,x1] */
- Int n = 0;
- Cell t = tup;
- Cell x;
-
- do { /* . . */
- x = fst(t); /* / \ / \ */
- fst(t) = snd(t); /* xn . . xn */
- snd(t) = x; /* . ===> . */
- x = t; /* . . */
- t = fun(x); /* . . */
- n++; /* / \ / \ */
- } while (nonNull(t)); /* x1 NIL (n) x1 */
- fst(x) = mkTuple(n);
- return tup;
- }
-
- /* The yacc parser presented above is not sufficiently powerful to
- * determine whether a tuple at the front of a sigType is part of a
- * context: e.g. (Eq a, Num a) => a -> a -> a
- * or a type: e.g. (Tree a, Tree a) -> Tree a
- *
- * Rather than complicate the grammar, both are parsed as tuples of types,
- * using the following checks afterwards to ensure that the correct syntax
- * is used in the case of a tupled context.
- */
-
- static List local checkContext(con) /* validate type class context */
- Type con; {
- if (con==UNIT) /* allows empty context () */
- return NIL;
- else if (whatIs(getHead(con))==TUPLE) {
- List qs = NIL;
-
- while (isAp(con)) { /* undo work of buildTuple :-( */
- Cell temp = fun(con);
- fun(con) = arg(con);
- arg(con) = qs;
- qs = con;
- con = temp;
- checkClass(hd(qs));
- }
- return qs;
- }
- else /* single context expression */
- return singleton(checkClass(con));
- }
-
- static Cell local checkClass(c) /* check that type expr is a class */
- Cell c; { /* constrnt of the form C t1 .. tn */
- Cell cn = getHead(c);
-
- if (!isCon(cn))
- syntaxError("class expression");
- else if (argCount<1) {
- ERROR(row) "Class \"%s\" must have at least one argument",
- textToStr(textOf(cn))
- EEND;
- }
- return c;
- }
-
- /* expressions involving a sequence of two or more infix operator symbols
- * are parsed as elements of type:
- * InfixExpr ::= [Expr]
- * | ap(ap(Operator,InfixExpr),Expr)
- *
- * thus x0 +1 x1 ... +n xn is parsed as: +n (....(+1 [x0] x1)....) xn
- *
- * Once the expression has been completely parsed, this parsed form is
- * `tidied' according to the precedences and associativities declared for
- * each operator symbol.
- *
- * The tidy process uses a `stack' of type:
- * TidyStack ::= ap(ap(Operator,TidyStack),Expr)
- * | NIL
- * when the ith layer of an InfixExpr has been transferred to the stack, the
- * stack is of the form: +i (....(+n NIL xn)....) xi
- *
- * The tidy function is based on a simple shift-reduce parser:
- *
- * tidy :: InfixExpr -> TidyStack -> Expr
- * tidy [m] ss = foldl (\x f-> f x) m ss
- * tidy (m*n) [] = tidy m [(*n)]
- * tidy (m*n) ((+o):ss)
- * | amb = error "Ambiguous"
- * | shift = tidy m ((*n):(+o):ss)
- * | reduce = tidy (m*(n+o)) ss
- * where sye = syntaxOf (*)
- * (ae,pe) = sye
- * sys = syntaxOf (+)
- * (as,ps) = sys
- * amb = pe==ps && (ae/=as || ae==NON_ASS)
- * shift = pe>ps || (ps==pe && ae==LEFT_ASS)
- * reduce = otherwise
- *
- * N.B. the conditions amb, shift, reduce are NOT mutually exclusive and
- * must be tested in that order.
- *
- * As a concession to efficiency, we lower the number of calls to syntaxOf
- * by keeping track of the values of sye, sys throughout the process. The
- * value APPLIC is used to indicate that the syntax value is unknown.
- */
-
- static Cell local tidyInfix(e) /* convert InfixExpr to Expr */
- Cell e; { /* :: InfixExpr */
- Cell s = NIL; /* :: TidyStack */
- Syntax sye = APPLIC; /* Syntax of op in e (init unknown) */
- Syntax sys = APPLIC; /* Syntax of op in s (init unknown) */
- Cell temp;
-
- while (nonNull(tl(e))) {
- if (isNull(s)) {
- s = e;
- e = arg(fun(s));
- arg(fun(s)) = NIL;
- sys = sye;
- sye = APPLIC;
- }
- else {
- if (sye==APPLIC) { /* calculate sye (if unknown) */
- sye = syntaxOf(textOf(fun(fun(e))));
- if (sye==APPLIC) sye=DEF_OPSYNTAX;
- }
- if (sys==APPLIC) { /* calculate sys (if unknown) */
- sys = syntaxOf(textOf(fun(fun(s))));
- if (sys==APPLIC) sys=DEF_OPSYNTAX;
- }
-
- if (precOf(sye)==precOf(sys) && /* amb */
- (assocOf(sye)!=assocOf(sys) || assocOf(sye)==NON_ASS)) {
- ERROR(row) "Ambiguous use of operator \"%s\" with \"%s\"",
- textToStr(textOf(fun(fun(e)))),
- textToStr(textOf(fun(fun(s))))
- EEND;
- }
- else if (precOf(sye)>precOf(sys) || /* shift */
- (precOf(sye)==precOf(sys) && assocOf(sye)==LEFT_ASS)) {
- temp = arg(fun(e));
- arg(fun(e)) = s;
- s = e;
- e = temp;
- sys = sye;
- sye = APPLIC;
- }
- else { /* reduce */
- temp = arg(fun(s));
- arg(fun(s)) = arg(e);
- arg(e) = s;
- s = temp;
- sys = APPLIC;
- /* sye unchanged */
- }
- }
- }
-
- e = hd(e);
- while (nonNull(s)) {
- temp = arg(fun(s));
- arg(fun(s)) = e;
- e = s;
- s = temp;
- }
-
- return e;
- }
-
- /*-------------------------------------------------------------------------*/
- int yyexca[] ={
- -1, 1,
- 0, -1,
- -2, 0,
- -1, 27,
- 93, 195,
- -2, 0,
- -1, 86,
- 259, 141,
- 44, 141,
- -2, 166,
- -1, 95,
- 285, 74,
- -2, 73,
- -1, 132,
- 93, 201,
- -2, 0,
- -1, 155,
- 285, 74,
- -2, 116,
- -1, 241,
- 264, 19,
- -2, 41,
- -1, 263,
- 275, 220,
- 288, 220,
- -2, 150,
- -1, 266,
- 93, 200,
- -2, 0,
- -1, 282,
- 282, 77,
- -2, 64,
- };
- # define YYNPROD 221
- # define YYLAST 871
- int yyact[]={
-
- 18, 6, 21, 93, 84, 358, 329, 95, 115, 352,
- 280, 5, 160, 308, 258, 380, 379, 272, 238, 34,
- 36, 37, 52, 53, 135, 324, 260, 237, 210, 43,
- 225, 62, 170, 86, 85, 70, 68, 398, 110, 261,
- 389, 139, 89, 142, 104, 385, 375, 326, 220, 145,
- 105, 213, 86, 85, 215, 255, 322, 191, 36, 109,
- 362, 38, 235, 40, 47, 91, 91, 133, 90, 90,
- 141, 72, 269, 227, 224, 256, 152, 111, 112, 275,
- 45, 151, 295, 221, 309, 266, 211, 376, 382, 155,
- 155, 157, 39, 86, 85, 71, 201, 4, 2, 3,
- 152, 163, 214, 165, 343, 309, 292, 233, 288, 175,
- 179, 98, 152, 183, 159, 286, 184, 270, 193, 126,
- 187, 188, 152, 182, 92, 192, 343, 55, 51, 153,
- 252, 56, 194, 397, 195, 86, 85, 129, 144, 199,
- 202, 204, 291, 377, 15, 381, 378, 219, 130, 94,
- 140, 159, 169, 149, 114, 48, 289, 320, 181, 207,
- 229, 239, 228, 159, 166, 283, 267, 396, 221, 240,
- 166, 372, 231, 206, 373, 234, 125, 186, 243, 244,
- 121, 189, 355, 230, 374, 320, 86, 85, 293, 371,
- 259, 294, 325, 319, 86, 85, 22, 134, 88, 250,
- 264, 10, 251, 48, 248, 120, 246, 249, 172, 247,
- 207, 240, 156, 185, 119, 207, 307, 146, 147, 278,
- 151, 281, 101, 306, 254, 245, 284, 143, 131, 276,
- 205, 154, 154, 287, 198, 124, 138, 242, 125, 197,
- 122, 296, 290, 123, 317, 273, 168, 27, 11, 216,
- 217, 20, 113, 265, 200, 297, 101, 22, 305, 298,
- 44, 304, 10, 136, 299, 300, 46, 212, 232, 310,
- 303, 86, 85, 102, 240, 312, 202, 314, 315, 136,
- 209, 136, 19, 29, 268, 22, 119, 86, 331, 86,
- 85, 330, 276, 86, 85, 240, 162, 344, 334, 341,
- 335, 342, 212, 361, 259, 22, 61, 102, 27, 11,
- 58, 349, 20, 30, 222, 348, 150, 345, 353, 347,
- 354, 240, 337, 359, 101, 301, 346, 207, 336, 366,
- 316, 72, 281, 311, 363, 360, 27, 30, 327, 356,
- 20, 30, 369, 19, 367, 262, 22, 29, 332, 30,
- 338, 10, 91, 318, 67, 241, 27, 11, 22, 30,
- 20, 45, 218, 30, 313, 277, 86, 331, 132, 29,
- 330, 19, 386, 285, 387, 102, 388, 180, 158, 353,
- 392, 354, 359, 393, 350, 390, 395, 394, 391, 257,
- 207, 19, 35, 49, 137, 9, 364, 27, 11, 222,
- 368, 20, 28, 164, 370, 375, 22, 161, 328, 27,
- 137, 10, 137, 20, 226, 223, 77, 78, 79, 365,
- 302, 14, 63, 13, 190, 22, 87, 75, 76, 42,
- 12, 136, 19, 30, 23, 24, 25, 26, 97, 29,
- 81, 148, 82, 16, 19, 80, 83, 41, 177, 74,
- 69, 176, 66, 96, 384, 383, 357, 27, 11, 99,
- 323, 20, 279, 321, 22, 100, 340, 339, 351, 10,
- 65, 274, 282, 73, 236, 271, 27, 77, 78, 79,
- 20, 208, 14, 101, 13, 136, 136, 167, 75, 76,
- 136, 12, 19, 99, 30, 23, 24, 25, 26, 100,
- 29, 81, 33, 82, 16, 32, 80, 83, 22, 31,
- 74, 19, 1, 10, 0, 27, 11, 0, 0, 20,
- 0, 7, 30, 23, 24, 25, 26, 0, 29, 0,
- 14, 0, 13, 0, 102, 0, 0, 0, 0, 12,
- 97, 59, 30, 23, 24, 25, 26, 60, 29, 136,
- 19, 22, 16, 0, 0, 0, 10, 0, 0, 27,
- 11, 99, 137, 20, 0, 0, 0, 100, 0, 0,
- 0, 14, 0, 13, 22, 196, 0, 0, 0, 10,
- 12, 107, 0, 30, 23, 24, 25, 26, 0, 29,
- 0, 8, 0, 16, 19, 30, 23, 24, 25, 26,
- 22, 29, 27, 11, 0, 10, 20, 0, 101, 173,
- 0, 0, 178, 0, 64, 0, 137, 137, 0, 0,
- 0, 137, 7, 22, 0, 27, 11, 0, 10, 20,
- 0, 14, 103, 13, 0, 0, 0, 19, 0, 106,
- 12, 0, 0, 30, 23, 24, 25, 26, 0, 29,
- 0, 27, 11, 16, 0, 20, 0, 0, 0, 102,
- 19, 0, 30, 23, 24, 25, 26, 0, 29, 0,
- 0, 0, 17, 0, 27, 11, 0, 0, 20, 0,
- 263, 0, 0, 0, 50, 0, 19, 0, 54, 14,
- 0, 116, 57, 0, 0, 0, 0, 0, 117, 0,
- 0, 30, 23, 24, 25, 26, 171, 29, 0, 19,
- 0, 16, 0, 0, 0, 0, 0, 0, 103, 0,
- 99, 54, 108, 0, 7, 0, 100, 0, 0, 118,
- 0, 0, 0, 14, 0, 333, 0, 0, 127, 128,
- 0, 0, 12, 0, 0, 30, 23, 24, 25, 26,
- 0, 29, 0, 0, 0, 16, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 7, 0, 0,
- 0, 0, 0, 253, 0, 0, 14, 0, 13, 0,
- 0, 0, 0, 0, 0, 203, 0, 0, 30, 23,
- 24, 25, 26, 0, 29, 0, 0, 0, 16, 14,
- 0, 13, 0, 0, 0, 0, 0, 0, 12, 0,
- 0, 30, 23, 24, 25, 26, 7, 29, 0, 0,
- 0, 16, 0, 0, 97, 14, 0, 116, 0, 0,
- 0, 174, 0, 0, 117, 0, 0, 30, 23, 24,
- 25, 26, 0, 29, 0, 99, 0, 16, 14, 0,
- 13, 100, 0, 0, 0, 0, 0, 12, 0, 0,
- 30, 23, 24, 25, 26, 0, 29, 0, 0, 0,
- 16 };
- int yypact[]={
-
- -159, -1000, 366, -237, -1000, -209, -167, -1000, -16, -16,
- 385, 385, 5, 366, 366, 385, 4, -1000, 67, 385,
- -1000, -1000, 265, -1000, -1000, -1000, -1000, 366, -1000, -1000,
- -1000, -1000, 217, -275, -1000, -1000, -214, -1000, 1, 182,
- 583, -1000, -1000, -1000, -1000, -233, -1000, 583, 385, 318,
- -1000, 583, -191, -188, -1000, 560, 385, -1000, 245, 164,
- 139, -1000, 199, 194, -16, 385, 385, 44, 104, 132,
- 138, -1000, -1000, -1000, -215, -213, -213, -229, -229, -229,
- 60, 182, 182, 182, 119, 40, 67, -1000, 206, -1000,
- -1000, -1000, 583, -1000, -253, -1000, 443, -1000, -1000, -1000,
- -1000, 568, 284, -16, 27, 17, -1000, 366, -1000, 154,
- -1000, 366, -2, 365, -1000, -216, 366, -5, -1000, -1000,
- -1000, -1000, -1000, 366, -1000, 366, 534, 198, 193, -1000,
- 366, 511, 366, -1000, 156, -1000, -1000, -1000, -12, -1000,
- 25, -1000, -1000, -10, -16, -1000, -16, -16, 103, -1000,
- -1000, -232, 38, -196, -255, -1000, -197, -1000, 182, 36,
- -1000, -209, -1000, 366, 46, -1000, 366, -208, 72, 154,
- 182, 182, -1000, -1000, 184, 165, 163, 158, -1000, 37,
- -1000, 583, -1000, -1000, -1000, 306, -220, -194, 583, -249,
- 424, 366, -191, 583, -1000, -1000, -1000, -1000, -1000, -179,
- 122, -1000, 11, -6, -1000, -1000, -1000, -1000, -279, 205,
- 82, 182, -1000, 216, 121, -1000, 121, 121, 182, 36,
- -1000, 173, 164, -1000, -8, 182, -1000, -15, -1000, -1000,
- -1000, 112, -1000, 366, 81, -17, 147, -1000, -1000, -182,
- -1000, 201, -1000, -1000, -1000, -1000, -1000, 182, -1000, -1000,
- -1000, 182, -1000, -1000, -1000, 366, 366, 361, -1000, -40,
- 366, -1000, -1000, -1000, -1000, 154, 366, 511, 366, 366,
- 583, -1000, 204, 82, 152, 113, -1000, 201, -219, -99,
- -1000, -235, -1000, -16, -1000, -1000, 583, -1000, 583, 468,
- 112, 366, 217, -1000, 72, -1000, 86, -1000, -1000, -1000,
- -1000, -1000, 306, -1000, -209, -19, 366, -1000, -1000, 583,
- -1000, -220, -1000, -1000, -1000, -1000, 154, 64, 141, -1000,
- 82, -1000, 36, -1000, 216, 20, 182, -1000, 360, -1000,
- 70, 40, 154, 366, -1000, -1000, 138, -1000, 148, 130,
- 143, -1000, 107, 123, -1000, -1000, -1000, -1000, -1000, -176,
- -220, 102, -1000, -281, -282, -1000, -1000, 101, -1000, -171,
- -1000, -1000, -238, -1000, -1000, 306, 182, -1000, -1000, -191,
- -1000, -1000, -1000, 0, -1000, 139, 366, -1000, 64, 36,
- 0, 36, 182, 126, 89, -1000, -1000, -1000, -1000, -236,
- -1000, -1000, -1000, -1000, -1000, -1000, -1000, -246, -1000 };
- int yypgo[]={
-
- 0, 512, 8, 21, 509, 505, 35, 67, 502, 95,
- 38, 392, 161, 487, 481, 475, 474, 27, 18, 79,
- 471, 468, 9, 0, 2, 467, 466, 4, 150, 7,
- 463, 462, 460, 456, 5, 3, 10, 455, 454, 149,
- 453, 111, 451, 448, 138, 102, 54, 447, 429, 441,
- 153, 129, 415, 414, 408, 59, 6, 1, 12, 407,
- 403, 103, 402, 591, 395, 144, 393, 389, 672, 422,
- 354, 14, 270, 261, 258, 13, 254, 96, 252, 154,
- 24 };
- int yyr1[]={
-
- 0, 1, 1, 1, 1, 4, 4, 5, 6, 6,
- 6, 6, 6, 8, 8, 11, 11, 9, 9, 12,
- 12, 13, 13, 16, 16, 17, 17, 14, 14, 14,
- 20, 20, 19, 19, 15, 15, 21, 21, 22, 22,
- 18, 18, 18, 18, 18, 25, 25, 26, 26, 9,
- 9, 28, 28, 28, 30, 30, 33, 33, 34, 34,
- 31, 31, 36, 36, 36, 32, 32, 32, 37, 37,
- 38, 38, 35, 35, 39, 29, 29, 29, 40, 40,
- 41, 41, 41, 41, 41, 41, 41, 41, 41, 42,
- 42, 43, 43, 9, 9, 9, 44, 44, 45, 45,
- 46, 46, 46, 47, 47, 48, 48, 9, 49, 49,
- 49, 50, 9, 9, 9, 51, 51, 52, 52, 53,
- 53, 54, 54, 56, 56, 10, 10, 55, 55, 58,
- 58, 58, 59, 59, 3, 60, 60, 61, 61, 61,
- 27, 27, 23, 23, 62, 62, 24, 24, 2, 2,
- 2, 57, 57, 57, 64, 64, 63, 63, 63, 63,
- 63, 63, 66, 66, 65, 65, 68, 68, 68, 68,
- 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
- 68, 68, 69, 69, 67, 67, 71, 72, 72, 73,
- 73, 73, 74, 74, 75, 70, 70, 70, 70, 70,
- 70, 70, 70, 76, 76, 77, 77, 77, 77, 63,
- 63, 78, 78, 79, 79, 79, 79, 7, 7, 80,
- 80 };
- int yyr2[]={
-
- 0, 5, 7, 5, 3, 7, 3, 3, 7, 7,
- 3, 3, 3, 5, 3, 15, 5, 9, 5, 3,
- 3, 1, 7, 7, 3, 3, 5, 1, 9, 7,
- 1, 3, 7, 3, 1, 9, 7, 3, 7, 7,
- 3, 3, 9, 9, 9, 7, 3, 1, 3, 11,
- 11, 5, 3, 3, 5, 1, 7, 3, 7, 3,
- 7, 3, 7, 3, 3, 1, 5, 9, 1, 3,
- 7, 3, 7, 3, 3, 3, 7, 3, 5, 3,
- 3, 3, 5, 7, 7, 7, 7, 7, 5, 5,
- 3, 7, 7, 7, 7, 7, 3, 1, 7, 3,
- 3, 3, 3, 3, 7, 3, 7, 9, 7, 3,
- 3, 5, 7, 7, 5, 7, 3, 9, 1, 9,
- 1, 7, 3, 7, 5, 7, 5, 7, 3, 5,
- 3, 3, 5, 3, 9, 5, 3, 9, 11, 9,
- 7, 3, 3, 7, 3, 7, 3, 7, 7, 3,
- 3, 3, 7, 3, 7, 11, 5, 9, 13, 13,
- 13, 3, 5, 3, 5, 3, 3, 7, 5, 3,
- 3, 5, 3, 3, 3, 3, 7, 7, 7, 9,
- 9, 9, 7, 7, 7, 3, 5, 5, 3, 3,
- 5, 3, 5, 3, 9, 1, 3, 3, 7, 7,
- 9, 5, 11, 7, 3, 7, 7, 3, 9, 13,
- 11, 7, 3, 7, 3, 5, 9, 5, 3, 3,
- 3 };
- int yychk[]={
-
- -1000, -1, 257, 258, 256, -2, -57, 256, -63, -64,
- 45, 92, 274, 267, 265, -65, 287, -68, -23, 126,
- 95, -24, 40, 278, 279, 280, 281, 91, -62, 283,
- 277, -4, -5, -8, 256, -11, 295, -3, 270, 259,
- -46, -47, -48, 45, 276, 96, 282, -46, -65, -66,
- -68, 123, -2, -2, -68, 123, 64, -68, 45, 276,
- 282, 41, -2, -69, -63, -47, -48, -70, -2, -69,
- -6, -9, -10, 256, 293, 271, 272, 260, 261, 262,
- 289, 284, 286, 290, -27, -57, -23, -11, -12, 256,
- 283, 280, 123, -35, -39, -29, -40, 256, -41, 277,
- 283, 40, 91, -63, 277, 283, -63, 263, -68, -55,
- -10, 268, 266, -78, -79, -2, 267, 274, -68, 41,
- 41, 41, 41, 44, 41, 44, -46, -68, -68, 93,
- 44, 124, 264, -7, 59, -80, 125, 256, -12, 256,
- -28, 283, 256, -28, -44, 278, -44, -44, -49, -50,
- 256, -23, 40, -51, -39, -29, -51, -29, 259, 44,
- -58, -59, 256, 61, -60, -61, 124, -13, 40, -55,
- 285, 263, -41, 41, 263, -29, -42, -43, 44, -29,
- 93, -46, 96, 96, -2, 59, -7, -2, 123, -7,
- 59, 273, -2, 123, -2, -2, 41, 41, 41, -2,
- -76, -77, -2, 274, -2, -9, -10, -80, -14, 292,
- 40, 61, 277, 61, -45, -46, -45, -45, 259, 44,
- 280, 45, 276, -52, 270, 285, -53, 270, -35, -23,
- -3, -2, -61, 61, -2, 270, -16, -17, -18, -12,
- -23, 283, -7, -29, -29, 41, 41, 44, 41, 44,
- 41, 44, 93, -63, -10, 275, 269, -67, -71, -57,
- 275, 288, -79, 256, -2, -55, 264, 44, 273, 61,
- 123, -15, 296, 40, -20, -19, -18, 283, -29, -31,
- -36, -29, 256, 44, -29, -50, 123, -29, 123, 44,
- -2, 61, 123, 41, 44, 264, 40, -29, -29, -2,
- -2, -7, 59, -72, -73, -74, 263, 256, -75, 124,
- -2, -7, -2, -77, -2, -2, -55, 40, -19, 41,
- 44, -30, 275, -32, 124, 291, 282, -46, -54, -56,
- -27, -57, -55, 267, -2, -2, -6, -17, 264, -25,
- -26, -24, -27, 40, -23, -71, -3, -75, -2, -57,
- -7, -21, -22, -23, -24, 41, -18, -33, -34, -23,
- -36, 283, 40, -29, -7, 59, 259, -58, -7, -2,
- -7, 41, 41, 44, 41, 282, 263, 41, 44, 297,
- 297, 44, 259, -37, -38, 283, -56, -29, -24, 40,
- -2, -22, -23, -24, -34, -35, 41, 44, 283 };
- int yydef[]={
-
- 0, -2, 0, 0, 4, 1, 149, 150, 151, 153,
- 0, 0, 0, 0, 0, 161, 0, 165, 166, 0,
- 169, 170, 0, 172, 173, 174, 175, -2, 142, 146,
- 144, 3, 0, 6, 7, 14, 0, 2, 0, 0,
- 0, 100, 101, 102, 103, 0, 105, 0, 156, 0,
- 163, 0, 0, 0, 164, 0, 0, 168, 0, 103,
- 105, 171, 0, 0, 151, 0, 0, 0, 196, 197,
- 0, 10, 11, 12, 0, 0, 0, 97, 97, 97,
- 0, 0, 0, 0, 0, 0, -2, 13, 21, 16,
- 19, 20, 0, 148, 0, -2, 75, 77, 79, 80,
- 81, 0, 0, 152, 0, 0, 154, 0, 162, 0,
- 128, 0, 0, 0, 212, 214, 0, 0, 167, 143,
- 145, 147, 176, 0, 177, 0, 0, 0, 0, 178,
- 0, 0, -2, 5, 0, 218, 219, 220, 27, 18,
- 0, 52, 53, 0, 0, 96, 0, 0, 0, 109,
- 110, 0, 0, 118, 0, -2, 120, 114, 0, 0,
- 126, 130, 131, 0, 133, 136, 0, 0, 0, 0,
- 0, 0, 78, 82, 0, 0, 0, 0, 90, 0,
- 88, 0, 104, 106, 157, 0, 0, 0, 0, 0,
- 0, 0, 215, 0, 183, 182, 179, 180, 181, 183,
- 198, 204, 207, 0, 199, 8, 9, 217, 34, 0,
- 30, 0, 51, 0, 93, 99, 94, 95, 0, 0,
- 111, 0, 0, 112, 0, 0, 113, 0, 125, 140,
- 129, 132, 135, 0, 0, 0, 0, 24, 25, 0,
- 40, -2, 134, 72, 76, 83, 84, 0, 85, 89,
- 86, 0, 87, 155, 127, 0, 0, 0, 185, 0,
- 0, 210, 211, -2, 213, 0, -2, 0, 0, 0,
- 0, 17, 0, 0, 0, 31, 33, 41, 55, 65,
- 61, 63, -2, 0, 107, 108, 0, 115, 0, 0,
- 0, 0, 0, 22, 0, 26, 47, 92, 91, 158,
- 159, 160, 0, 186, 188, 189, 0, 191, 193, 0,
- 209, 216, 202, 203, 205, 206, 0, 0, 0, 29,
- 0, 49, 0, 50, 0, 0, 0, 98, 0, 122,
- 0, 0, 0, 0, 139, 137, 0, 23, 0, 0,
- 0, 46, 48, 0, 141, 184, 187, 192, 190, 0,
- 208, 0, 37, 0, 0, 28, 32, 54, 57, 59,
- 60, 66, 68, 62, 117, 0, 0, 124, 119, 138,
- 15, 42, 43, 0, 44, 0, 0, 35, 0, 0,
- 0, 0, 0, 0, 69, 71, 121, 123, 45, 0,
- 194, 36, 38, 39, 56, 58, 67, 0, 70 };
- typedef struct { char *t_name; int t_val; } yytoktype;
- #ifndef YYDEBUG
- # define YYDEBUG 0 /* don't allow debugging */
- #endif
-
- #if YYDEBUG
-
- yytoktype yytoks[] =
- {
- "EVALEX", 257,
- "SCRIPT", 258,
- "=", 61,
- "COCO", 259,
- "INFIXL", 260,
- "INFIXR", 261,
- "INFIX", 262,
- "FUNARROW", 263,
- "-", 45,
- ",", 44,
- "@", 64,
- "(", 40,
- ")", 41,
- "|", 124,
- ";", 59,
- "UPTO", 264,
- "[", 91,
- "]", 93,
- "CASEXP", 265,
- "OF", 266,
- "IF", 267,
- "THEN", 268,
- "ELSE", 269,
- "WHERE", 270,
- "TYPE", 271,
- "DATA", 272,
- "FROM", 273,
- "\\", 92,
- "~", 126,
- "LET", 274,
- "IN", 275,
- "`", 96,
- "VAROP", 276,
- "VARID", 277,
- "NUMLIT", 278,
- "CHARLIT", 279,
- "STRINGLIT", 280,
- "REPEAT", 281,
- "CONOP", 282,
- "CONID", 283,
- "TCLASS", 284,
- "IMPLIES", 285,
- "TINSTANCE", 286,
- "DO", 287,
- "END", 288,
- "PRIMITIVE", 289,
- "DEFAULT", 290,
- "DERIVING", 291,
- "HIDING", 292,
- "IMPORT", 293,
- "INTERFACE", 294,
- "MODULE", 295,
- "RENAMING", 296,
- "TO", 297,
- "-unknown-", -1 /* ends search */
- };
-
- char * yyreds[] =
- {
- "-no such reduction-",
- "start : EVALEX exp",
- "start : EVALEX exp wherePart",
- "start : SCRIPT topModule",
- "start : error",
- "topModule : begin topDecls close",
- "topModule : modules",
- "begin : error",
- "topDecls : topDecls ';' topDecl",
- "topDecls : topDecls ';' decl",
- "topDecls : topDecl",
- "topDecls : decl",
- "topDecls : error",
- "modules : modules module",
- "modules : module",
- "module : MODULE modid expspec WHERE '{' topDecls close",
- "module : MODULE error",
- "topDecl : IMPORT modid impspec rename",
- "topDecl : IMPORT error",
- "modid : CONID",
- "modid : STRINGLIT",
- "expspec : /* empty */",
- "expspec : '(' exports ')'",
- "exports : exports ',' export",
- "exports : export",
- "export : entity",
- "export : modid UPTO",
- "impspec : /* empty */",
- "impspec : HIDING '(' imports ')'",
- "impspec : '(' imports0 ')'",
- "imports0 : /* empty */",
- "imports0 : imports",
- "imports : imports ',' entity",
- "imports : entity",
- "rename : /* empty */",
- "rename : RENAMING '(' renamings ')'",
- "renamings : renamings ',' renaming",
- "renamings : renaming",
- "renaming : var TO var",
- "renaming : conid TO conid",
- "entity : var",
- "entity : CONID",
- "entity : CONID '(' UPTO ')'",
- "entity : CONID '(' conids ')'",
- "entity : CONID '(' vars0 ')'",
- "conids : conids ',' conid",
- "conids : conid",
- "vars0 : /* empty */",
- "vars0 : vars",
- "topDecl : TYPE typeLhs '=' type invars",
- "topDecl : DATA typeLhs '=' constrs deriving",
- "typeLhs : typeLhs VARID",
- "typeLhs : CONID",
- "typeLhs : error",
- "invars : IN rsvars",
- "invars : /* empty */",
- "rsvars : rsvars ',' rsvar",
- "rsvars : rsvar",
- "rsvar : var COCO sigType",
- "rsvar : var",
- "constrs : constrs '|' constr",
- "constrs : constr",
- "constr : type CONOP type",
- "constr : type",
- "constr : error",
- "deriving : /* empty */",
- "deriving : DERIVING CONID",
- "deriving : DERIVING '(' derivs0 ')'",
- "derivs0 : /* empty */",
- "derivs0 : derivs",
- "derivs : derivs ',' CONID",
- "derivs : CONID",
- "sigType : context IMPLIES type",
- "sigType : type",
- "context : type",
- "type : ctype",
- "type : ctype FUNARROW type",
- "type : error",
- "ctype : ctype atype",
- "ctype : atype",
- "atype : VARID",
- "atype : CONID",
- "atype : '(' ')'",
- "atype : '(' FUNARROW ')'",
- "atype : '(' type ')'",
- "atype : '(' tupCommas ')'",
- "atype : '(' typeTuple ')'",
- "atype : '[' type ']'",
- "atype : '[' ']'",
- "tupCommas : tupCommas ','",
- "tupCommas : ','",
- "typeTuple : typeTuple ',' type",
- "typeTuple : type ',' type",
- "topDecl : INFIXL optdigit ops",
- "topDecl : INFIXR optdigit ops",
- "topDecl : INFIX optdigit ops",
- "optdigit : NUMLIT",
- "optdigit : /* empty */",
- "ops : ops ',' op",
- "ops : op",
- "op : varop",
- "op : conop",
- "op : '-'",
- "varop : VAROP",
- "varop : '`' VARID '`'",
- "conop : CONOP",
- "conop : '`' CONID '`'",
- "topDecl : PRIMITIVE prims COCO type",
- "prims : prims ',' prim",
- "prims : prim",
- "prims : error",
- "prim : var STRINGLIT",
- "topDecl : TCLASS classHead classBody",
- "topDecl : TINSTANCE classHead instBody",
- "topDecl : DEFAULT type",
- "classHead : context IMPLIES type",
- "classHead : type",
- "classBody : WHERE '{' csigdecls close",
- "classBody : /* empty */",
- "instBody : WHERE '{' decls close",
- "instBody : /* empty */",
- "csigdecls : csigdecls ';' csigdecl",
- "csigdecls : csigdecl",
- "csigdecl : vars COCO type",
- "csigdecl : opExp rhs",
- "decl : vars COCO sigType",
- "decl : opExp rhs",
- "decls : decls ';' decl",
- "decls : decl",
- "rhs : rhs1 wherePart",
- "rhs : rhs1",
- "rhs : error",
- "rhs1 : '=' exp",
- "rhs1 : gdefs",
- "wherePart : WHERE '{' decls close",
- "gdefs : gdefs gdef",
- "gdefs : gdef",
- "gdef : '|' exp '=' exp",
- "gdef : '=' exp ',' IF exp",
- "gdef : '=' exp ',' exp",
- "vars : vars ',' var",
- "vars : var",
- "var : varid",
- "var : '(' '-' ')'",
- "varid : VARID",
- "varid : '(' VAROP ')'",
- "conid : CONID",
- "conid : '(' CONOP ')'",
- "exp : opExp COCO sigType",
- "exp : opExp",
- "exp : error",
- "opExp : pfxExp",
- "opExp : pfxExp op pfxExp",
- "opExp : opExp0",
- "opExp0 : opExp0 op pfxExp",
- "opExp0 : pfxExp op pfxExp op pfxExp",
- "pfxExp : '-' appExp",
- "pfxExp : '\\' pats FUNARROW exp",
- "pfxExp : LET '{' decls close IN exp",
- "pfxExp : IF exp THEN exp ELSE exp",
- "pfxExp : CASEXP exp OF '{' alts close",
- "pfxExp : appExp",
- "pats : pats atomic",
- "pats : atomic",
- "appExp : appExp atomic",
- "appExp : atomic",
- "atomic : var",
- "atomic : var '@' atomic",
- "atomic : '~' atomic",
- "atomic : '_'",
- "atomic : conid",
- "atomic : '(' ')'",
- "atomic : NUMLIT",
- "atomic : CHARLIT",
- "atomic : STRINGLIT",
- "atomic : REPEAT",
- "atomic : '(' exp ')'",
- "atomic : '(' exps2 ')'",
- "atomic : '[' list ']'",
- "atomic : '(' pfxExp op ')'",
- "atomic : '(' varop atomic ')'",
- "atomic : '(' conop atomic ')'",
- "exps2 : exps2 ',' exp",
- "exps2 : exp ',' exp",
- "alts : alts ';' alt",
- "alts : alt",
- "alt : opExp altRhs",
- "altRhs : altRhs1 wherePart",
- "altRhs : altRhs1",
- "altRhs1 : guardAlts",
- "altRhs1 : FUNARROW exp",
- "altRhs1 : error",
- "guardAlts : guardAlts guardAlt",
- "guardAlts : guardAlt",
- "guardAlt : '|' opExp FUNARROW exp",
- "list : /* empty */",
- "list : exp",
- "list : exps2",
- "list : exp '|' quals",
- "list : exp UPTO exp",
- "list : exp ',' exp UPTO",
- "list : exp UPTO",
- "list : exp ',' exp UPTO exp",
- "quals : quals ',' qual",
- "quals : qual",
- "qual : exp FROM exp",
- "qual : exp '=' exp",
- "qual : exp",
- "qual : LET '{' decls close",
- "pfxExp : DO '{' dquals close IN exp",
- "pfxExp : DO '{' dquals close END",
- "dquals : dquals ';' dqual",
- "dquals : dqual",
- "dqual : exp FROM exp",
- "dqual : exp",
- "dqual : IF exp",
- "dqual : LET '{' decls close",
- "close : ';' close1",
- "close : close1",
- "close1 : '}'",
- "close1 : error",
- };
- #endif /* YYDEBUG */
- #line 1 "/usr/lib/yaccpar"
- /* @(#)yaccpar 1.10 89/04/04 SMI; from S5R3 1.10 */
-
- /*
- ** Skeleton parser driver for yacc output
- */
-
- /*
- ** yacc user known macros and defines
- */
- #define YYERROR goto yyerrlab
- #define YYACCEPT { free(yys); free(yyv); return(0); }
- #define YYABORT { free(yys); free(yyv); return(1); }
- #define YYBACKUP( newtoken, newvalue )\
- {\
- if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\
- {\
- yyerror( "syntax error - cannot backup" );\
- goto yyerrlab;\
- }\
- yychar = newtoken;\
- yystate = *yyps;\
- yylval = newvalue;\
- goto yynewstate;\
- }
- #define YYRECOVERING() (!!yyerrflag)
- #ifndef YYDEBUG
- # define YYDEBUG 1 /* make debugging available */
- #endif
-
- /*
- ** user known globals
- */
- int yydebug; /* set to 1 to get debugging */
-
- /*
- ** driver internal defines
- */
- #define YYFLAG (-1000)
-
- /*
- ** static variables used by the parser
- */
- static YYSTYPE *yyv; /* value stack */
- static int *yys; /* state stack */
-
- static YYSTYPE *yypv; /* top of value stack */
- static int *yyps; /* top of state stack */
-
- static int yystate; /* current state */
- static int yytmp; /* extra var (lasts between blocks) */
-
- int yynerrs; /* number of errors */
-
- int yyerrflag; /* error recovery flag */
- int yychar; /* current input token number */
-
-
- /*
- ** yyparse - return 0 if worked, 1 if syntax error not recovered from
- */
- int
- yyparse()
- {
- register YYSTYPE *yypvt; /* top of value stack for $vars */
- unsigned yymaxdepth = YYMAXDEPTH;
-
- /*
- ** Initialize externals - yyparse may be called more than once
- */
- yyv = (YYSTYPE*)malloc(yymaxdepth*sizeof(YYSTYPE));
- yys = (int*)malloc(yymaxdepth*sizeof(int));
- if (!yyv || !yys)
- {
- yyerror( "out of memory" );
- return(1);
- }
- yypv = &yyv[-1];
- yyps = &yys[-1];
- yystate = 0;
- yytmp = 0;
- yynerrs = 0;
- yyerrflag = 0;
- yychar = -1;
-
- goto yystack;
- {
- register YYSTYPE *yy_pv; /* top of value stack */
- register int *yy_ps; /* top of state stack */
- register int yy_state; /* current state */
- register int yy_n; /* internal state number info */
-
- /*
- ** get globals into registers.
- ** branch to here only if YYBACKUP was called.
- */
- yynewstate:
- yy_pv = yypv;
- yy_ps = yyps;
- yy_state = yystate;
- goto yy_newstate;
-
- /*
- ** get globals into registers.
- ** either we just started, or we just finished a reduction
- */
- yystack:
- yy_pv = yypv;
- yy_ps = yyps;
- yy_state = yystate;
-
- /*
- ** top of for (;;) loop while no reductions done
- */
- yy_stack:
- /*
- ** put a state and value onto the stacks
- */
- #if YYDEBUG
- /*
- ** if debugging, look up token value in list of value vs.
- ** name pairs. 0 and negative (-1) are special values.
- ** Note: linear search is used since time is not a real
- ** consideration while debugging.
- */
- if ( yydebug )
- {
- register int yy_i;
-
- (void)printf( "State %d, token ", yy_state );
- if ( yychar == 0 )
- (void)printf( "end-of-file\n" );
- else if ( yychar < 0 )
- (void)printf( "-none-\n" );
- else
- {
- for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
- yy_i++ )
- {
- if ( yytoks[yy_i].t_val == yychar )
- break;
- }
- (void)printf( "%s\n", yytoks[yy_i].t_name );
- }
- }
- #endif /* YYDEBUG */
- if ( ++yy_ps >= &yys[ yymaxdepth ] ) /* room on stack? */
- {
- /*
- ** reallocate and recover. Note that pointers
- ** have to be reset, or bad things will happen
- */
- int yyps_index = (yy_ps - yys);
- int yypv_index = (yy_pv - yyv);
- int yypvt_index = (yypvt - yyv);
- yymaxdepth += YYMAXDEPTH;
- yyv = (YYSTYPE*)realloc((char*)yyv,
- yymaxdepth * sizeof(YYSTYPE));
- yys = (int*)realloc((char*)yys,
- yymaxdepth * sizeof(int));
- if (!yyv || !yys)
- {
- yyerror( "yacc stack overflow" );
- return(1);
- }
- yy_ps = yys + yyps_index;
- yy_pv = yyv + yypv_index;
- yypvt = yyv + yypvt_index;
- }
- *yy_ps = yy_state;
- *++yy_pv = yyval;
-
- /*
- ** we have a new state - find out what to do
- */
- yy_newstate:
- if ( ( yy_n = yypact[ yy_state ] ) <= YYFLAG )
- goto yydefault; /* simple state */
- #if YYDEBUG
- /*
- ** if debugging, need to mark whether new token grabbed
- */
- yytmp = yychar < 0;
- #endif
- if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) )
- yychar = 0; /* reached EOF */
- #if YYDEBUG
- if ( yydebug && yytmp )
- {
- register int yy_i;
-
- (void)printf( "Received token " );
- if ( yychar == 0 )
- (void)printf( "end-of-file\n" );
- else if ( yychar < 0 )
- (void)printf( "-none-\n" );
- else
- {
- for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
- yy_i++ )
- {
- if ( yytoks[yy_i].t_val == yychar )
- break;
- }
- (void)printf( "%s\n", yytoks[yy_i].t_name );
- }
- }
- #endif /* YYDEBUG */
- if ( ( ( yy_n += yychar ) < 0 ) || ( yy_n >= YYLAST ) )
- goto yydefault;
- if ( yychk[ yy_n = yyact[ yy_n ] ] == yychar ) /*valid shift*/
- {
- yychar = -1;
- yyval = yylval;
- yy_state = yy_n;
- if ( yyerrflag > 0 )
- yyerrflag--;
- goto yy_stack;
- }
-
- yydefault:
- if ( ( yy_n = yydef[ yy_state ] ) == -2 )
- {
- #if YYDEBUG
- yytmp = yychar < 0;
- #endif
- if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) )
- yychar = 0; /* reached EOF */
- #if YYDEBUG
- if ( yydebug && yytmp )
- {
- register int yy_i;
-
- (void)printf( "Received token " );
- if ( yychar == 0 )
- (void)printf( "end-of-file\n" );
- else if ( yychar < 0 )
- (void)printf( "-none-\n" );
- else
- {
- for ( yy_i = 0;
- yytoks[yy_i].t_val >= 0;
- yy_i++ )
- {
- if ( yytoks[yy_i].t_val
- == yychar )
- {
- break;
- }
- }
- (void)printf( "%s\n", yytoks[yy_i].t_name );
- }
- }
- #endif /* YYDEBUG */
- /*
- ** look through exception table
- */
- {
- register int *yyxi = yyexca;
-
- while ( ( *yyxi != -1 ) ||
- ( yyxi[1] != yy_state ) )
- {
- yyxi += 2;
- }
- while ( ( *(yyxi += 2) >= 0 ) &&
- ( *yyxi != yychar ) )
- ;
- if ( ( yy_n = yyxi[1] ) < 0 )
- YYACCEPT;
- }
- }
-
- /*
- ** check for syntax error
- */
- if ( yy_n == 0 ) /* have an error */
- {
- /* no worry about speed here! */
- switch ( yyerrflag )
- {
- case 0: /* new error */
- yyerror( "syntax error" );
- goto skip_init;
- yyerrlab:
- /*
- ** get globals into registers.
- ** we have a user generated syntax type error
- */
- yy_pv = yypv;
- yy_ps = yyps;
- yy_state = yystate;
- yynerrs++;
- skip_init:
- case 1:
- case 2: /* incompletely recovered error */
- /* try again... */
- yyerrflag = 3;
- /*
- ** find state where "error" is a legal
- ** shift action
- */
- while ( yy_ps >= yys )
- {
- yy_n = yypact[ *yy_ps ] + YYERRCODE;
- if ( yy_n >= 0 && yy_n < YYLAST &&
- yychk[yyact[yy_n]] == YYERRCODE) {
- /*
- ** simulate shift of "error"
- */
- yy_state = yyact[ yy_n ];
- goto yy_stack;
- }
- /*
- ** current state has no shift on
- ** "error", pop stack
- */
- #if YYDEBUG
- # define _POP_ "Error recovery pops state %d, uncovers state %d\n"
- if ( yydebug )
- (void)printf( _POP_, *yy_ps,
- yy_ps[-1] );
- # undef _POP_
- #endif
- yy_ps--;
- yy_pv--;
- }
- /*
- ** there is no state on stack with "error" as
- ** a valid shift. give up.
- */
- YYABORT;
- case 3: /* no shift yet; eat a token */
- #if YYDEBUG
- /*
- ** if debugging, look up token in list of
- ** pairs. 0 and negative shouldn't occur,
- ** but since timing doesn't matter when
- ** debugging, it doesn't hurt to leave the
- ** tests here.
- */
- if ( yydebug )
- {
- register int yy_i;
-
- (void)printf( "Error recovery discards " );
- if ( yychar == 0 )
- (void)printf( "token end-of-file\n" );
- else if ( yychar < 0 )
- (void)printf( "token -none-\n" );
- else
- {
- for ( yy_i = 0;
- yytoks[yy_i].t_val >= 0;
- yy_i++ )
- {
- if ( yytoks[yy_i].t_val
- == yychar )
- {
- break;
- }
- }
- (void)printf( "token %s\n",
- yytoks[yy_i].t_name );
- }
- }
- #endif /* YYDEBUG */
- if ( yychar == 0 ) /* reached EOF. quit */
- YYABORT;
- yychar = -1;
- goto yy_newstate;
- }
- }/* end if ( yy_n == 0 ) */
- /*
- ** reduction by production yy_n
- ** put stack tops, etc. so things right after switch
- */
- #if YYDEBUG
- /*
- ** if debugging, print the string that is the user's
- ** specification of the reduction which is just about
- ** to be done.
- */
- if ( yydebug )
- (void)printf( "Reduce by (%d) \"%s\"\n",
- yy_n, yyreds[ yy_n ] );
- #endif
- yytmp = yy_n; /* value to switch over */
- yypvt = yy_pv; /* $vars top of value stack */
- /*
- ** Look in goto table for next state
- ** Sorry about using yy_state here as temporary
- ** register variable, but why not, if it works...
- ** If yyr2[ yy_n ] doesn't have the low order bit
- ** set, then there is no action to be done for
- ** this reduction. So, no saving & unsaving of
- ** registers done. The only difference between the
- ** code just after the if and the body of the if is
- ** the goto yy_stack in the body. This way the test
- ** can be made before the choice of what to do is needed.
- */
- {
- /* length of production doubled with extra bit */
- register int yy_len = yyr2[ yy_n ];
-
- if ( !( yy_len & 01 ) )
- {
- yy_len >>= 1;
- yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */
- yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
- *( yy_ps -= yy_len ) + 1;
- if ( yy_state >= YYLAST ||
- yychk[ yy_state =
- yyact[ yy_state ] ] != -yy_n )
- {
- yy_state = yyact[ yypgo[ yy_n ] ];
- }
- goto yy_stack;
- }
- yy_len >>= 1;
- yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */
- yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
- *( yy_ps -= yy_len ) + 1;
- if ( yy_state >= YYLAST ||
- yychk[ yy_state = yyact[ yy_state ] ] != -yy_n )
- {
- yy_state = yyact[ yypgo[ yy_n ] ];
- }
- }
- /* save until reenter driver code */
- yystate = yy_state;
- yyps = yy_ps;
- yypv = yy_pv;
- }
- /*
- ** code supplied by user is placed in this switch
- */
- switch( yytmp )
- {
-
- case 1:
- # line 88 "parser.y"
- {inputExpr = yypvt[-0]; sp-=1;} break;
- case 2:
- # line 89 "parser.y"
- {inputExpr = letrec(yypvt[-0],yypvt[-1]); sp-=2;} break;
- case 3:
- # line 90 "parser.y"
- {valDefns = yypvt[-0]; sp-=1;} break;
- case 4:
- # line 91 "parser.y"
- {syntaxError("input");} break;
- case 5:
- # line 104 "parser.y"
- {yyval = gc2(yypvt[-1]);} break;
- case 6:
- # line 105 "parser.y"
- {yyval = yypvt[-0];} break;
- case 7:
- # line 107 "parser.y"
- {yyerrok; goOffside(startColumn);} break;
- case 8:
- # line 109 "parser.y"
- {yyval = gc2(yypvt[-2]);} break;
- case 9:
- # line 110 "parser.y"
- {yyval = gc3(cons(yypvt[-0],yypvt[-2]));} break;
- case 10:
- # line 111 "parser.y"
- {yyval = gc0(NIL);} break;
- case 11:
- # line 112 "parser.y"
- {yyval = gc1(cons(yypvt[-0],NIL));} break;
- case 12:
- # line 113 "parser.y"
- {syntaxError("definition");} break;
- case 13:
- # line 115 "parser.y"
- {yyval = gc2(appendOnto(yypvt[-0],yypvt[-1]));} break;
- case 14:
- # line 116 "parser.y"
- {yyval = yypvt[-0];} break;
- case 15:
- # line 119 "parser.y"
- {yyval = gc7(yypvt[-1]);} break;
- case 16:
- # line 120 "parser.y"
- {syntaxError("module definition");} break;
- case 17:
- # line 122 "parser.y"
- {sp-=4;} break;
- case 18:
- # line 123 "parser.y"
- {syntaxError("import declaration");} break;
- case 19:
- # line 125 "parser.y"
- {yyval = yypvt[-0];} break;
- case 20:
- # line 126 "parser.y"
- {yyval = yypvt[-0];} break;
- case 21:
- # line 128 "parser.y"
- {yyval = gc0(NIL);} break;
- case 22:
- # line 129 "parser.y"
- {yyval = gc3(NIL);} break;
- case 23:
- # line 131 "parser.y"
- {yyval = gc3(NIL);} break;
- case 24:
- # line 132 "parser.y"
- {yyval = yypvt[-0];} break;
- case 25:
- # line 134 "parser.y"
- {yyval = yypvt[-0];} break;
- case 26:
- # line 135 "parser.y"
- {yyval = gc2(NIL);} break;
- case 27:
- # line 137 "parser.y"
- {yyval = gc0(NIL);} break;
- case 28:
- # line 138 "parser.y"
- {yyval = gc4(NIL);} break;
- case 29:
- # line 139 "parser.y"
- {yyval = gc3(NIL);} break;
- case 30:
- # line 141 "parser.y"
- {yyval = gc0(NIL);} break;
- case 31:
- # line 142 "parser.y"
- {yyval = yypvt[-0];} break;
- case 32:
- # line 144 "parser.y"
- {yyval = gc3(NIL);} break;
- case 33:
- # line 145 "parser.y"
- {yyval = yypvt[-0];} break;
- case 34:
- # line 147 "parser.y"
- {yyval = gc0(NIL);} break;
- case 35:
- # line 148 "parser.y"
- {yyval = gc4(NIL);} break;
- case 36:
- # line 150 "parser.y"
- {yyval = gc3(NIL);} break;
- case 37:
- # line 151 "parser.y"
- {yyval = yypvt[-0];} break;
- case 38:
- # line 153 "parser.y"
- {yyval = gc3(NIL);} break;
- case 39:
- # line 154 "parser.y"
- {yyval = gc3(NIL);} break;
- case 40:
- # line 156 "parser.y"
- {yyval = yypvt[-0];} break;
- case 41:
- # line 157 "parser.y"
- {yyval = yypvt[-0];} break;
- case 42:
- # line 158 "parser.y"
- {yyval = gc4(NIL);} break;
- case 43:
- # line 159 "parser.y"
- {yyval = gc4(NIL);} break;
- case 44:
- # line 160 "parser.y"
- {yyval = gc4(NIL);} break;
- case 45:
- # line 162 "parser.y"
- {yyval = gc3(NIL);} break;
- case 46:
- # line 163 "parser.y"
- {yyval = yypvt[-0];} break;
- case 47:
- # line 165 "parser.y"
- {yyval = gc0(NIL);} break;
- case 48:
- # line 166 "parser.y"
- {yyval = yypvt[-0];} break;
- case 49:
- # line 171 "parser.y"
- {defTycon(5,yypvt[-2],yypvt[-3],yypvt[-1],yypvt[-0]);} break;
- case 50:
- # line 173 "parser.y"
- {defTycon(5,yypvt[-2],yypvt[-3],rev(yypvt[-1]),DATATYPE);} break;
- case 51:
- # line 175 "parser.y"
- {yyval = gc2(ap(yypvt[-1],yypvt[-0]));} break;
- case 52:
- # line 176 "parser.y"
- {yyval = yypvt[-0];} break;
- case 53:
- # line 177 "parser.y"
- {syntaxError("type defn lhs");} break;
- case 54:
- # line 179 "parser.y"
- {yyval = gc2(yypvt[-0]);} break;
- case 55:
- # line 180 "parser.y"
- {yyval = gc0(SYNONYM);} break;
- case 56:
- # line 182 "parser.y"
- {yyval = gc3(cons(yypvt[-0],yypvt[-2]));} break;
- case 57:
- # line 183 "parser.y"
- {yyval = gc1(cons(yypvt[-0],NIL));} break;
- case 58:
- # line 185 "parser.y"
- {yyval = gc3(sigdecl(yypvt[-1],singleton(yypvt[-2]),
- yypvt[-0]));} break;
- case 59:
- # line 187 "parser.y"
- {yyval = yypvt[-0];} break;
- case 60:
- # line 189 "parser.y"
- {yyval = gc3(cons(yypvt[-0],yypvt[-2]));} break;
- case 61:
- # line 190 "parser.y"
- {yyval = gc1(cons(yypvt[-0],NIL));} break;
- case 62:
- # line 192 "parser.y"
- {yyval = gc3(ap(ap(yypvt[-1],yypvt[-2]),yypvt[-0]));} break;
- case 63:
- # line 193 "parser.y"
- {if (!isCon(getHead(yypvt[-0])))
- syntaxError("data constructor");
- yyval = yypvt[-0];} break;
- case 64:
- # line 196 "parser.y"
- {syntaxError("data type definition");} break;
- case 65:
- # line 198 "parser.y"
- {yyval = gc0(NIL);} break;
- case 66:
- # line 199 "parser.y"
- {yyval = gc2(singleton(yypvt[-0]));} break;
- case 67:
- # line 200 "parser.y"
- {yyval = gc4(yypvt[-1]);} break;
- case 68:
- # line 202 "parser.y"
- {yyval = gc0(NIL);} break;
- case 69:
- # line 203 "parser.y"
- {yyval = yypvt[-0];} break;
- case 70:
- # line 205 "parser.y"
- {yyval = gc3(cons(yypvt[-0],yypvt[-2]));} break;
- case 71:
- # line 206 "parser.y"
- {yyval = gc1(singleton(yypvt[-0]));} break;
- case 72:
- # line 217 "parser.y"
- {yyval = gc3(ap(QUAL,pair(yypvt[-2],yypvt[-0])));} break;
- case 73:
- # line 218 "parser.y"
- {yyval = yypvt[-0];} break;
- case 74:
- # line 220 "parser.y"
- {yyval = gc1(checkContext(yypvt[-0]));} break;
- case 75:
- # line 222 "parser.y"
- {yyval = yypvt[-0];} break;
- case 76:
- # line 223 "parser.y"
- {yyval = gc3(ap(ap(ARROW,yypvt[-2]),yypvt[-0]));} break;
- case 77:
- # line 224 "parser.y"
- {syntaxError("type expression");} break;
- case 78:
- # line 226 "parser.y"
- {yyval = gc2(ap(yypvt[-1],yypvt[-0]));} break;
- case 79:
- # line 227 "parser.y"
- {yyval = yypvt[-0];} break;
- case 80:
- # line 229 "parser.y"
- {yyval = yypvt[-0];} break;
- case 81:
- # line 230 "parser.y"
- {yyval = yypvt[-0];} break;
- case 82:
- # line 231 "parser.y"
- {yyval = gc2(UNIT);} break;
- case 83:
- # line 232 "parser.y"
- {yyval = gc3(ARROW);} break;
- case 84:
- # line 233 "parser.y"
- {yyval = gc3(yypvt[-1]);} break;
- case 85:
- # line 234 "parser.y"
- {yyval = gc3(yypvt[-1]);} break;
- case 86:
- # line 235 "parser.y"
- {yyval = gc3(buildTuple(yypvt[-1]));} break;
- case 87:
- # line 236 "parser.y"
- {yyval = gc3(ap(LIST,yypvt[-1]));} break;
- case 88:
- # line 237 "parser.y"
- {yyval = gc2(LIST);} break;
- case 89:
- # line 239 "parser.y"
- {yyval = gc3(mkTuple(tupleOf(yypvt[-1])+1));} break;
- case 90:
- # line 240 "parser.y"
- {yyval = gc1(mkTuple(2));} break;
- case 91:
- # line 242 "parser.y"
- {yyval = gc3(cons(yypvt[-0],yypvt[-2]));} break;
- case 92:
- # line 243 "parser.y"
- {yyval = gc3(cons(yypvt[-0],cons(yypvt[-2],NIL)));} break;
- case 93:
- # line 248 "parser.y"
- {fixDefn(LEFT_ASS,yypvt[-2],yypvt[-1],yypvt[-0]); sp-=3;} break;
- case 94:
- # line 249 "parser.y"
- {fixDefn(RIGHT_ASS,yypvt[-2],yypvt[-1],yypvt[-0]);sp-=3;} break;
- case 95:
- # line 250 "parser.y"
- {fixDefn(NON_ASS,yypvt[-2],yypvt[-1],yypvt[-0]); sp-=3;} break;
- case 96:
- # line 252 "parser.y"
- {yyval = gc1(checkPrec(yypvt[-0]));} break;
- case 97:
- # line 253 "parser.y"
- {yyval = gc0(mkInt(DEF_PREC));} break;
- case 98:
- # line 255 "parser.y"
- {yyval = gc3(cons(yypvt[-0],yypvt[-2]));} break;
- case 99:
- # line 256 "parser.y"
- {yyval = gc1(cons(yypvt[-0],NIL));} break;
- case 100:
- # line 258 "parser.y"
- {yyval = yypvt[-0];} break;
- case 101:
- # line 259 "parser.y"
- {yyval = yypvt[-0];} break;
- case 102:
- # line 260 "parser.y"
- {yyval = gc1(varMinus);} break;
- case 103:
- # line 262 "parser.y"
- {yyval = yypvt[-0];} break;
- case 104:
- # line 263 "parser.y"
- {yyval = gc3(yypvt[-1]);} break;
- case 105:
- # line 265 "parser.y"
- {yyval = yypvt[-0];} break;
- case 106:
- # line 266 "parser.y"
- {yyval = gc3(yypvt[-1]);} break;
- case 107:
- # line 271 "parser.y"
- {primDefn(intOf(yypvt[-3]),yypvt[-2],yypvt[-0]); sp-=4;} break;
- case 108:
- # line 273 "parser.y"
- {yyval = gc3(cons(yypvt[-0],yypvt[-2]));} break;
- case 109:
- # line 274 "parser.y"
- {yyval = gc1(cons(yypvt[-0],NIL));} break;
- case 110:
- # line 275 "parser.y"
- {syntaxError("primitive defn");} break;
- case 111:
- # line 277 "parser.y"
- {yyval = gc2(pair(yypvt[-1],yypvt[-0]));} break;
- case 112:
- # line 282 "parser.y"
- {classDefn(intOf(yypvt[-2]),yypvt[-1],yypvt[-0]); sp-=3;} break;
- case 113:
- # line 283 "parser.y"
- {instDefn(intOf(yypvt[-2]),yypvt[-1],yypvt[-0]); sp-=3;} break;
- case 114:
- # line 284 "parser.y"
- {sp-=2;} break;
- case 115:
- # line 286 "parser.y"
- {yyval = gc3(pair(yypvt[-2],checkClass(yypvt[-0])));} break;
- case 116:
- # line 287 "parser.y"
- {yyval = gc1(pair(NIL,checkClass(yypvt[-0])));} break;
- case 117:
- # line 289 "parser.y"
- {yyval = gc4(yypvt[-1]);} break;
- case 118:
- # line 290 "parser.y"
- {yyval = gc0(NIL);} break;
- case 119:
- # line 292 "parser.y"
- {yyval = gc4(yypvt[-1]);} break;
- case 120:
- # line 293 "parser.y"
- {yyval = gc0(NIL);} break;
- case 121:
- # line 295 "parser.y"
- {yyval = gc3(cons(yypvt[-0],yypvt[-2]));} break;
- case 122:
- # line 296 "parser.y"
- {yyval = gc1(cons(yypvt[-0],NIL));} break;
- case 123:
- # line 298 "parser.y"
- {yyval = gc3(sigdecl(yypvt[-1],yypvt[-2],yypvt[-0]));} break;
- case 124:
- # line 299 "parser.y"
- {yyval = gc2(pair(yypvt[-1],yypvt[-0]));} break;
- case 125:
- # line 304 "parser.y"
- {yyval = gc3(sigdecl(yypvt[-1],yypvt[-2],yypvt[-0]));} break;
- case 126:
- # line 305 "parser.y"
- {yyval = gc2(pair(yypvt[-1],yypvt[-0]));} break;
- case 127:
- # line 307 "parser.y"
- {yyval = gc3(cons(yypvt[-0],yypvt[-2]));} break;
- case 128:
- # line 308 "parser.y"
- {yyval = gc1(cons(yypvt[-0],NIL));} break;
- case 129:
- # line 310 "parser.y"
- {yyval = gc2(letrec(yypvt[-0],yypvt[-1]));} break;
- case 130:
- # line 311 "parser.y"
- {yyval = yypvt[-0];} break;
- case 131:
- # line 312 "parser.y"
- {syntaxError("declaration");} break;
- case 132:
- # line 314 "parser.y"
- {yyval = gc2(pair(yypvt[-1],yypvt[-0]));} break;
- case 133:
- # line 315 "parser.y"
- {yyval = gc1(grded(rev(yypvt[-0])));} break;
- case 134:
- # line 317 "parser.y"
- {yyval = gc4(yypvt[-1]);} break;
- case 135:
- # line 319 "parser.y"
- {yyval = gc2(cons(yypvt[-0],yypvt[-1]));} break;
- case 136:
- # line 320 "parser.y"
- {yyval = gc1(cons(yypvt[-0],NIL));} break;
- case 137:
- # line 322 "parser.y"
- {yyval = gc4(pair(yypvt[-1],pair(yypvt[-2],yypvt[-0])));} break;
- case 138:
- # line 329 "parser.y"
- {yyval = gc5(pair(yypvt[-4],pair(yypvt[-0],yypvt[-3])));} break;
- case 139:
- # line 330 "parser.y"
- {yyval = gc4(pair(yypvt[-3],pair(yypvt[-0],yypvt[-2])));} break;
- case 140:
- # line 332 "parser.y"
- {yyval = gc3(cons(yypvt[-0],yypvt[-2]));} break;
- case 141:
- # line 333 "parser.y"
- {yyval = gc1(cons(yypvt[-0],NIL));} break;
- case 142:
- # line 335 "parser.y"
- {yyval = yypvt[-0];} break;
- case 143:
- # line 336 "parser.y"
- {yyval = gc3(varMinus);} break;
- case 144:
- # line 338 "parser.y"
- {yyval = yypvt[-0];} break;
- case 145:
- # line 339 "parser.y"
- {yyval = gc3(yypvt[-1]);} break;
- case 146:
- # line 341 "parser.y"
- {yyval = yypvt[-0];} break;
- case 147:
- # line 342 "parser.y"
- {yyval = gc3(yypvt[-1]);} break;
- case 148:
- # line 347 "parser.y"
- {yyval = gc3(ap(ESIGN,pair(yypvt[-2],yypvt[-0])));} break;
- case 149:
- # line 348 "parser.y"
- {yyval = yypvt[-0];} break;
- case 150:
- # line 349 "parser.y"
- {syntaxError("expression");} break;
- case 151:
- # line 351 "parser.y"
- {yyval = yypvt[-0];} break;
- case 152:
- # line 352 "parser.y"
- {yyval = gc3(ap(ap(yypvt[-1],yypvt[-2]),yypvt[-0]));} break;
- case 153:
- # line 353 "parser.y"
- {yyval = gc1(tidyInfix(yypvt[-0]));} break;
- case 154:
- # line 355 "parser.y"
- {yyval = gc3(ap(ap(yypvt[-1],yypvt[-2]),yypvt[-0]));} break;
- case 155:
- # line 356 "parser.y"
- {yyval = gc5(ap(ap(yypvt[-1],
- ap(ap(yypvt[-3],singleton(yypvt[-4])),
- yypvt[-2])),yypvt[-0]));} break;
- case 156:
- # line 360 "parser.y"
- {if (isInt(yypvt[-0]))
- yyval = gc2(mkInt(-intOf(yypvt[-0])));
- else
- yyval = gc2(ap(varNegate,yypvt[-0]));
- } break;
- case 157:
- # line 365 "parser.y"
- {yyval = gc4(ap(LAMBDA,
- pair(rev(yypvt[-2]),
- pair(yypvt[-1],yypvt[-0]))));} break;
- case 158:
- # line 368 "parser.y"
- {yyval = gc6(letrec(yypvt[-3],yypvt[-0]));} break;
- case 159:
- # line 369 "parser.y"
- {yyval = gc6(ap(COND,triple(yypvt[-4],yypvt[-2],yypvt[-0])));} break;
- case 160:
- # line 370 "parser.y"
- {yyval = gc6(ap(CASE,pair(yypvt[-4],rev(yypvt[-1]))));} break;
- case 161:
- # line 371 "parser.y"
- {yyval = yypvt[-0];} break;
- case 162:
- # line 373 "parser.y"
- {yyval = gc2(cons(yypvt[-0],yypvt[-1]));} break;
- case 163:
- # line 374 "parser.y"
- {yyval = gc1(cons(yypvt[-0],NIL));} break;
- case 164:
- # line 376 "parser.y"
- {yyval = gc2(ap(yypvt[-1],yypvt[-0]));} break;
- case 165:
- # line 377 "parser.y"
- {yyval = yypvt[-0];} break;
- case 166:
- # line 379 "parser.y"
- {yyval = yypvt[-0];} break;
- case 167:
- # line 380 "parser.y"
- {yyval = gc3(ap(ASPAT,pair(yypvt[-2],yypvt[-0])));} break;
- case 168:
- # line 381 "parser.y"
- {yyval = gc2(ap(LAZYPAT,yypvt[-0]));} break;
- case 169:
- # line 382 "parser.y"
- {yyval = gc1(WILDCARD);} break;
- case 170:
- # line 383 "parser.y"
- {yyval = yypvt[-0];} break;
- case 171:
- # line 384 "parser.y"
- {yyval = gc2(UNIT);} break;
- case 172:
- # line 385 "parser.y"
- {yyval = yypvt[-0];} break;
- case 173:
- # line 386 "parser.y"
- {yyval = yypvt[-0];} break;
- case 174:
- # line 387 "parser.y"
- {yyval = yypvt[-0];} break;
- case 175:
- # line 388 "parser.y"
- {yyval = yypvt[-0];} break;
- case 176:
- # line 389 "parser.y"
- {yyval = gc3(yypvt[-1]);} break;
- case 177:
- # line 390 "parser.y"
- {yyval = gc3(buildTuple(yypvt[-1]));} break;
- case 178:
- # line 391 "parser.y"
- {yyval = gc3(yypvt[-1]);} break;
- case 179:
- # line 392 "parser.y"
- {yyval = gc4(ap(yypvt[-1],yypvt[-2]));} break;
- case 180:
- # line 393 "parser.y"
- {yyval = gc4(ap(ap(varFlip,yypvt[-2]),yypvt[-1]));} break;
- case 181:
- # line 394 "parser.y"
- {yyval = gc4(ap(ap(varFlip,yypvt[-2]),yypvt[-1]));} break;
- case 182:
- # line 396 "parser.y"
- {yyval = gc3(cons(yypvt[-0],yypvt[-2]));} break;
- case 183:
- # line 397 "parser.y"
- {yyval = gc3(cons(yypvt[-0],cons(yypvt[-2],NIL)));} break;
- case 184:
- # line 399 "parser.y"
- {yyval = gc3(cons(yypvt[-0],yypvt[-2]));} break;
- case 185:
- # line 400 "parser.y"
- {yyval = gc1(cons(yypvt[-0],NIL));} break;
- case 186:
- # line 402 "parser.y"
- {yyval = gc2(pair(yypvt[-1],yypvt[-0]));} break;
- case 187:
- # line 404 "parser.y"
- {yyval = gc2(letrec(yypvt[-0],yypvt[-1]));} break;
- case 188:
- # line 405 "parser.y"
- {yyval = yypvt[-0];} break;
- case 189:
- # line 407 "parser.y"
- {yyval = gc1(grded(rev(yypvt[-0])));} break;
- case 190:
- # line 408 "parser.y"
- {yyval = gc2(pair(yypvt[-1],yypvt[-0]));} break;
- case 191:
- # line 409 "parser.y"
- {syntaxError("case expression");} break;
- case 192:
- # line 411 "parser.y"
- {yyval = gc2(cons(yypvt[-0],yypvt[-1]));} break;
- case 193:
- # line 412 "parser.y"
- {yyval = gc1(cons(yypvt[-0],NIL));} break;
- case 194:
- # line 414 "parser.y"
- {yyval = gc4(pair(yypvt[-1],pair(yypvt[-2],yypvt[-0])));} break;
- case 195:
- # line 419 "parser.y"
- {yyval = gc0(nameNil);} break;
- case 196:
- # line 420 "parser.y"
- {yyval = gc1(ap(FINLIST,cons(yypvt[-0],NIL)));} break;
- case 197:
- # line 421 "parser.y"
- {yyval = gc1(ap(FINLIST,rev(yypvt[-0])));} break;
- case 198:
- # line 422 "parser.y"
- {yyval = gc3(ap(COMP,pair(yypvt[-2],rev(yypvt[-0]))));} break;
- case 199:
- # line 423 "parser.y"
- {yyval = gc3(ap(ap(varFromTo,yypvt[-2]),yypvt[-0]));} break;
- case 200:
- # line 424 "parser.y"
- {yyval = gc4(ap(ap(varFromThen,yypvt[-3]),yypvt[-1]));} break;
- case 201:
- # line 425 "parser.y"
- {yyval = gc2(ap(varFrom,yypvt[-1]));} break;
- case 202:
- # line 426 "parser.y"
- {yyval = gc5(ap(ap(ap(varFromThenTo,
- yypvt[-4]),yypvt[-2]),yypvt[-0]));} break;
- case 203:
- # line 429 "parser.y"
- {yyval = gc3(cons(yypvt[-0],yypvt[-2]));} break;
- case 204:
- # line 430 "parser.y"
- {yyval = gc1(cons(yypvt[-0],NIL));} break;
- case 205:
- # line 432 "parser.y"
- {yyval = gc3(ap(FROMQUAL,pair(yypvt[-2],yypvt[-0])));} break;
- case 206:
- # line 433 "parser.y"
- {yyval = gc3(ap(QWHERE,
- singleton(
- pair(yypvt[-2],pair(yypvt[-1],
- yypvt[-0])))));} break;
- case 207:
- # line 437 "parser.y"
- {yyval = gc1(ap(BOOLQUAL,yypvt[-0]));} break;
- case 208:
- # line 438 "parser.y"
- {yyval = gc4(ap(QWHERE,yypvt[-1]));} break;
- case 209:
- # line 478 "parser.y"
- {yyval = gc6(ap(COMP,pair(yypvt[-0],rev(yypvt[-3]))));} break;
- case 210:
- # line 479 "parser.y"
- {yyval = gc5(ap(COMP,pair(UNIT,rev(yypvt[-2]))));} break;
- case 211:
- # line 481 "parser.y"
- {yyval = gc3(cons(yypvt[-0],yypvt[-2]));} break;
- case 212:
- # line 482 "parser.y"
- {yyval = gc1(cons(yypvt[-0],NIL));} break;
- case 213:
- # line 484 "parser.y"
- {yyval = gc3(ap(FROMQUAL,pair(yypvt[-2],yypvt[-0])));} break;
- case 214:
- # line 485 "parser.y"
- {yyval = gc1(ap(FROMQUAL,
- pair(WILDCARD,yypvt[-0])));} break;
- case 215:
- # line 487 "parser.y"
- {yyval = gc2(ap(BOOLQUAL,yypvt[-0]));} break;
- case 216:
- # line 488 "parser.y"
- {yyval = gc4(ap(QWHERE,yypvt[-1]));} break;
- case 217:
- # line 494 "parser.y"
- {yyval = gc2(yypvt[-0]);} break;
- case 218:
- # line 495 "parser.y"
- {yyval = yypvt[-0];} break;
- case 219:
- # line 497 "parser.y"
- {yyval = yypvt[-0];} break;
- case 220:
- # line 498 "parser.y"
- {yyerrok;
- if (canUnOffside()) {
- unOffside();
- /* insert extra token on stack*/
- push(NIL);
- pushed(0) = pushed(1);
- pushed(1) = mkInt(column);
- }
- else
- syntaxError("definition");
- } break;
- }
- goto yystack; /* reset registers in driver code */
- }
-
-