| LPAREN | RPAREN | LBRACK | RBRACK | LBRACE | RBRACE
| EQ | COMMA | BSLASH | SEMI | LET | IN | END
| ROOT
- | EXTERN | TYPE | VAL | WITH
+ | EXTERN | TYPE | VAL | WITH | WHERE
%nonterm
file of file
| exp of exp
| apps of exp
| term of exp
+ | sets of exp list
| elist of exp list
| elistNe of exp list
| clist of exp list
%right ARROW DARROW
%right COMMA
%nonassoc EQ
+%right WITH
+%right WHERE
%right AND
%nonassoc CARET BANG
| DOC (SOME DOC)
expOpt : (NONE)
- | exp (SOME (ELocal exp, (expleft, expright)))
+ | exp (SOME (ELocal (exp, (ESkip, (expleft, expright))),
+ (expleft, expright)))
exp : apps (apps)
+ | apps WHERE sets END (ELocal ((ESeq sets, (setsleft, setsright)), apps),
+ (appsleft, ENDright))
+ | apps WITH END (EWith (apps, (ESkip, (WITHleft, ENDright))),
+ (appsleft, ENDright))
+ | apps WITH exp END (EWith (apps, exp), (appsleft, ENDright))
+ | apps WHERE sets WITH END (ELocal ((ESeq sets, (setsleft, setsright)),
+ (EWith (apps, (ESkip, (WITHleft, ENDright))),
+ (appsleft, ENDright))),
+ (appsleft, ENDright))
+ | apps WHERE sets WITH exp END (ELocal ((ESeq sets, (setsleft, setsright)),
+ (EWith (apps, exp), (appsleft, ENDright))),
+ (appsleft, ENDright))
+
| BSLASH SYMBOL COLON LPAREN typ RPAREN ARROW exp (ELam (SYMBOL, SOME typ, exp),
(BSLASHleft, expright))
| BSLASH SYMBOL ARROW exp (ELam (SYMBOL, NONE, exp), (BSLASHleft, expright))
(ESeq ls, (exp1left, exp2right))
end)
| SYMBOL LARROW CSYMBOL SEMI exp (EGet (SYMBOL, CSYMBOL, exp), (SYMBOLleft, expright))
- | apps WITH END (EWith (apps, (ESkip, (WITHleft, ENDright))), (appsleft, ENDright))
- | apps WITH exp END (EWith (apps, exp), (appsleft, ENDright))
+ (*| exp WHERE exp END (ELocal (exp1, exp2), (exp1left, ENDright))
+ | exp WHERE exp WITH END (EWith ((ELocal (exp1, exp2), (exp1left, ENDright)),
+ (ESkip, (WITHleft, ENDright))),
+ (exp1left, ENDright))
+ | exp WITH END (EWith (exp, (ESkip, (WITHleft, ENDright))), (expleft, ENDright))
+ | exp WITH exp END (EWith (exp1, exp2), (exp1left, ENDright))*)
apps : term (term)
| apps term (EApp (apps, term), (appsleft, termright))
| INT (EInt INT, (INTleft, INTright))
| STRING (EString STRING, (STRINGleft, STRINGright))
| LBRACK elist RBRACK (EList elist, (LBRACKleft, RBRACKright))
- | LET exp IN exp END (ELocal (ESeq [exp1, exp2], (LETleft, ENDright)),
- (LETleft, ENDright))
+ | LET exp IN exp END (ELocal (exp1, exp2), (LETleft, ENDright))
| SYMBOL (EVar SYMBOL, (SYMBOLleft, SYMBOLright))
+sets : CSYMBOL EQ apps ([(ESet (CSYMBOL, apps), (CSYMBOLleft, appsright))])
+ | CSYMBOL EQ apps SEMI sets ((ESet (CSYMBOL, apps), (CSYMBOLleft, appsright))
+ :: sets)
+
elist : ([])
| elistNe (elistNe)
| LBRACK ctxt RBRACK (TAction (ctxt, StringMap.empty, StringMap.empty),
(LBRACKleft, ctxtright))
| LPAREN typ RPAREN (typ)
- | ctxt DARROW ctxt (TNested (ctxt1, ctxt2), (ctxt1left, ctxt2right))
+ | ctxt DARROW typ (TNested (ctxt, typ), (ctxtleft, typright))
recd : LBRACE RBRACE (StringMap.empty)
| LBRACE recdNe RBRACE (recdNe)