diff src/lacweb.grm @ 40:e3d3c2791105

Functor parsing
author Adam Chlipala <adamc@hcoop.net>
date Thu, 19 Jun 2008 15:15:00 -0400
parents 44b5405e74c7
children b3fbbc6cb1e5
line wrap: on
line diff
--- a/src/lacweb.grm	Thu Jun 19 12:39:22 2008 -0400
+++ b/src/lacweb.grm	Thu Jun 19 15:15:00 2008 -0400
@@ -44,7 +44,7 @@
  | TYPE | NAME
  | ARROW | LARROW | DARROW
  | FN | PLUSPLUS | DOLLAR
- | STRUCTURE | SIGNATURE | STRUCT | SIG | END
+ | STRUCTURE | SIGNATURE | STRUCT | SIG | END | FUNCTOR
 
 %nonterm
    file of decl list
@@ -113,6 +113,8 @@
 
 sgn    : SIG sgis END                   (SgnConst sgis, s (SIGleft, ENDright))
        | CSYMBOL                        (SgnVar CSYMBOL, s (CSYMBOLleft, CSYMBOLright))
+       | FUNCTOR LPAREN CSYMBOL COLON sgn RPAREN COLON sgn
+                                        (SgnFun (CSYMBOL, sgn1, sgn2), s (FUNCTORleft, sgn2right))
 
 sgi    : CON SYMBOL DCOLON kind         (SgiConAbs (SYMBOL, kind), s (CONleft, kindright))
        | LTYPE SYMBOL                   (SgiConAbs (SYMBOL, (KType, s (LTYPEleft, SYMBOLright))),
@@ -130,6 +132,10 @@
 
 str    : STRUCT decls END               (StrConst decls, s (STRUCTleft, ENDright))
        | spath                          (spath)
+       | FUNCTOR LPAREN CSYMBOL COLON sgn RPAREN DARROW str
+                                        (StrFun (CSYMBOL, sgn, NONE, str), s (FUNCTORleft, strright))
+       | FUNCTOR LPAREN CSYMBOL COLON sgn RPAREN COLON sgn DARROW str
+                                        (StrFun (CSYMBOL, sgn1, SOME sgn2, str), s (FUNCTORleft, strright))
 
 spath  : CSYMBOL                        (StrVar CSYMBOL, s (CSYMBOLleft, CSYMBOLright))
        | spath DOT CSYMBOL              (StrProj (spath, CSYMBOL), s (spathleft, CSYMBOLright))