diff options
author | Adam Chlipala <adamc@hcoop.net> | 2008-07-17 10:09:34 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2008-07-17 10:09:34 -0400 |
commit | dcfd6390610712e9d498cdb4e466eb932a6bb138 (patch) | |
tree | 83ba4c2e9b1d7a6ef837f323bed5a279b517fdb9 /src/lacweb.grm | |
parent | c8dc6a0ab0a9f64a6d5bd1bfae94f04dc941e26d (diff) |
Parsing and elaborating (non-mutual) 'val rec'
Diffstat (limited to 'src/lacweb.grm')
-rw-r--r-- | src/lacweb.grm | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/lacweb.grm b/src/lacweb.grm index 2cc23e78..f04c93dd 100644 --- a/src/lacweb.grm +++ b/src/lacweb.grm @@ -44,7 +44,7 @@ fun uppercaseFirst "" = "" | LPAREN | RPAREN | LBRACK | RBRACK | LBRACE | RBRACE | EQ | COMMA | COLON | DCOLON | TCOLON | DOT | HASH | UNDER | UNDERUNDER | DIVIDE | GT - | CON | LTYPE | VAL | FOLD | UNIT | KUNIT + | CON | LTYPE | VAL | REC | AND | FOLD | UNIT | KUNIT | TYPE | NAME | ARROW | LARROW | DARROW | FN | PLUSPLUS | DOLLAR | TWIDDLE @@ -59,6 +59,8 @@ fun uppercaseFirst "" = "" file of decl list | decls of decl list | decl of decl + | vali of string * con option * exp + | valis of (string * con option * exp) list | sgn of sgn | sgntm of sgn @@ -125,8 +127,8 @@ decl : CON SYMBOL EQ cexp (DCon (SYMBOL, NONE, cexp), s (CONleft, | CON SYMBOL DCOLON kind EQ cexp (DCon (SYMBOL, SOME kind, cexp), s (CONleft, cexpright)) | LTYPE SYMBOL EQ cexp (DCon (SYMBOL, SOME (KType, s (LTYPEleft, cexpright)), cexp), s (LTYPEleft, cexpright)) - | VAL SYMBOL EQ eexp (DVal (SYMBOL, NONE, eexp), s (VALleft, eexpright)) - | VAL SYMBOL COLON cexp EQ eexp (DVal (SYMBOL, SOME cexp, eexp), s (VALleft, eexpright)) + | VAL vali (DVal vali, s (VALleft, valiright)) + | VAL REC valis (DValRec valis, s (VALleft, valisright)) | SIGNATURE CSYMBOL EQ sgn (DSgn (CSYMBOL, sgn), s (SIGNATUREleft, sgnright)) | STRUCTURE CSYMBOL EQ str (DStr (CSYMBOL, NONE, str), s (STRUCTUREleft, strright)) @@ -149,6 +151,12 @@ decl : CON SYMBOL EQ cexp (DCon (SYMBOL, NONE, cexp), s (CONleft, | CONSTRAINT cterm TWIDDLE cterm (DConstraint (cterm1, cterm2), s (CONSTRAINTleft, ctermright)) | EXPORT spath (DExport spath, s (EXPORTleft, spathright)) +vali : SYMBOL EQ eexp (SYMBOL, NONE, eexp) + | SYMBOL COLON cexp EQ eexp (SYMBOL, SOME cexp, eexp) + +valis : vali ([vali]) + | vali AND valis (vali :: valis) + sgn : sgntm (sgntm) | FUNCTOR LPAREN CSYMBOL COLON sgn RPAREN COLON sgn (SgnFun (CSYMBOL, sgn1, sgn2), s (FUNCTORleft, sgn2right)) |