comparison src/lacweb.grm @ 30:e6ccf961d8a3

Parsing and printing basic module system
author Adam Chlipala <adamc@hcoop.net>
date Thu, 12 Jun 2008 14:04:22 -0400
parents 9a578171de9e
children 44b5405e74c7
comparison
equal deleted inserted replaced
29:537db4ee89f4 30:e6ccf961d8a3
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 47 | STRUCTURE | SIGNATURE | STRUCT | SIG | END
48 %nonterm 48
49 %nonterm
49 file of decl list 50 file of decl list
50 | decls of decl list 51 | decls of decl list
51 | decl of decl 52 | decl of decl
53
54 | sgn of sgn
55 | sgi of sgn_item
56 | sgis of sgn_item list
57
58 | str of str
52 59
53 | kind of kind 60 | kind of kind
54 | kcolon of explicitness 61 | kcolon of explicitness
55 62
56 | cexp of con 63 | cexp of con
95 | LTYPE SYMBOL EQ cexp (DCon (SYMBOL, SOME (KType, s (LTYPEleft, cexpright)), cexp), 102 | LTYPE SYMBOL EQ cexp (DCon (SYMBOL, SOME (KType, s (LTYPEleft, cexpright)), cexp),
96 s (LTYPEleft, cexpright)) 103 s (LTYPEleft, cexpright))
97 | VAL SYMBOL EQ eexp (DVal (SYMBOL, NONE, eexp), s (VALleft, eexpright)) 104 | VAL SYMBOL EQ eexp (DVal (SYMBOL, NONE, eexp), s (VALleft, eexpright))
98 | VAL SYMBOL COLON cexp EQ eexp (DVal (SYMBOL, SOME cexp, eexp), s (VALleft, eexpright)) 105 | VAL SYMBOL COLON cexp EQ eexp (DVal (SYMBOL, SOME cexp, eexp), s (VALleft, eexpright))
99 106
107 | SIGNATURE CSYMBOL EQ sgn (DSgn (CSYMBOL, sgn), s (SIGNATUREleft, sgnright))
108 | STRUCTURE CSYMBOL EQ str (DStr (CSYMBOL, NONE, str), s (STRUCTUREleft, strright))
109 | STRUCTURE CSYMBOL COLON sgn EQ str (DStr (CSYMBOL, SOME sgn, str), s (STRUCTUREleft, strright))
110
111 sgn : SIG sgis END (SgnConst sgis, s (SIGleft, ENDright))
112 | CSYMBOL (SgnVar CSYMBOL, s (CSYMBOLleft, CSYMBOLright))
113
114 sgi : CON SYMBOL DCOLON kind (SgiConAbs (SYMBOL, kind), s (CONleft, kindright))
115 | LTYPE SYMBOL (SgiConAbs (SYMBOL, (KType, s (LTYPEleft, SYMBOLright))),
116 s (LTYPEleft, SYMBOLright))
117 | CON SYMBOL EQ cexp (SgiCon (SYMBOL, NONE, cexp), s (CONleft, cexpright))
118 | CON SYMBOL DCOLON kind EQ cexp (SgiCon (SYMBOL, SOME kind, cexp), s (CONleft, cexpright))
119 | LTYPE SYMBOL EQ cexp (SgiCon (SYMBOL, SOME (KType, s (LTYPEleft, cexpright)), cexp),
120 s (LTYPEleft, cexpright))
121 | VAL SYMBOL COLON cexp (SgiVal (SYMBOL, cexp), s (VALleft, cexpright))
122
123 | STRUCTURE CSYMBOL COLON sgn (SgiStr (CSYMBOL, sgn), s (STRUCTUREleft, sgnright))
124
125 sgis : ([])
126 | sgi sgis (sgi :: sgis)
127
128 str : STRUCT decls END (StrConst decls, s (STRUCTleft, ENDright))
129 | CSYMBOL (StrVar CSYMBOL, s (CSYMBOLleft, CSYMBOLright))
130
100 kind : TYPE (KType, s (TYPEleft, TYPEright)) 131 kind : TYPE (KType, s (TYPEleft, TYPEright))
101 | NAME (KName, s (NAMEleft, NAMEright)) 132 | NAME (KName, s (NAMEleft, NAMEright))
102 | LBRACE kind RBRACE (KRecord kind, s (LBRACEleft, RBRACEright)) 133 | LBRACE kind RBRACE (KRecord kind, s (LBRACEleft, RBRACEright))
103 | kind ARROW kind (KArrow (kind1, kind2), s (kind1left, kind2right)) 134 | kind ARROW kind (KArrow (kind1, kind2), s (kind1left, kind2right))
104 | LPAREN kind RPAREN (#1 kind, s (LPARENleft, RPARENright)) 135 | LPAREN kind RPAREN (#1 kind, s (LPARENleft, RPARENright))