comparison src/lacweb.grm @ 42:b3fbbc6cb1e5

Elaborating 'where'
author Adam Chlipala <adamc@hcoop.net>
date Thu, 19 Jun 2008 16:35:40 -0400
parents e3d3c2791105
children a9f3ce2d1b9b
comparison
equal deleted inserted replaced
41:1405d8c26790 42:b3fbbc6cb1e5
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 | FUNCTOR 47 | STRUCTURE | SIGNATURE | STRUCT | SIG | END | FUNCTOR | WHERE
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
53 53
54 | sgn of sgn 54 | sgn of sgn
55 | sgntm of sgn
55 | sgi of sgn_item 56 | sgi of sgn_item
56 | sgis of sgn_item list 57 | sgis of sgn_item list
57 58
58 | str of str 59 | str of str
59 60
108 | VAL SYMBOL COLON cexp EQ eexp (DVal (SYMBOL, SOME cexp, eexp), s (VALleft, eexpright)) 109 | VAL SYMBOL COLON cexp EQ eexp (DVal (SYMBOL, SOME cexp, eexp), s (VALleft, eexpright))
109 110
110 | SIGNATURE CSYMBOL EQ sgn (DSgn (CSYMBOL, sgn), s (SIGNATUREleft, sgnright)) 111 | SIGNATURE CSYMBOL EQ sgn (DSgn (CSYMBOL, sgn), s (SIGNATUREleft, sgnright))
111 | STRUCTURE CSYMBOL EQ str (DStr (CSYMBOL, NONE, str), s (STRUCTUREleft, strright)) 112 | 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)) 113 | STRUCTURE CSYMBOL COLON sgn EQ str (DStr (CSYMBOL, SOME sgn, str), s (STRUCTUREleft, strright))
113 114 | FUNCTOR CSYMBOL LPAREN CSYMBOL COLON sgn RPAREN EQ str
114 sgn : SIG sgis END (SgnConst sgis, s (SIGleft, ENDright)) 115 (DStr (CSYMBOL1, NONE,
115 | CSYMBOL (SgnVar CSYMBOL, s (CSYMBOLleft, CSYMBOLright)) 116 (StrFun (CSYMBOL2, sgn1, NONE, str), s (FUNCTORleft, strright))),
117 s (FUNCTORleft, strright))
118 | FUNCTOR CSYMBOL LPAREN CSYMBOL COLON sgn RPAREN COLON sgn EQ str
119 (DStr (CSYMBOL1, NONE,
120 (StrFun (CSYMBOL2, sgn1, SOME sgn2, str), s (FUNCTORleft, strright))),
121 s (FUNCTORleft, strright))
122
123 sgn : sgntm (sgntm)
116 | FUNCTOR LPAREN CSYMBOL COLON sgn RPAREN COLON sgn 124 | FUNCTOR LPAREN CSYMBOL COLON sgn RPAREN COLON sgn
117 (SgnFun (CSYMBOL, sgn1, sgn2), s (FUNCTORleft, sgn2right)) 125 (SgnFun (CSYMBOL, sgn1, sgn2), s (FUNCTORleft, sgn2right))
126
127 sgntm : SIG sgis END (SgnConst sgis, s (SIGleft, ENDright))
128 | CSYMBOL (SgnVar CSYMBOL, s (CSYMBOLleft, CSYMBOLright))
129 | sgntm WHERE CON SYMBOL EQ cexp (SgnWhere (sgntm, SYMBOL, cexp), s (sgntmleft, cexpright))
130 | sgntm WHERE LTYPE SYMBOL EQ cexp(SgnWhere (sgntm, SYMBOL, cexp), s (sgntmleft, cexpright))
131 | LPAREN sgn RPAREN (sgn)
118 132
119 sgi : CON SYMBOL DCOLON kind (SgiConAbs (SYMBOL, kind), s (CONleft, kindright)) 133 sgi : CON SYMBOL DCOLON kind (SgiConAbs (SYMBOL, kind), s (CONleft, kindright))
120 | LTYPE SYMBOL (SgiConAbs (SYMBOL, (KType, s (LTYPEleft, SYMBOLright))), 134 | LTYPE SYMBOL (SgiConAbs (SYMBOL, (KType, s (LTYPEleft, SYMBOLright))),
121 s (LTYPEleft, SYMBOLright)) 135 s (LTYPEleft, SYMBOLright))
122 | CON SYMBOL EQ cexp (SgiCon (SYMBOL, NONE, cexp), s (CONleft, cexpright)) 136 | CON SYMBOL EQ cexp (SgiCon (SYMBOL, NONE, cexp), s (CONleft, cexpright))
124 | LTYPE SYMBOL EQ cexp (SgiCon (SYMBOL, SOME (KType, s (LTYPEleft, cexpright)), cexp), 138 | LTYPE SYMBOL EQ cexp (SgiCon (SYMBOL, SOME (KType, s (LTYPEleft, cexpright)), cexp),
125 s (LTYPEleft, cexpright)) 139 s (LTYPEleft, cexpright))
126 | VAL SYMBOL COLON cexp (SgiVal (SYMBOL, cexp), s (VALleft, cexpright)) 140 | VAL SYMBOL COLON cexp (SgiVal (SYMBOL, cexp), s (VALleft, cexpright))
127 141
128 | STRUCTURE CSYMBOL COLON sgn (SgiStr (CSYMBOL, sgn), s (STRUCTUREleft, sgnright)) 142 | STRUCTURE CSYMBOL COLON sgn (SgiStr (CSYMBOL, sgn), s (STRUCTUREleft, sgnright))
143 | FUNCTOR CSYMBOL LPAREN CSYMBOL COLON sgn RPAREN COLON sgn
144 (SgiStr (CSYMBOL1,
145 (SgnFun (CSYMBOL2, sgn1, sgn2), s (FUNCTORleft, sgn2right))),
146 s (FUNCTORleft, sgn2right))
129 147
130 sgis : ([]) 148 sgis : ([])
131 | sgi sgis (sgi :: sgis) 149 | sgi sgis (sgi :: sgis)
132 150
133 str : STRUCT decls END (StrConst decls, s (STRUCTleft, ENDright)) 151 str : STRUCT decls END (StrConst decls, s (STRUCTleft, ENDright))