summaryrefslogtreecommitdiff
path: root/src/lacweb.grm
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-06-19 16:35:40 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-06-19 16:35:40 -0400
commite542e7ba2106c5763006e88d90b6834fe9221b85 (patch)
treebf572cb1c2dfec0751f72a61fcfe0a9fd563c933 /src/lacweb.grm
parent7a1c5e1780fd3c56d9c591821905bb3b3bbfa50a (diff)
Elaborating 'where'
Diffstat (limited to 'src/lacweb.grm')
-rw-r--r--src/lacweb.grm26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/lacweb.grm b/src/lacweb.grm
index ea40c236..e917396c 100644
--- a/src/lacweb.grm
+++ b/src/lacweb.grm
@@ -44,7 +44,7 @@ val s = ErrorMsg.spanOf
| TYPE | NAME
| ARROW | LARROW | DARROW
| FN | PLUSPLUS | DOLLAR
- | STRUCTURE | SIGNATURE | STRUCT | SIG | END | FUNCTOR
+ | STRUCTURE | SIGNATURE | STRUCT | SIG | END | FUNCTOR | WHERE
%nonterm
file of decl list
@@ -52,6 +52,7 @@ val s = ErrorMsg.spanOf
| decl of decl
| sgn of sgn
+ | sgntm of sgn
| sgi of sgn_item
| sgis of sgn_item list
@@ -110,12 +111,25 @@ decl : CON SYMBOL EQ cexp (DCon (SYMBOL, NONE, cexp), s (CONleft,
| SIGNATURE CSYMBOL EQ sgn (DSgn (CSYMBOL, sgn), s (SIGNATUREleft, sgnright))
| STRUCTURE CSYMBOL EQ str (DStr (CSYMBOL, NONE, str), s (STRUCTUREleft, strright))
| STRUCTURE CSYMBOL COLON sgn EQ str (DStr (CSYMBOL, SOME sgn, str), s (STRUCTUREleft, strright))
-
-sgn : SIG sgis END (SgnConst sgis, s (SIGleft, ENDright))
- | CSYMBOL (SgnVar CSYMBOL, s (CSYMBOLleft, CSYMBOLright))
+ | FUNCTOR CSYMBOL LPAREN CSYMBOL COLON sgn RPAREN EQ str
+ (DStr (CSYMBOL1, NONE,
+ (StrFun (CSYMBOL2, sgn1, NONE, str), s (FUNCTORleft, strright))),
+ s (FUNCTORleft, strright))
+ | FUNCTOR CSYMBOL LPAREN CSYMBOL COLON sgn RPAREN COLON sgn EQ str
+ (DStr (CSYMBOL1, NONE,
+ (StrFun (CSYMBOL2, sgn1, SOME sgn2, str), s (FUNCTORleft, strright))),
+ s (FUNCTORleft, strright))
+
+sgn : sgntm (sgntm)
| FUNCTOR LPAREN CSYMBOL COLON sgn RPAREN COLON sgn
(SgnFun (CSYMBOL, sgn1, sgn2), s (FUNCTORleft, sgn2right))
+sgntm : SIG sgis END (SgnConst sgis, s (SIGleft, ENDright))
+ | CSYMBOL (SgnVar CSYMBOL, s (CSYMBOLleft, CSYMBOLright))
+ | sgntm WHERE CON SYMBOL EQ cexp (SgnWhere (sgntm, SYMBOL, cexp), s (sgntmleft, cexpright))
+ | sgntm WHERE LTYPE SYMBOL EQ cexp(SgnWhere (sgntm, SYMBOL, cexp), s (sgntmleft, cexpright))
+ | LPAREN sgn RPAREN (sgn)
+
sgi : CON SYMBOL DCOLON kind (SgiConAbs (SYMBOL, kind), s (CONleft, kindright))
| LTYPE SYMBOL (SgiConAbs (SYMBOL, (KType, s (LTYPEleft, SYMBOLright))),
s (LTYPEleft, SYMBOLright))
@@ -126,6 +140,10 @@ sgi : CON SYMBOL DCOLON kind (SgiConAbs (SYMBOL, kind), s (CONleft, k
| VAL SYMBOL COLON cexp (SgiVal (SYMBOL, cexp), s (VALleft, cexpright))
| STRUCTURE CSYMBOL COLON sgn (SgiStr (CSYMBOL, sgn), s (STRUCTUREleft, sgnright))
+ | FUNCTOR CSYMBOL LPAREN CSYMBOL COLON sgn RPAREN COLON sgn
+ (SgiStr (CSYMBOL1,
+ (SgnFun (CSYMBOL2, sgn1, sgn2), s (FUNCTORleft, sgn2right))),
+ s (FUNCTORleft, sgn2right))
sgis : ([])
| sgi sgis (sgi :: sgis)