comparison 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
comparison
equal deleted inserted replaced
39:02f42e9a1825 40:e3d3c2791105
42 | EQ | COMMA | COLON | DCOLON | TCOLON | DOT | HASH | UNDER | UNDERUNDER 42 | EQ | COMMA | COLON | DCOLON | TCOLON | DOT | HASH | UNDER | UNDERUNDER
43 | CON | LTYPE | VAL 43 | CON | LTYPE | VAL
44 | TYPE | NAME 44 | TYPE | NAME
45 | ARROW | LARROW | DARROW 45 | ARROW | LARROW | DARROW
46 | FN | PLUSPLUS | DOLLAR 46 | FN | PLUSPLUS | DOLLAR
47 | STRUCTURE | SIGNATURE | STRUCT | SIG | END 47 | STRUCTURE | SIGNATURE | STRUCT | SIG | END | FUNCTOR
48 48
49 %nonterm 49 %nonterm
50 file of decl list 50 file of decl list
51 | decls of decl list 51 | decls of decl list
52 | decl of decl 52 | decl of decl
111 | STRUCTURE CSYMBOL EQ str (DStr (CSYMBOL, NONE, str), s (STRUCTUREleft, strright)) 111 | STRUCTURE CSYMBOL EQ str (DStr (CSYMBOL, NONE, str), s (STRUCTUREleft, strright))
112 | STRUCTURE CSYMBOL COLON sgn EQ str (DStr (CSYMBOL, SOME sgn, str), s (STRUCTUREleft, strright)) 112 | STRUCTURE CSYMBOL COLON sgn EQ str (DStr (CSYMBOL, SOME sgn, str), s (STRUCTUREleft, strright))
113 113
114 sgn : SIG sgis END (SgnConst sgis, s (SIGleft, ENDright)) 114 sgn : SIG sgis END (SgnConst sgis, s (SIGleft, ENDright))
115 | CSYMBOL (SgnVar CSYMBOL, s (CSYMBOLleft, CSYMBOLright)) 115 | CSYMBOL (SgnVar CSYMBOL, s (CSYMBOLleft, CSYMBOLright))
116 | FUNCTOR LPAREN CSYMBOL COLON sgn RPAREN COLON sgn
117 (SgnFun (CSYMBOL, sgn1, sgn2), s (FUNCTORleft, sgn2right))
116 118
117 sgi : CON SYMBOL DCOLON kind (SgiConAbs (SYMBOL, kind), s (CONleft, kindright)) 119 sgi : CON SYMBOL DCOLON kind (SgiConAbs (SYMBOL, kind), s (CONleft, kindright))
118 | LTYPE SYMBOL (SgiConAbs (SYMBOL, (KType, s (LTYPEleft, SYMBOLright))), 120 | LTYPE SYMBOL (SgiConAbs (SYMBOL, (KType, s (LTYPEleft, SYMBOLright))),
119 s (LTYPEleft, SYMBOLright)) 121 s (LTYPEleft, SYMBOLright))
120 | CON SYMBOL EQ cexp (SgiCon (SYMBOL, NONE, cexp), s (CONleft, cexpright)) 122 | CON SYMBOL EQ cexp (SgiCon (SYMBOL, NONE, cexp), s (CONleft, cexpright))
128 sgis : ([]) 130 sgis : ([])
129 | sgi sgis (sgi :: sgis) 131 | sgi sgis (sgi :: sgis)
130 132
131 str : STRUCT decls END (StrConst decls, s (STRUCTleft, ENDright)) 133 str : STRUCT decls END (StrConst decls, s (STRUCTleft, ENDright))
132 | spath (spath) 134 | spath (spath)
135 | FUNCTOR LPAREN CSYMBOL COLON sgn RPAREN DARROW str
136 (StrFun (CSYMBOL, sgn, NONE, str), s (FUNCTORleft, strright))
137 | FUNCTOR LPAREN CSYMBOL COLON sgn RPAREN COLON sgn DARROW str
138 (StrFun (CSYMBOL, sgn1, SOME sgn2, str), s (FUNCTORleft, strright))
133 139
134 spath : CSYMBOL (StrVar CSYMBOL, s (CSYMBOLleft, CSYMBOLright)) 140 spath : CSYMBOL (StrVar CSYMBOL, s (CSYMBOLleft, CSYMBOLright))
135 | spath DOT CSYMBOL (StrProj (spath, CSYMBOL), s (spathleft, CSYMBOLright)) 141 | spath DOT CSYMBOL (StrProj (spath, CSYMBOL), s (spathleft, CSYMBOLright))
136 142
137 kind : TYPE (KType, s (TYPEleft, TYPEright)) 143 kind : TYPE (KType, s (TYPEleft, TYPEright))