home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-02-12 | 42.9 KB | 1,520 lines |
- /* A YACC parser generated from "parser.y" */
-
- # line 19
- #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));
- static Cell local buildTuple Args((List));
- 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 PRIMITIVE 287
- #define DEFAULT 288
- #define DERIVING 289
- #define HIDING 290
- #define IMPORT 291
- #define INTERFACE 292
- #define MODULE 293
- #define RENAMING 294
- #define TO 295
- #define yyclearin yychar = -1
- #define yyerrok yyerrflag = 0
- extern int yychar;
- extern short yyerrflag;
- #ifndef YYMAXDEPTH
- #define YYMAXDEPTH 150
- #endif
- #ifndef YYSTYPE
- #define YYSTYPE int
- #endif
- YYSTYPE yylval, yyval;
- # define YYERRCODE 256
-
- #line 458
-
-
- 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 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);
- }
-
- static Cell local buildTuple(tup) /* build tuple (x1,...,xn) from list*/
- 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;
- }
-
- /*-------------------------------------------------------------------------*/
- short yyexca[] ={
- -1, 1,
- 0, -1,
- -2, 0,
- -1, 84,
- 259, 141,
- 44, 141,
- -2, 166,
- -1, 93,
- 285, 74,
- -2, 73,
- -1, 148,
- 285, 74,
- -2, 116,
- -1, 229,
- 264, 19,
- -2, 41,
- -1, 264,
- 282, 77,
- -2, 64,
- };
- #define YYNPROD 213
- # define YYLAST 747
- short yyact[]={
-
- 17, 309, 91, 93, 153, 338, 190, 20, 128, 5,
- 332, 360, 82, 359, 126, 254, 262, 33, 35, 304,
- 51, 52, 198, 213, 323, 21, 112, 290, 60, 163,
- 36, 226, 84, 66, 132, 87, 135, 246, 378, 42,
- 102, 365, 355, 6, 306, 208, 103, 369, 138, 342,
- 243, 84, 302, 37, 35, 223, 215, 99, 89, 89,
- 212, 88, 88, 134, 244, 225, 109, 110, 209, 145,
- 145, 277, 248, 107, 291, 83, 26, 356, 68, 144,
- 19, 362, 38, 148, 148, 150, 202, 221, 145, 158,
- 44, 84, 69, 99, 83, 4, 2, 3, 291, 274,
- 21, 270, 268, 168, 172, 96, 252, 176, 100, 152,
- 173, 18, 177, 201, 209, 181, 180, 175, 199, 90,
- 50, 257, 179, 182, 189, 183, 240, 122, 84, 133,
- 187, 54, 192, 273, 83, 146, 195, 15, 92, 377,
- 361, 99, 166, 251, 100, 171, 357, 152, 47, 358,
- 159, 26, 123, 217, 216, 19, 207, 271, 152, 137,
- 21, 156, 228, 219, 162, 10, 222, 231, 232, 352,
- 335, 83, 353, 300, 300, 265, 249, 230, 127, 84,
- 275, 118, 376, 276, 305, 218, 18, 195, 142, 99,
- 323, 278, 100, 178, 47, 238, 114, 21, 239, 228,
- 165, 354, 10, 260, 136, 263, 289, 351, 144, 299,
- 266, 26, 11, 288, 145, 19, 149, 269, 147, 147,
- 193, 113, 83, 112, 159, 247, 204, 205, 272, 233,
- 258, 186, 124, 21, 59, 185, 139, 140, 56, 279,
- 100, 297, 255, 280, 129, 129, 18, 220, 26, 11,
- 281, 282, 19, 84, 161, 292, 228, 294, 295, 129,
- 283, 29, 29, 22, 23, 24, 25, 28, 28, 84,
- 43, 84, 197, 95, 188, 84, 45, 228, 314, 324,
- 315, 310, 99, 18, 26, 11, 321, 258, 19, 44,
- 28, 322, 341, 195, 97, 328, 83, 21, 333, 210,
- 98, 228, 10, 339, 143, 334, 29, 29, 263, 95,
- 343, 330, 311, 259, 83, 327, 347, 326, 83, 18,
- 349, 340, 325, 344, 346, 29, 296, 348, 247, 200,
- 97, 350, 336, 100, 200, 329, 98, 29, 22, 23,
- 24, 25, 317, 28, 312, 210, 84, 366, 26, 11,
- 367, 355, 19, 316, 195, 250, 155, 95, 310, 333,
- 372, 368, 339, 370, 167, 375, 334, 374, 373, 371,
- 21, 206, 125, 151, 293, 130, 130, 298, 97, 287,
- 75, 76, 77, 18, 98, 14, 345, 13, 108, 311,
- 130, 73, 74, 286, 12, 285, 267, 29, 22, 23,
- 24, 25, 284, 28, 79, 264, 80, 78, 81, 236,
- 21, 72, 237, 71, 318, 10, 65, 75, 76, 77,
- 70, 26, 14, 245, 13, 19, 97, 29, 73, 74,
- 48, 12, 98, 28, 29, 22, 23, 24, 25, 9,
- 28, 79, 21, 80, 78, 81, 27, 10, 72, 7,
- 227, 29, 129, 157, 89, 34, 18, 229, 14, 21,
- 13, 26, 11, 234, 10, 19, 235, 12, 129, 57,
- 29, 22, 23, 24, 25, 58, 28, 61, 21, 184,
- 203, 117, 115, 10, 118, 116, 86, 41, 85, 39,
- 46, 154, 308, 26, 11, 129, 18, 19, 21, 8,
- 214, 211, 141, 10, 67, 164, 170, 169, 94, 64,
- 26, 11, 364, 7, 19, 363, 194, 337, 303, 97,
- 40, 62, 14, 131, 13, 98, 261, 301, 18, 26,
- 11, 12, 16, 19, 29, 22, 23, 24, 25, 101,
- 28, 320, 63, 119, 49, 18, 104, 319, 53, 26,
- 11, 55, 331, 19, 256, 224, 253, 196, 160, 32,
- 31, 30, 1, 0, 18, 0, 0, 242, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 53, 106, 174, 130, 18, 0, 0, 111, 0, 0,
- 0, 0, 0, 105, 0, 0, 120, 121, 0, 130,
- 0, 0, 0, 0, 0, 0, 0, 29, 22, 23,
- 24, 25, 0, 28, 0, 0, 0, 0, 0, 101,
- 0, 0, 0, 0, 0, 0, 130, 0, 0, 0,
- 0, 0, 0, 0, 0, 14, 0, 13, 0, 0,
- 0, 0, 0, 0, 12, 0, 0, 29, 22, 23,
- 24, 25, 0, 28, 0, 0, 0, 0, 7, 0,
- 0, 0, 0, 70, 0, 0, 0, 14, 0, 313,
- 0, 0, 0, 0, 241, 7, 12, 0, 0, 29,
- 22, 23, 24, 25, 14, 28, 13, 0, 0, 0,
- 0, 0, 0, 191, 0, 0, 29, 22, 23, 24,
- 25, 0, 28, 14, 0, 13, 0, 0, 0, 0,
- 0, 0, 12, 0, 0, 29, 22, 23, 24, 25,
- 0, 28, 0, 14, 0, 13, 0, 0, 0, 0,
- 0, 0, 12, 0, 0, 29, 22, 23, 24, 25,
- 0, 28, 0, 0, 0, 0, 307 };
- short yypact[]={
-
- -161,-1000, 257,-239,-1000,-217,-177,-1000, -6, -6,
- 60, 60, -3, 257, 257, 60,-1000, 67, 60,-1000,
- -1000, 193,-1000,-1000,-1000,-1000, 257,-1000,-1000,-1000,
- -1000, 157,-275,-1000,-1000,-221,-1000, -4, 53, 458,
- -1000,-1000,-1000,-1000,-237,-1000, 458, 60, 330,-1000,
- 458,-202,-199,-1000, 60,-1000, -15, 180, 155,-1000,
- 441, 440, -6, 60, 60, 34, 108, 137, 119,-1000,
- -1000,-1000,-222,-220,-220,-230,-230,-230, 48, 53,
- 53, 53, 114, 100, 67,-1000, 214,-1000,-1000,-1000,
- 458,-1000,-256,-1000, 242,-1000,-1000,-1000,-1000, 101,
- 17, -6, 21, 11,-1000, 257,-1000, 134,-1000, 257,
- -8,-1000,-1000,-1000,-1000,-1000, 257,-1000, 257, 438,
- 194, 190,-1000, 257, 419, 257,-1000, 120,-1000,-1000,
- -1000, -18,-1000, 57,-1000,-1000, 52, -6,-1000, -6,
- -6, 112,-1000,-1000,-235, 23,-210,-262,-1000,-214,
- -1000, 53, 29,-1000,-217,-1000, 257, 26,-1000, 257,
- -215, 174, 134, 53, 53,-1000,-1000, 188, 422, 368,
- 154,-1000, 33,-1000, 458,-1000,-1000,-1000, 370,-225,
- -205, 458,-1000,-1000,-1000,-1000,-1000,-192, 132,-1000,
- 82, -17,-1000,-1000,-1000,-1000,-279, 202, 30, 53,
- -1000, 149, 131,-1000, 131, 131, 53, 29,-1000, 182,
- 180,-1000, -21, 53,-1000, -22,-1000,-1000,-1000, 113,
- -1000, 257, 72, -24, 139,-1000,-1000,-193,-1000, 151,
- -1000,-1000,-1000,-1000,-1000, 53,-1000,-1000,-1000, 53,
- -1000,-1000,-1000, 257, 257, 343,-1000, -50, 257, 419,
- 257, 257, 458,-1000, 201, 30, 168, 130,-1000, 151,
- -223,-105,-1000,-238,-1000, -6,-1000,-1000, 458,-1000,
- 458, 402, 113, 257, 157,-1000, 174,-1000, 150,-1000,
- -1000,-1000,-1000,-1000, 370,-1000,-217, -26, 257,-1000,
- -1000, 458,-1000,-1000,-1000,-1000, 134, -16, 129,-1000,
- 30,-1000, 29,-1000, 149, 9, 53,-1000, 327,-1000,
- 65, 100, 134, 257,-1000,-1000, 119,-1000, 166, 128,
- 160,-1000, 103, 69,-1000,-1000,-1000,-1000,-1000,-186,
- -225, 105,-1000,-282,-284,-1000,-1000, 96,-1000,-178,
- -1000,-1000,-242,-1000,-1000, 370, 53,-1000,-1000,-202,
- -1000,-1000,-1000, 7,-1000, 155, 257,-1000, -16, 29,
- 7, 29, 53, 141, 95,-1000,-1000,-1000,-1000,-240,
- -1000,-1000,-1000,-1000,-1000,-1000,-1000,-245,-1000 };
- short yypgo[]={
-
- 0, 562, 6, 30, 561, 560, 78, 14, 559, 92,
- 388, 455, 450, 558, 557, 556, 555, 65, 31, 121,
- 554, 552, 10, 0, 7, 547, 541, 12, 129, 3,
- 527, 526, 518, 517, 5, 2, 16, 515, 512, 138,
- 508, 105, 507, 506, 159, 86, 480, 520, 487, 502,
- 188, 135, 501, 500, 492, 73, 1, 43, 4, 491,
- 453, 89, 446, 499, 439, 137, 430, 423, 532, 477,
- 416, 37, 395, 393, 379, 27, 274, 124, 8 };
- short 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, 7,
- 7, 78, 78 };
- short yyr2[]={
-
- 0, 2, 3, 2, 1, 3, 1, 1, 3, 3,
- 1, 1, 1, 2, 1, 7, 2, 4, 2, 1,
- 1, 0, 3, 3, 1, 1, 2, 0, 4, 3,
- 0, 1, 3, 1, 0, 4, 3, 1, 3, 3,
- 1, 1, 4, 4, 4, 3, 1, 0, 1, 5,
- 5, 2, 1, 1, 2, 0, 3, 1, 3, 1,
- 3, 1, 3, 1, 1, 0, 2, 4, 0, 1,
- 3, 1, 3, 1, 1, 1, 3, 1, 2, 1,
- 1, 1, 2, 3, 3, 3, 3, 3, 2, 2,
- 1, 3, 3, 3, 3, 3, 1, 0, 3, 1,
- 1, 1, 1, 1, 3, 1, 3, 4, 3, 1,
- 1, 2, 3, 3, 2, 3, 1, 4, 0, 4,
- 0, 3, 1, 3, 2, 3, 2, 3, 1, 2,
- 1, 1, 2, 1, 4, 2, 1, 4, 5, 4,
- 3, 1, 1, 3, 1, 3, 1, 3, 3, 1,
- 1, 1, 3, 1, 3, 5, 2, 4, 6, 6,
- 6, 1, 2, 1, 2, 1, 1, 3, 2, 1,
- 1, 2, 1, 1, 1, 1, 3, 3, 3, 4,
- 4, 4, 3, 3, 3, 1, 2, 2, 1, 1,
- 2, 1, 2, 1, 4, 0, 1, 1, 3, 3,
- 4, 2, 5, 3, 1, 3, 3, 1, 4, 2,
- 1, 1, 1 };
- short yychk[]={
-
- -1000, -1, 257, 258, 256, -2, -57, 256, -63, -64,
- 45, 92, 274, 267, 265, -65, -68, -23, 126, 95,
- -24, 40, 278, 279, 280, 281, 91, -62, 283, 277,
- -4, -5, -8, 256, -11, 293, -3, 270, 259, -46,
- -47, -48, 45, 276, 96, 282, -46, -65, -66, -68,
- 123, -2, -2, -68, 64, -68, 45, 276, 282, 41,
- -2, -69, -63, -47, -48, -70, -2, -69, -6, -9,
- -10, 256, 291, 271, 272, 260, 261, 262, 287, 284,
- 286, 288, -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, -68, 41, 41, 41, 41, 44, 41, 44, -46,
- -68, -68, 93, 44, 124, 264, -7, 59, -78, 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, -2, -2, 41, 41, 41, -2, -76, -77,
- -2, 274, -2, -9, -10, -78, -14, 290, 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, 264, 44,
- 273, 61, 123, -15, 294, 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, -77, -2, -2, -55, 40, -19, 41,
- 44, -30, 275, -32, 124, 289, 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, 295,
- 295, 44, 259, -37, -38, 283, -56, -29, -24, 40,
- -2, -22, -23, -24, -34, -35, 41, 44, 283 };
- short yydef[]={
-
- 0, -2, 0, 0, 4, 1, 149, 150, 151, 153,
- 0, 0, 0, 0, 0, 161, 165, 166, 0, 169,
- 170, 0, 172, 173, 174, 175, 195, 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, 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, 167, 143, 145, 147, 176, 0, 177, 0, 0,
- 0, 0, 178, 0, 0, 201, 5, 0, 210, 211,
- 212, 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, 183, 182, 179, 180, 181, 183, 198, 204,
- 207, 0, 199, 8, 9, 209, 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, 200, 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, 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 };
- #define YYFLAG -1000
- #define YYERROR goto yyerrlab
- #define YYACCEPT return(0)
- #define YYABORT return(1)
-
- /* parser for yacc output */
-
- #ifdef YYDEBUG
- int yydebug = 0; /* 1 for debugging */
- #endif
- YYSTYPE yyv[YYMAXDEPTH]; /* where the values are stored */
- int yychar = -1; /* current input token number */
- int yynerrs = 0; /* number of errors */
- short yyerrflag = 0; /* error recovery flag */
-
- int yyparse() {
- short yys[YYMAXDEPTH];
- short yyj, yym;
- register YYSTYPE *yypvt;
- register short yystate, *yyps, yyn;
- register YYSTYPE *yypv;
- register short *yyxi;
-
- yystate = 0;
- yychar = -1;
- yynerrs = 0;
- yyerrflag = 0;
- yyps = &yys[-1];
- yypv = &yyv[-1];
-
- yystack: /* put a state and value onto the stack */
-
- #ifdef YYDEBUG
- if (yydebug)
- printf("state %d, char 0%o\n", yystate, yychar);
- #endif
- if(++yyps>&yys[YYMAXDEPTH]) {
- yyerror("yacc stack overflow");
- return(1);
- }
- *yyps = yystate;
- ++yypv;
- #ifdef UNION
- yyunion(yypv, &yyval);
- #else
- *yypv = yyval;
- #endif
-
- yynewstate:
-
- yyn = yypact[yystate];
-
- if (yyn<=YYFLAG)
- goto yydefault; /* simple state */
-
- if (yychar<0)
- if ((yychar=yylex())<0)
- yychar=0;
- if ((yyn+=yychar)<0 || yyn>=YYLAST)
- goto yydefault;
-
- if (yychk[yyn=yyact[yyn]]==yychar) {
- /* valid shift */
- yychar = -1;
- #ifdef UNION
- yyunion(&yyval, &yylval);
- #else
- yyval = yylval;
- #endif
- yystate = yyn;
- if (yyerrflag>0)
- --yyerrflag;
- goto yystack;
-
- }
-
- yydefault:
-
- /* default state action */
-
- if ((yyn=yydef[yystate])== -2) {
- if (yychar<0)
- if ((yychar=yylex())<0)
- yychar = 0;
- /* look through exception table */
-
- for (yyxi=yyexca; (*yyxi!= (-1)) || (yyxi[1]!=yystate) ; yyxi += 2)
- ; /* VOID */
-
- for (yyxi+=2; *yyxi >= 0; yyxi+=2) {
- if (*yyxi==yychar)
- break;
- }
- if ((yyn=yyxi[1])<0)
- return(0); /* accept */
- }
-
- if (yyn==0) {
- /* error */
- /* error ... attempt to resume parsing */
-
- switch (yyerrflag) {
- case 0: /* brand new error */
- yyerror( "syntax error" );
-
- yyerrlab: ++yynerrs;
-
- case 1:
- case 2: /* incompletely recovered error ... try again */
-
- yyerrflag = 3;
-
- /* find a state where "error" is a legal shift action */
-
- while (yyps>=yys) {
- yyn = yypact[*yyps] + YYERRCODE;
- if (yyn>=0 && yyn<YYLAST
- && yychk[yyact[yyn]]==YYERRCODE) {
- yystate = yyact[yyn];
- /* simulate a shift of "error" */
- goto yystack;
- }
- yyn = yypact[*yyps];
-
- /* the current yyps has no shift on "error",
- pop stack */
-
- #ifdef YYDEBUG
- if (yydebug)
- printf("error recovery pops state %d, uncovers %d\n", *yyps, yyps[-1]);
- #endif
-
- --yyps;
- --yypv;
- }
-
- /* there is no state on the stack with an error shift
- ... abort */
-
- yyabort: return(1);
-
-
- case 3: /* no shift yet; clobber input char */
- #ifdef YYDEBUG
- if (yydebug)
- printf("error recovery discards char %d\n", yychar);
- #endif
-
- if (yychar==0)
- goto yyabort; /* don't discard EOF, quit */
- yychar = -1;
- goto yynewstate; /* try again in the same state */
- }
- }
-
- /* reduction by production yyn */
-
- #ifdef YYDEBUG
- if (yydebug)
- printf("reduce %d\n",yyn);
- #endif
- yyps -= yyr2[yyn];
- yypvt = yypv;
- yypv -= yyr2[yyn];
- #ifdef UNION
- yyunion(&yyval, &yypv[1]);
- #else
- yyval = yypv[1];
- #endif
- yym=yyn;
- /* consult goto table to find next state */
- yyn = yyr1[yyn];
- yyj = yypgo[yyn] + *yyps + 1;
- if (yyj>=YYLAST || yychk[yystate=yyact[yyj]]!= -yyn)
- yystate = yyact[yypgo[yyn]];
- switch(yym) {
-
- case 1:
- # line 83
- {inputExpr = yypvt[-0]; sp-=1;} break;
- case 2:
- # line 84
- {inputExpr = letrec(yypvt[-0],yypvt[-1]); sp-=2;} break;
- case 3:
- # line 85
- {valDefns = yypvt[-0]; sp-=1;} break;
- case 4:
- # line 86
- {syntaxError("input");} break;
- case 5:
- # line 99
- {yyval = gc2(yypvt[-1]);} break;
- case 6:
- # line 100
- {yyval = yypvt[-0];} break;
- case 7:
- # line 102
- {yyerrok; goOffside(startColumn);} break;
- case 8:
- # line 104
- {yyval = gc2(yypvt[-2]);} break;
- case 9:
- # line 105
- {yyval = gc3(cons(yypvt[-0],yypvt[-2]));} break;
- case 10:
- # line 106
- {yyval = gc0(NIL);} break;
- case 11:
- # line 107
- {yyval = gc1(cons(yypvt[-0],NIL));} break;
- case 12:
- # line 108
- {syntaxError("definition");} break;
- case 13:
- # line 110
- {yyval = gc2(appendOnto(yypvt[-0],yypvt[-1]));} break;
- case 14:
- # line 111
- {yyval = yypvt[-0];} break;
- case 15:
- # line 114
- {yyval = gc7(yypvt[-1]);} break;
- case 16:
- # line 115
- {syntaxError("module definition");} break;
- case 17:
- # line 117
- {sp-=4;} break;
- case 18:
- # line 118
- {syntaxError("import declaration");} break;
- case 19:
- # line 120
- {yyval = yypvt[-0];} break;
- case 20:
- # line 121
- {yyval = yypvt[-0];} break;
- case 21:
- # line 123
- {yyval = gc0(NIL);} break;
- case 22:
- # line 124
- {yyval = gc3(NIL);} break;
- case 23:
- # line 126
- {yyval = gc3(NIL);} break;
- case 24:
- # line 127
- {yyval = yypvt[-0];} break;
- case 25:
- # line 129
- {yyval = yypvt[-0];} break;
- case 26:
- # line 130
- {yyval = gc2(NIL);} break;
- case 27:
- # line 132
- {yyval = gc0(NIL);} break;
- case 28:
- # line 133
- {yyval = gc4(NIL);} break;
- case 29:
- # line 134
- {yyval = gc3(NIL);} break;
- case 30:
- # line 136
- {yyval = gc0(NIL);} break;
- case 31:
- # line 137
- {yyval = yypvt[-0];} break;
- case 32:
- # line 139
- {yyval = gc3(NIL);} break;
- case 33:
- # line 140
- {yyval = yypvt[-0];} break;
- case 34:
- # line 142
- {yyval = gc0(NIL);} break;
- case 35:
- # line 143
- {yyval = gc4(NIL);} break;
- case 36:
- # line 145
- {yyval = gc3(NIL);} break;
- case 37:
- # line 146
- {yyval = yypvt[-0];} break;
- case 38:
- # line 148
- {yyval = gc3(NIL);} break;
- case 39:
- # line 149
- {yyval = gc3(NIL);} break;
- case 40:
- # line 151
- {yyval = yypvt[-0];} break;
- case 41:
- # line 152
- {yyval = yypvt[-0];} break;
- case 42:
- # line 153
- {yyval = gc4(NIL);} break;
- case 43:
- # line 154
- {yyval = gc4(NIL);} break;
- case 44:
- # line 155
- {yyval = gc4(NIL);} break;
- case 45:
- # line 157
- {yyval = gc3(NIL);} break;
- case 46:
- # line 158
- {yyval = yypvt[-0];} break;
- case 47:
- # line 160
- {yyval = gc0(NIL);} break;
- case 48:
- # line 161
- {yyval = yypvt[-0];} break;
- case 49:
- # line 166
- {defTycon(5,yypvt[-2],yypvt[-3],yypvt[-1],yypvt[-0]);} break;
- case 50:
- # line 168
- {defTycon(5,yypvt[-2],yypvt[-3],rev(yypvt[-1]),DATATYPE);} break;
- case 51:
- # line 170
- {yyval = gc2(ap(yypvt[-1],yypvt[-0]));} break;
- case 52:
- # line 171
- {yyval = yypvt[-0];} break;
- case 53:
- # line 172
- {syntaxError("type defn lhs");} break;
- case 54:
- # line 174
- {yyval = gc2(yypvt[-0]);} break;
- case 55:
- # line 175
- {yyval = gc0(SYNONYM);} break;
- case 56:
- # line 177
- {yyval = gc3(cons(yypvt[-0],yypvt[-2]));} break;
- case 57:
- # line 178
- {yyval = gc1(cons(yypvt[-0],NIL));} break;
- case 58:
- # line 180
- {yyval = gc3(sigdecl(yypvt[-1],singleton(yypvt[-2]),
- yypvt[-0]));} break;
- case 59:
- # line 182
- {yyval = yypvt[-0];} break;
- case 60:
- # line 184
- {yyval = gc3(cons(yypvt[-0],yypvt[-2]));} break;
- case 61:
- # line 185
- {yyval = gc1(cons(yypvt[-0],NIL));} break;
- case 62:
- # line 187
- {yyval = gc3(ap(ap(yypvt[-1],yypvt[-2]),yypvt[-0]));} break;
- case 63:
- # line 188
- {if (!isCon(getHead(yypvt[-0])))
- syntaxError("data constructor");
- yyval = yypvt[-0];} break;
- case 64:
- # line 191
- {syntaxError("data type definition");} break;
- case 65:
- # line 193
- {yyval = gc0(NIL);} break;
- case 66:
- # line 194
- {yyval = gc2(singleton(yypvt[-0]));} break;
- case 67:
- # line 195
- {yyval = gc4(yypvt[-1]);} break;
- case 68:
- # line 197
- {yyval = gc0(NIL);} break;
- case 69:
- # line 198
- {yyval = yypvt[-0];} break;
- case 70:
- # line 200
- {yyval = gc3(cons(yypvt[-0],yypvt[-2]));} break;
- case 71:
- # line 201
- {yyval = gc1(singleton(yypvt[-0]));} break;
- case 72:
- # line 212
- {yyval = gc3(ap(QUAL,pair(yypvt[-2],yypvt[-0])));} break;
- case 73:
- # line 213
- {yyval = yypvt[-0];} break;
- case 74:
- # line 215
- {yyval = gc1(checkContext(yypvt[-0]));} break;
- case 75:
- # line 217
- {yyval = yypvt[-0];} break;
- case 76:
- # line 218
- {yyval = gc3(ap(ap(ARROW,yypvt[-2]),yypvt[-0]));} break;
- case 77:
- # line 219
- {syntaxError("type expression");} break;
- case 78:
- # line 221
- {yyval = gc2(ap(yypvt[-1],yypvt[-0]));} break;
- case 79:
- # line 222
- {yyval = yypvt[-0];} break;
- case 80:
- # line 224
- {yyval = yypvt[-0];} break;
- case 81:
- # line 225
- {yyval = yypvt[-0];} break;
- case 82:
- # line 226
- {yyval = gc2(UNIT);} break;
- case 83:
- # line 227
- {yyval = gc3(ARROW);} break;
- case 84:
- # line 228
- {yyval = gc3(yypvt[-1]);} break;
- case 85:
- # line 229
- {yyval = gc3(yypvt[-1]);} break;
- case 86:
- # line 230
- {yyval = gc3(buildTuple(yypvt[-1]));} break;
- case 87:
- # line 231
- {yyval = gc3(ap(LIST,yypvt[-1]));} break;
- case 88:
- # line 232
- {yyval = gc2(LIST);} break;
- case 89:
- # line 234
- {yyval = gc3(mkTuple(tupleOf(yypvt[-1])+1));} break;
- case 90:
- # line 235
- {yyval = gc1(mkTuple(2));} break;
- case 91:
- # line 237
- {yyval = gc3(cons(yypvt[-0],yypvt[-2]));} break;
- case 92:
- # line 238
- {yyval = gc3(cons(yypvt[-0],cons(yypvt[-2],NIL)));} break;
- case 93:
- # line 243
- {fixDefn(LEFT_ASS,yypvt[-2],yypvt[-1],yypvt[-0]); sp-=3;} break;
- case 94:
- # line 244
- {fixDefn(RIGHT_ASS,yypvt[-2],yypvt[-1],yypvt[-0]);sp-=3;} break;
- case 95:
- # line 245
- {fixDefn(NON_ASS,yypvt[-2],yypvt[-1],yypvt[-0]); sp-=3;} break;
- case 96:
- # line 247
- {yyval = gc1(checkPrec(yypvt[-0]));} break;
- case 97:
- # line 248
- {yyval = gc0(mkInt(DEF_PREC));} break;
- case 98:
- # line 250
- {yyval = gc3(cons(yypvt[-0],yypvt[-2]));} break;
- case 99:
- # line 251
- {yyval = gc1(cons(yypvt[-0],NIL));} break;
- case 100:
- # line 253
- {yyval = yypvt[-0];} break;
- case 101:
- # line 254
- {yyval = yypvt[-0];} break;
- case 102:
- # line 255
- {yyval = gc1(varMinus);} break;
- case 103:
- # line 257
- {yyval = yypvt[-0];} break;
- case 104:
- # line 258
- {yyval = gc3(yypvt[-1]);} break;
- case 105:
- # line 260
- {yyval = yypvt[-0];} break;
- case 106:
- # line 261
- {yyval = gc3(yypvt[-1]);} break;
- case 107:
- # line 266
- {primDefn(intOf(yypvt[-3]),yypvt[-2],yypvt[-0]); sp-=4;} break;
- case 108:
- # line 268
- {yyval = gc3(cons(yypvt[-0],yypvt[-2]));} break;
- case 109:
- # line 269
- {yyval = gc1(cons(yypvt[-0],NIL));} break;
- case 110:
- # line 270
- {syntaxError("primitive defn");} break;
- case 111:
- # line 272
- {yyval = gc2(pair(yypvt[-1],yypvt[-0]));} break;
- case 112:
- # line 277
- {classDefn(intOf(yypvt[-2]),yypvt[-1],yypvt[-0]); sp-=3;} break;
- case 113:
- # line 278
- {instDefn(intOf(yypvt[-2]),yypvt[-1],yypvt[-0]); sp-=3;} break;
- case 114:
- # line 279
- {sp-=2;} break;
- case 115:
- # line 281
- {yyval = gc3(pair(yypvt[-2],checkClass(yypvt[-0])));} break;
- case 116:
- # line 282
- {yyval = gc1(pair(NIL,checkClass(yypvt[-0])));} break;
- case 117:
- # line 284
- {yyval = gc4(yypvt[-1]);} break;
- case 118:
- # line 285
- {yyval = gc0(NIL);} break;
- case 119:
- # line 287
- {yyval = gc4(yypvt[-1]);} break;
- case 120:
- # line 288
- {yyval = gc0(NIL);} break;
- case 121:
- # line 290
- {yyval = gc3(cons(yypvt[-0],yypvt[-2]));} break;
- case 122:
- # line 291
- {yyval = gc1(cons(yypvt[-0],NIL));} break;
- case 123:
- # line 293
- {yyval = gc3(sigdecl(yypvt[-1],yypvt[-2],yypvt[-0]));} break;
- case 124:
- # line 294
- {yyval = gc2(pair(yypvt[-1],yypvt[-0]));} break;
- case 125:
- # line 299
- {yyval = gc3(sigdecl(yypvt[-1],yypvt[-2],yypvt[-0]));} break;
- case 126:
- # line 300
- {yyval = gc2(pair(yypvt[-1],yypvt[-0]));} break;
- case 127:
- # line 302
- {yyval = gc3(cons(yypvt[-0],yypvt[-2]));} break;
- case 128:
- # line 303
- {yyval = gc1(cons(yypvt[-0],NIL));} break;
- case 129:
- # line 305
- {yyval = gc2(letrec(yypvt[-0],yypvt[-1]));} break;
- case 130:
- # line 306
- {yyval = yypvt[-0];} break;
- case 131:
- # line 307
- {syntaxError("declaration");} break;
- case 132:
- # line 309
- {yyval = gc2(pair(yypvt[-1],yypvt[-0]));} break;
- case 133:
- # line 310
- {yyval = gc1(grded(rev(yypvt[-0])));} break;
- case 134:
- # line 312
- {yyval = gc4(yypvt[-1]);} break;
- case 135:
- # line 314
- {yyval = gc2(cons(yypvt[-0],yypvt[-1]));} break;
- case 136:
- # line 315
- {yyval = gc1(cons(yypvt[-0],NIL));} break;
- case 137:
- # line 317
- {yyval = gc4(pair(yypvt[-1],pair(yypvt[-2],yypvt[-0])));} break;
- case 138:
- # line 324
- {yyval = gc5(pair(yypvt[-4],pair(yypvt[-0],yypvt[-3])));} break;
- case 139:
- # line 325
- {yyval = gc4(pair(yypvt[-3],pair(yypvt[-0],yypvt[-2])));} break;
- case 140:
- # line 327
- {yyval = gc3(cons(yypvt[-0],yypvt[-2]));} break;
- case 141:
- # line 328
- {yyval = gc1(cons(yypvt[-0],NIL));} break;
- case 142:
- # line 330
- {yyval = yypvt[-0];} break;
- case 143:
- # line 331
- {yyval = gc3(varMinus);} break;
- case 144:
- # line 333
- {yyval = yypvt[-0];} break;
- case 145:
- # line 334
- {yyval = gc3(yypvt[-1]);} break;
- case 146:
- # line 336
- {yyval = yypvt[-0];} break;
- case 147:
- # line 337
- {yyval = gc3(yypvt[-1]);} break;
- case 148:
- # line 342
- {yyval = gc3(ap(ESIGN,pair(yypvt[-2],yypvt[-0])));} break;
- case 149:
- # line 343
- {yyval = yypvt[-0];} break;
- case 150:
- # line 344
- {syntaxError("expression");} break;
- case 151:
- # line 346
- {yyval = yypvt[-0];} break;
- case 152:
- # line 347
- {yyval = gc3(ap(ap(yypvt[-1],yypvt[-2]),yypvt[-0]));} break;
- case 153:
- # line 348
- {yyval = gc1(tidyInfix(yypvt[-0]));} break;
- case 154:
- # line 350
- {yyval = gc3(ap(ap(yypvt[-1],yypvt[-2]),yypvt[-0]));} break;
- case 155:
- # line 351
- {yyval = gc5(ap(ap(yypvt[-1],
- ap(ap(yypvt[-3],singleton(yypvt[-4])),
- yypvt[-2])),yypvt[-0]));} break;
- case 156:
- # line 355
- {if (isInt(yypvt[-0]))
- yyval = gc2(mkInt(-intOf(yypvt[-0])));
- else
- yyval = gc2(ap(varNegate,yypvt[-0]));
- } break;
- case 157:
- # line 360
- {yyval = gc4(ap(LAMBDA,
- pair(rev(yypvt[-2]),
- pair(yypvt[-1],yypvt[-0]))));} break;
- case 158:
- # line 363
- {yyval = gc6(letrec(yypvt[-3],yypvt[-0]));} break;
- case 159:
- # line 364
- {yyval = gc6(ap(COND,triple(yypvt[-4],yypvt[-2],yypvt[-0])));} break;
- case 160:
- # line 365
- {yyval = gc6(ap(CASE,pair(yypvt[-4],rev(yypvt[-1]))));} break;
- case 161:
- # line 366
- {yyval = yypvt[-0];} break;
- case 162:
- # line 368
- {yyval = gc2(cons(yypvt[-0],yypvt[-1]));} break;
- case 163:
- # line 369
- {yyval = gc1(cons(yypvt[-0],NIL));} break;
- case 164:
- # line 371
- {yyval = gc2(ap(yypvt[-1],yypvt[-0]));} break;
- case 165:
- # line 372
- {yyval = yypvt[-0];} break;
- case 166:
- # line 374
- {yyval = yypvt[-0];} break;
- case 167:
- # line 375
- {yyval = gc3(ap(ASPAT,pair(yypvt[-2],yypvt[-0])));} break;
- case 168:
- # line 376
- {yyval = gc2(ap(LAZYPAT,yypvt[-0]));} break;
- case 169:
- # line 377
- {yyval = gc1(WILDCARD);} break;
- case 170:
- # line 378
- {yyval = yypvt[-0];} break;
- case 171:
- # line 379
- {yyval = gc2(UNIT);} break;
- case 172:
- # line 380
- {yyval = yypvt[-0];} break;
- case 173:
- # line 381
- {yyval = yypvt[-0];} break;
- case 174:
- # line 382
- {yyval = yypvt[-0];} break;
- case 175:
- # line 383
- {yyval = yypvt[-0];} break;
- case 176:
- # line 384
- {yyval = gc3(yypvt[-1]);} break;
- case 177:
- # line 385
- {yyval = gc3(buildTuple(yypvt[-1]));} break;
- case 178:
- # line 386
- {yyval = gc3(yypvt[-1]);} break;
- case 179:
- # line 387
- {yyval = gc4(ap(yypvt[-1],yypvt[-2]));} break;
- case 180:
- # line 388
- {yyval = gc4(ap(ap(varFlip,yypvt[-2]),yypvt[-1]));} break;
- case 181:
- # line 389
- {yyval = gc4(ap(ap(varFlip,yypvt[-2]),yypvt[-1]));} break;
- case 182:
- # line 391
- {yyval = gc3(cons(yypvt[-0],yypvt[-2]));} break;
- case 183:
- # line 392
- {yyval = gc3(cons(yypvt[-0],cons(yypvt[-2],NIL)));} break;
- case 184:
- # line 394
- {yyval = gc3(cons(yypvt[-0],yypvt[-2]));} break;
- case 185:
- # line 395
- {yyval = gc1(cons(yypvt[-0],NIL));} break;
- case 186:
- # line 397
- {yyval = gc2(pair(yypvt[-1],yypvt[-0]));} break;
- case 187:
- # line 399
- {yyval = gc2(letrec(yypvt[-0],yypvt[-1]));} break;
- case 188:
- # line 400
- {yyval = yypvt[-0];} break;
- case 189:
- # line 402
- {yyval = gc1(grded(rev(yypvt[-0])));} break;
- case 190:
- # line 403
- {yyval = gc2(pair(yypvt[-1],yypvt[-0]));} break;
- case 191:
- # line 404
- {syntaxError("case expression");} break;
- case 192:
- # line 406
- {yyval = gc2(cons(yypvt[-0],yypvt[-1]));} break;
- case 193:
- # line 407
- {yyval = gc1(cons(yypvt[-0],NIL));} break;
- case 194:
- # line 409
- {yyval = gc4(pair(yypvt[-1],pair(yypvt[-2],yypvt[-0])));} break;
- case 195:
- # line 414
- {yyval = gc0(nameNil);} break;
- case 196:
- # line 415
- {yyval = gc1(ap(FINLIST,cons(yypvt[-0],NIL)));} break;
- case 197:
- # line 416
- {yyval = gc1(ap(FINLIST,rev(yypvt[-0])));} break;
- case 198:
- # line 417
- {yyval = gc3(ap(COMP,pair(yypvt[-2],rev(yypvt[-0]))));} break;
- case 199:
- # line 418
- {yyval = gc3(ap(ap(varFromTo,yypvt[-2]),yypvt[-0]));} break;
- case 200:
- # line 419
- {yyval = gc4(ap(ap(varFromThen,yypvt[-3]),yypvt[-1]));} break;
- case 201:
- # line 420
- {yyval = gc2(ap(varFrom,yypvt[-1]));} break;
- case 202:
- # line 421
- {yyval = gc5(ap(ap(ap(varFromThenTo,
- yypvt[-4]),yypvt[-2]),yypvt[-0]));} break;
- case 203:
- # line 424
- {yyval = gc3(cons(yypvt[-0],yypvt[-2]));} break;
- case 204:
- # line 425
- {yyval = gc1(cons(yypvt[-0],NIL));} break;
- case 205:
- # line 427
- {yyval = gc3(ap(FROMQUAL,pair(yypvt[-2],yypvt[-0])));} break;
- case 206:
- # line 428
- {yyval = gc3(ap(QWHERE,
- singleton(
- pair(yypvt[-2],pair(yypvt[-1],
- yypvt[-0])))));} break;
- case 207:
- # line 432
- {yyval = gc1(ap(BOOLQUAL,yypvt[-0]));} break;
- case 208:
- # line 433
- {yyval = gc4(ap(QWHERE,yypvt[-1]));} break;
- case 209:
- # line 439
- {yyval = gc2(yypvt[-0]);} break;
- case 210:
- # line 440
- {yyval = yypvt[-0];} break;
- case 211:
- # line 442
- {yyval = yypvt[-0];} break;
- case 212:
- # line 443
- {yyerrok;
- if (canUnOffside()) {
- unOffside();
- /* insert extra token on stack*/
- push(NIL);
- pushed(0) = pushed(1);
- pushed(1) = mkInt(column);
- }
- else
- syntaxError("definition");
- } break;/* End of actions */
- }
- goto yystack; /* stack new state and value */
-
- }
-