annotate src/lacweb.grm @ 114:0644d3c3bedf

Print a message on Laconic compilation failure
author Adam Chlipala <adamc@hcoop.net>
date Sun, 13 Jul 2008 12:51:58 -0400
parents 3739af9e727a
children e3041657d653
rev   line source
adamc@1 1 (* Copyright (c) 2008, Adam Chlipala
adamc@1 2 * All rights reserved.
adamc@1 3 *
adamc@1 4 * Redistribution and use in source and binary forms, with or without
adamc@1 5 * modification, are permitted provided that the following conditions are met:
adamc@1 6 *
adamc@1 7 * - Redistributions of source code must retain the above copyright notice,
adamc@1 8 * this list of conditions and the following disclaimer.
adamc@1 9 * - Redistributions in binary form must reproduce the above copyright notice,
adamc@1 10 * this list of conditions and the following disclaimer in the documentation
adamc@1 11 * and/or other materials provided with the distribution.
adamc@1 12 * - The names of contributors may not be used to endorse or promote products
adamc@1 13 * derived from this software without specific prior written permission.
adamc@1 14 *
adamc@1 15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
adamc@1 16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
adamc@1 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
adamc@1 18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
adamc@1 19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
adamc@1 20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
adamc@1 21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
adamc@1 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
adamc@1 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
adamc@1 24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
adamc@1 25 * POSSIBILITY OF SUCH DAMAGE.
adamc@1 26 *)
adamc@1 27
adamc@1 28 (* Grammar for Laconic/Web programs *)
adamc@1 29
adamc@4 30 open Source
adamc@1 31
adamc@1 32 val s = ErrorMsg.spanOf
adamc@1 33
adamc@104 34 fun uppercaseFirst "" = ""
adamc@104 35 | uppercaseFirst s = str (Char.toUpper (String.sub (s, 0))) ^ String.extract (s, 1, NONE)
adamc@104 36
adamc@1 37 %%
adamc@1 38 %header (functor LacwebLrValsFn(structure Token : TOKEN))
adamc@1 39
adamc@1 40 %term
adamc@1 41 EOF
adamc@14 42 | STRING of string | INT of Int64.int | FLOAT of Real64.real
adamc@1 43 | SYMBOL of string | CSYMBOL of string
adamc@1 44 | LPAREN | RPAREN | LBRACK | RBRACK | LBRACE | RBRACE
adamc@18 45 | EQ | COMMA | COLON | DCOLON | TCOLON | DOT | HASH | UNDER | UNDERUNDER
adamc@91 46 | DIVIDE | GT
adamc@82 47 | CON | LTYPE | VAL | FOLD | UNIT | KUNIT
adamc@7 48 | TYPE | NAME
adamc@1 49 | ARROW | LARROW | DARROW
adamc@84 50 | FN | PLUSPLUS | DOLLAR | TWIDDLE
adamc@88 51 | STRUCTURE | SIGNATURE | STRUCT | SIG | END | FUNCTOR | WHERE | EXTERN
adamc@109 52 | INCLUDE | OPEN | CONSTRAINT | CONSTRAINTS | EXPORT
adamc@1 53
adamc@91 54 | XML_BEGIN of string | XML_END
adamc@91 55 | NOTAGS of string
adamc@91 56 | BEGIN_TAG of string | END_TAG of string
adamc@91 57
adamc@30 58 %nonterm
adamc@1 59 file of decl list
adamc@1 60 | decls of decl list
adamc@1 61 | decl of decl
adamc@1 62
adamc@30 63 | sgn of sgn
adamc@42 64 | sgntm of sgn
adamc@30 65 | sgi of sgn_item
adamc@30 66 | sgis of sgn_item list
adamc@30 67
adamc@30 68 | str of str
adamc@30 69
adamc@1 70 | kind of kind
adamc@1 71 | kcolon of explicitness
adamc@1 72
adamc@34 73 | path of string list * string
adamc@34 74 | spath of str
adamc@59 75 | mpath of string list
adamc@34 76
adamc@1 77 | cexp of con
adamc@1 78 | capps of con
adamc@1 79 | cterm of con
adamc@1 80 | ident of con
adamc@1 81 | rcon of (con * con) list
adamc@83 82 | rconn of (con * con) list
adamc@1 83 | rcone of (con * con) list
adamc@1 84
adamc@8 85 | eexp of exp
adamc@8 86 | eapps of exp
adamc@8 87 | eterm of exp
adamc@12 88 | rexp of (con * exp) list
adamc@91 89 | xml of exp
adamc@91 90 | xmlOne of exp
adamc@8 91
adamc@104 92 | attrs of (con * exp) list
adamc@104 93 | attr of con * exp
adamc@104 94 | attrv of exp
adamc@104 95
adamc@1 96 %verbose (* print summary of errors *)
adamc@1 97 %pos int (* positions *)
adamc@1 98 %start file
adamc@1 99 %pure
adamc@1 100 %eop EOF
adamc@1 101 %noshift EOF
adamc@1 102
adamc@1 103 %name Lacweb
adamc@1 104
adamc@1 105 %nonassoc DARROW
adamc@1 106 %nonassoc COLON
adamc@6 107 %nonassoc DCOLON TCOLON
adamc@1 108 %right COMMA
adamc@1 109 %right ARROW LARROW
adamc@1 110 %right PLUSPLUS
adamc@84 111 %nonassoc TWIDDLE
adamc@1 112 %nonassoc DOLLAR
adamc@1 113 %left DOT
adamc@1 114
adamc@1 115 %%
adamc@1 116
adamc@1 117 file : decls (decls)
adamc@54 118 | SIG sgis ([(DSgn ("?", (SgnConst sgis, s (SIGleft, sgisright))),
adamc@54 119 s (SIGleft, sgisright))])
adamc@1 120
adamc@1 121 decls : ([])
adamc@1 122 | decl decls (decl :: decls)
adamc@1 123
adamc@1 124 decl : CON SYMBOL EQ cexp (DCon (SYMBOL, NONE, cexp), s (CONleft, cexpright))
adamc@1 125 | CON SYMBOL DCOLON kind EQ cexp (DCon (SYMBOL, SOME kind, cexp), s (CONleft, cexpright))
adamc@7 126 | LTYPE SYMBOL EQ cexp (DCon (SYMBOL, SOME (KType, s (LTYPEleft, cexpright)), cexp),
adamc@7 127 s (LTYPEleft, cexpright))
adamc@8 128 | VAL SYMBOL EQ eexp (DVal (SYMBOL, NONE, eexp), s (VALleft, eexpright))
adamc@8 129 | VAL SYMBOL COLON cexp EQ eexp (DVal (SYMBOL, SOME cexp, eexp), s (VALleft, eexpright))
adamc@1 130
adamc@30 131 | SIGNATURE CSYMBOL EQ sgn (DSgn (CSYMBOL, sgn), s (SIGNATUREleft, sgnright))
adamc@30 132 | STRUCTURE CSYMBOL EQ str (DStr (CSYMBOL, NONE, str), s (STRUCTUREleft, strright))
adamc@30 133 | STRUCTURE CSYMBOL COLON sgn EQ str (DStr (CSYMBOL, SOME sgn, str), s (STRUCTUREleft, strright))
adamc@42 134 | FUNCTOR CSYMBOL LPAREN CSYMBOL COLON sgn RPAREN EQ str
adamc@42 135 (DStr (CSYMBOL1, NONE,
adamc@42 136 (StrFun (CSYMBOL2, sgn1, NONE, str), s (FUNCTORleft, strright))),
adamc@42 137 s (FUNCTORleft, strright))
adamc@42 138 | FUNCTOR CSYMBOL LPAREN CSYMBOL COLON sgn RPAREN COLON sgn EQ str
adamc@42 139 (DStr (CSYMBOL1, NONE,
adamc@42 140 (StrFun (CSYMBOL2, sgn1, SOME sgn2, str), s (FUNCTORleft, strright))),
adamc@42 141 s (FUNCTORleft, strright))
adamc@48 142 | EXTERN STRUCTURE CSYMBOL COLON sgn (DFfiStr (CSYMBOL, sgn), s (EXTERNleft, sgnright))
adamc@61 143 | OPEN mpath (case mpath of
adamc@61 144 [] => raise Fail "Impossible mpath parse [1]"
adamc@61 145 | m :: ms => (DOpen (m, ms), s (OPENleft, mpathright)))
adamc@88 146 | OPEN CONSTRAINTS mpath (case mpath of
adamc@88 147 [] => raise Fail "Impossible mpath parse [3]"
adamc@88 148 | m :: ms => (DOpenConstraints (m, ms), s (OPENleft, mpathright)))
adamc@88 149 | CONSTRAINT cterm TWIDDLE cterm (DConstraint (cterm1, cterm2), s (CONSTRAINTleft, ctermright))
adamc@109 150 | EXPORT spath (DExport spath, s (EXPORTleft, spathright))
adamc@30 151
adamc@42 152 sgn : sgntm (sgntm)
adamc@40 153 | FUNCTOR LPAREN CSYMBOL COLON sgn RPAREN COLON sgn
adamc@40 154 (SgnFun (CSYMBOL, sgn1, sgn2), s (FUNCTORleft, sgn2right))
adamc@30 155
adamc@42 156 sgntm : SIG sgis END (SgnConst sgis, s (SIGleft, ENDright))
adamc@59 157 | mpath (case mpath of
adamc@61 158 [] => raise Fail "Impossible mpath parse [2]"
adamc@59 159 | [x] => SgnVar x
adamc@59 160 | m :: ms => SgnProj (m,
adamc@59 161 List.take (ms, length ms - 1),
adamc@59 162 List.nth (ms, length ms - 1)),
adamc@59 163 s (mpathleft, mpathright))
adamc@42 164 | sgntm WHERE CON SYMBOL EQ cexp (SgnWhere (sgntm, SYMBOL, cexp), s (sgntmleft, cexpright))
adamc@42 165 | sgntm WHERE LTYPE SYMBOL EQ cexp(SgnWhere (sgntm, SYMBOL, cexp), s (sgntmleft, cexpright))
adamc@42 166 | LPAREN sgn RPAREN (sgn)
adamc@42 167
adamc@30 168 sgi : CON SYMBOL DCOLON kind (SgiConAbs (SYMBOL, kind), s (CONleft, kindright))
adamc@30 169 | LTYPE SYMBOL (SgiConAbs (SYMBOL, (KType, s (LTYPEleft, SYMBOLright))),
adamc@30 170 s (LTYPEleft, SYMBOLright))
adamc@30 171 | CON SYMBOL EQ cexp (SgiCon (SYMBOL, NONE, cexp), s (CONleft, cexpright))
adamc@30 172 | CON SYMBOL DCOLON kind EQ cexp (SgiCon (SYMBOL, SOME kind, cexp), s (CONleft, cexpright))
adamc@30 173 | LTYPE SYMBOL EQ cexp (SgiCon (SYMBOL, SOME (KType, s (LTYPEleft, cexpright)), cexp),
adamc@30 174 s (LTYPEleft, cexpright))
adamc@30 175 | VAL SYMBOL COLON cexp (SgiVal (SYMBOL, cexp), s (VALleft, cexpright))
adamc@30 176
adamc@30 177 | STRUCTURE CSYMBOL COLON sgn (SgiStr (CSYMBOL, sgn), s (STRUCTUREleft, sgnright))
adamc@59 178 | SIGNATURE CSYMBOL EQ sgn (SgiSgn (CSYMBOL, sgn), s (SIGNATUREleft, sgnright))
adamc@42 179 | FUNCTOR CSYMBOL LPAREN CSYMBOL COLON sgn RPAREN COLON sgn
adamc@42 180 (SgiStr (CSYMBOL1,
adamc@42 181 (SgnFun (CSYMBOL2, sgn1, sgn2), s (FUNCTORleft, sgn2right))),
adamc@42 182 s (FUNCTORleft, sgn2right))
adamc@58 183 | INCLUDE sgn (SgiInclude sgn, s (INCLUDEleft, sgnright))
adamc@88 184 | CONSTRAINT cterm TWIDDLE cterm (SgiConstraint (cterm1, cterm2), s (CONSTRAINTleft, ctermright))
adamc@30 185
adamc@30 186 sgis : ([])
adamc@30 187 | sgi sgis (sgi :: sgis)
adamc@30 188
adamc@30 189 str : STRUCT decls END (StrConst decls, s (STRUCTleft, ENDright))
adamc@34 190 | spath (spath)
adamc@40 191 | FUNCTOR LPAREN CSYMBOL COLON sgn RPAREN DARROW str
adamc@40 192 (StrFun (CSYMBOL, sgn, NONE, str), s (FUNCTORleft, strright))
adamc@40 193 | FUNCTOR LPAREN CSYMBOL COLON sgn RPAREN COLON sgn DARROW str
adamc@40 194 (StrFun (CSYMBOL, sgn1, SOME sgn2, str), s (FUNCTORleft, strright))
adamc@44 195 | spath LPAREN str RPAREN (StrApp (spath, str), s (spathleft, RPARENright))
adamc@34 196
adamc@34 197 spath : CSYMBOL (StrVar CSYMBOL, s (CSYMBOLleft, CSYMBOLright))
adamc@34 198 | spath DOT CSYMBOL (StrProj (spath, CSYMBOL), s (spathleft, CSYMBOLright))
adamc@30 199
adamc@1 200 kind : TYPE (KType, s (TYPEleft, TYPEright))
adamc@1 201 | NAME (KName, s (NAMEleft, NAMEright))
adamc@1 202 | LBRACE kind RBRACE (KRecord kind, s (LBRACEleft, RBRACEright))
adamc@1 203 | kind ARROW kind (KArrow (kind1, kind2), s (kind1left, kind2right))
adamc@1 204 | LPAREN kind RPAREN (#1 kind, s (LPARENleft, RPARENright))
adamc@82 205 | KUNIT (KUnit, s (KUNITleft, KUNITright))
adamc@18 206 | UNDERUNDER (KWild, s (UNDERUNDERleft, UNDERUNDERright))
adamc@1 207
adamc@1 208 capps : cterm (cterm)
adamc@1 209 | capps cterm (CApp (capps, cterm), s (cappsleft, ctermright))
adamc@1 210
adamc@1 211 cexp : capps (capps)
adamc@1 212 | cexp ARROW cexp (TFun (cexp1, cexp2), s (cexp1left, cexp2right))
adamc@15 213 | SYMBOL kcolon kind ARROW cexp (TCFun (kcolon, SYMBOL, kind, cexp), s (SYMBOLleft, cexpright))
adamc@1 214
adamc@1 215 | cexp PLUSPLUS cexp (CConcat (cexp1, cexp2), s (cexp1left, cexp1right))
adamc@1 216
adamc@67 217 | FN SYMBOL DARROW cexp (CAbs (SYMBOL, NONE, cexp), s (FNleft, cexpright))
adamc@67 218 | FN SYMBOL DCOLON kind DARROW cexp (CAbs (SYMBOL, SOME kind, cexp), s (FNleft, cexpright))
adamc@84 219 | cterm TWIDDLE cterm DARROW cexp(CDisjoint (cterm1, cterm2, cexp), s (cterm1left, cexpright))
adamc@85 220 | cterm TWIDDLE cterm ARROW cexp (TDisjoint (cterm1, cterm2, cexp), s (cterm1left, cexpright))
adamc@1 221
adamc@8 222 | LPAREN cexp RPAREN DCOLON kind (CAnnot (cexp, kind), s (LPARENleft, kindright))
adamc@6 223
adamc@18 224 | UNDER DCOLON kind (CWild kind, s (UNDERleft, UNDERright))
adamc@18 225
adamc@1 226 kcolon : DCOLON (Explicit)
adamc@1 227 | TCOLON (Implicit)
adamc@1 228
adamc@34 229 path : SYMBOL ([], SYMBOL)
adamc@34 230 | CSYMBOL DOT path (let val (ms, x) = path in (CSYMBOL :: ms, x) end)
adamc@34 231
adamc@59 232 mpath : CSYMBOL ([CSYMBOL])
adamc@59 233 | CSYMBOL DOT mpath (CSYMBOL :: mpath)
adamc@59 234
adamc@1 235 cterm : LPAREN cexp RPAREN (#1 cexp, s (LPARENleft, RPARENright))
adamc@1 236 | LBRACK rcon RBRACK (CRecord rcon, s (LBRACKleft, RBRACKright))
adamc@83 237 | LBRACK rconn RBRACK (CRecord rconn, s (LBRACKleft, RBRACKright))
adamc@1 238 | LBRACE rcone RBRACE (TRecord (CRecord rcone, s (LBRACEleft, RBRACEright)),
adamc@1 239 s (LBRACEleft, RBRACEright))
adamc@1 240 | DOLLAR cterm (TRecord cterm, s (DOLLARleft, ctermright))
adamc@1 241 | HASH CSYMBOL (CName CSYMBOL, s (HASHleft, CSYMBOLright))
adamc@1 242
adamc@34 243 | path (CVar path, s (pathleft, pathright))
adamc@18 244 | UNDER (CWild (KWild, s (UNDERleft, UNDERright)), s (UNDERleft, UNDERright))
adamc@67 245 | FOLD (CFold, s (FOLDleft, FOLDright))
adamc@82 246 | UNIT (CUnit, s (UNITleft, UNITright))
adamc@1 247
adamc@1 248 rcon : ([])
adamc@1 249 | ident EQ cexp ([(ident, cexp)])
adamc@1 250 | ident EQ cexp COMMA rcon ((ident, cexp) :: rcon)
adamc@1 251
adamc@83 252 rconn : ident ([(ident, (CUnit, s (identleft, identright)))])
adamc@83 253 | ident COMMA rconn ((ident, (CUnit, s (identleft, identright))) :: rconn)
adamc@83 254
adamc@1 255 rcone : ([])
adamc@1 256 | ident COLON cexp ([(ident, cexp)])
adamc@1 257 | ident COLON cexp COMMA rcone ((ident, cexp) :: rcone)
adamc@1 258
adamc@1 259 ident : CSYMBOL (CName CSYMBOL, s (CSYMBOLleft, CSYMBOLright))
adamc@89 260 | path (CVar path, s (pathleft, pathright))
adamc@8 261
adamc@8 262 eapps : eterm (eterm)
adamc@8 263 | eapps eterm (EApp (eapps, eterm), s (eappsleft, etermright))
adamc@8 264 | eapps LBRACK cexp RBRACK (ECApp (eapps, cexp), s (eappsleft, RBRACKright))
adamc@8 265
adamc@8 266 eexp : eapps (eapps)
adamc@8 267 | FN SYMBOL kcolon kind DARROW eexp (ECAbs (kcolon, SYMBOL, kind, eexp), s (FNleft, eexpright))
adamc@8 268 | FN SYMBOL COLON cexp DARROW eexp (EAbs (SYMBOL, SOME cexp, eexp), s (FNleft, eexpright))
adamc@8 269 | FN SYMBOL DARROW eexp (EAbs (SYMBOL, NONE, eexp), s (FNleft, eexpright))
adamc@93 270 | LBRACK cterm TWIDDLE cterm RBRACK DARROW eexp(EDisjoint (cterm1, cterm2, eexp), s (LBRACKleft, RBRACKright))
adamc@93 271 | FN UNIT DARROW eexp (let
adamc@93 272 val loc = s (FNleft, eexpright)
adamc@93 273 in
adamc@93 274 (EAbs ("_", SOME (TRecord (CRecord [], loc), loc), eexp), loc)
adamc@93 275 end)
adamc@8 276
adamc@8 277 | LPAREN eexp RPAREN DCOLON cexp (EAnnot (eexp, cexp), s (LPARENleft, cexpright))
adamc@12 278 | eterm DOT ident (EField (eterm, ident), s (etermleft, identright))
adamc@8 279
adamc@8 280 eterm : LPAREN eexp RPAREN (#1 eexp, s (LPARENleft, RPARENright))
adamc@8 281
adamc@34 282 | path (EVar path, s (pathleft, pathright))
adamc@12 283 | LBRACE rexp RBRACE (ERecord rexp, s (LBRACEleft, RBRACEright))
adamc@110 284 | UNIT (ERecord [], s (UNITleft, UNITright))
adamc@12 285
adamc@14 286 | INT (EPrim (Prim.Int INT), s (INTleft, INTright))
adamc@14 287 | FLOAT (EPrim (Prim.Float FLOAT), s (FLOATleft, FLOATright))
adamc@14 288 | STRING (EPrim (Prim.String STRING), s (STRINGleft, STRINGright))
adamc@14 289
adamc@71 290 | FOLD (EFold, s (FOLDleft, FOLDright))
adamc@71 291
adamc@91 292 | XML_BEGIN xml XML_END (xml)
adamc@91 293 | XML_BEGIN XML_END (EApp ((EVar (["Basis"], "cdata"), s (XML_BEGINleft, XML_ENDright)),
adamc@91 294 (EPrim (Prim.String ""), s (XML_BEGINleft, XML_ENDright))),
adamc@91 295 s (XML_BEGINleft, XML_ENDright))
adamc@91 296
adamc@12 297 rexp : ([])
adamc@12 298 | ident EQ eexp ([(ident, eexp)])
adamc@12 299 | ident EQ eexp COMMA rexp ((ident, eexp) :: rexp)
adamc@91 300
adamc@91 301 xml : xmlOne xml (let
adamc@91 302 val pos = s (xmlOneleft, xmlright)
adamc@91 303 in
adamc@91 304 (EApp ((EApp (
adamc@91 305 (ECApp ((EVar (["Basis"], "join"), pos),
adamc@91 306 (CWild (KRecord (KUnit, pos), pos), pos)), pos),
adamc@91 307 xmlOne), pos),
adamc@91 308 xml), pos)
adamc@91 309 end)
adamc@91 310 | xmlOne (xmlOne)
adamc@91 311
adamc@91 312 xmlOne : NOTAGS (EApp ((EVar (["Basis"], "cdata"), s (NOTAGSleft, NOTAGSright)),
adamc@91 313 (EPrim (Prim.String NOTAGS), s (NOTAGSleft, NOTAGSright))),
adamc@91 314 s (NOTAGSleft, NOTAGSright))
adamc@104 315 | BEGIN_TAG attrs DIVIDE GT (let
adamc@92 316 val pos = s (BEGIN_TAGleft, GTright)
adamc@92 317 in
adamc@104 318 (EApp ((EApp ((EApp ((EVar (["Basis"], "tag"), pos),
adamc@104 319 (ERecord attrs, pos)), pos),
adamc@92 320 (EVar ([], BEGIN_TAG), pos)),
adamc@92 321 pos),
adamc@92 322 (EApp ((EVar (["Basis"], "cdata"), pos),
adamc@92 323 (EPrim (Prim.String ""), pos)),
adamc@92 324 pos)), pos)
adamc@92 325 end)
adamc@92 326
adamc@104 327 | BEGIN_TAG attrs GT xml END_TAG(let
adamc@104 328 val pos = s (BEGIN_TAGleft, GTright)
adamc@104 329 in
adamc@104 330 if BEGIN_TAG = END_TAG then
adamc@104 331 (EApp ((EApp ((EApp ((EVar (["Basis"], "tag"), pos),
adamc@104 332 (ERecord attrs, pos)), pos),
adamc@104 333 (EVar ([], BEGIN_TAG), pos)),
adamc@104 334 pos),
adamc@104 335 xml), pos)
adamc@104 336 else
adamc@104 337 (ErrorMsg.errorAt pos "Begin and end tags don't match.";
adamc@104 338 (EFold, pos))
adamc@104 339 end)
adamc@92 340
adamc@104 341 attrs : ([])
adamc@104 342 | attr attrs (attr :: attrs)
adamc@104 343
adamc@104 344 attr : SYMBOL EQ attrv ((CName (uppercaseFirst SYMBOL), s (SYMBOLleft, SYMBOLright)), attrv)
adamc@104 345
adamc@104 346 attrv : INT (EPrim (Prim.Int INT), s (INTleft, INTright))
adamc@104 347 | FLOAT (EPrim (Prim.Float FLOAT), s (FLOATleft, FLOATright))
adamc@104 348 | STRING (EPrim (Prim.String STRING), s (STRINGleft, STRINGright))
adamc@110 349 | LBRACE eexp RBRACE (eexp)