comparison src/lacweb.grm @ 91:4327abd52997

Basic XML stuff
author Adam Chlipala <adamc@hcoop.net>
date Thu, 03 Jul 2008 16:26:28 -0400
parents d3ee072fa609
children 1a4c51fa615c
comparison
equal deleted inserted replaced
90:94ef20a31550 91:4327abd52997
38 EOF 38 EOF
39 | STRING of string | INT of Int64.int | FLOAT of Real64.real 39 | STRING of string | INT of Int64.int | FLOAT of Real64.real
40 | SYMBOL of string | CSYMBOL of string 40 | SYMBOL of string | CSYMBOL of string
41 | LPAREN | RPAREN | LBRACK | RBRACK | LBRACE | RBRACE 41 | LPAREN | RPAREN | LBRACK | RBRACK | LBRACE | RBRACE
42 | EQ | COMMA | COLON | DCOLON | TCOLON | DOT | HASH | UNDER | UNDERUNDER 42 | EQ | COMMA | COLON | DCOLON | TCOLON | DOT | HASH | UNDER | UNDERUNDER
43 | DIVIDE | GT
43 | CON | LTYPE | VAL | FOLD | UNIT | KUNIT 44 | CON | LTYPE | VAL | FOLD | UNIT | KUNIT
44 | TYPE | NAME 45 | TYPE | NAME
45 | ARROW | LARROW | DARROW 46 | ARROW | LARROW | DARROW
46 | FN | PLUSPLUS | DOLLAR | TWIDDLE 47 | FN | PLUSPLUS | DOLLAR | TWIDDLE
47 | STRUCTURE | SIGNATURE | STRUCT | SIG | END | FUNCTOR | WHERE | EXTERN 48 | STRUCTURE | SIGNATURE | STRUCT | SIG | END | FUNCTOR | WHERE | EXTERN
48 | INCLUDE | OPEN | CONSTRAINT | CONSTRAINTS 49 | INCLUDE | OPEN | CONSTRAINT | CONSTRAINTS
50
51 | XML_BEGIN of string | XML_END
52 | NOTAGS of string
53 | BEGIN_TAG of string | END_TAG of string
49 54
50 %nonterm 55 %nonterm
51 file of decl list 56 file of decl list
52 | decls of decl list 57 | decls of decl list
53 | decl of decl 58 | decl of decl
76 81
77 | eexp of exp 82 | eexp of exp
78 | eapps of exp 83 | eapps of exp
79 | eterm of exp 84 | eterm of exp
80 | rexp of (con * exp) list 85 | rexp of (con * exp) list
86 | xml of exp
87 | xmlOne of exp
81 88
82 %verbose (* print summary of errors *) 89 %verbose (* print summary of errors *)
83 %pos int (* positions *) 90 %pos int (* positions *)
84 %start file 91 %start file
85 %pure 92 %pure
266 | FLOAT (EPrim (Prim.Float FLOAT), s (FLOATleft, FLOATright)) 273 | FLOAT (EPrim (Prim.Float FLOAT), s (FLOATleft, FLOATright))
267 | STRING (EPrim (Prim.String STRING), s (STRINGleft, STRINGright)) 274 | STRING (EPrim (Prim.String STRING), s (STRINGleft, STRINGright))
268 275
269 | FOLD (EFold, s (FOLDleft, FOLDright)) 276 | FOLD (EFold, s (FOLDleft, FOLDright))
270 277
278 | XML_BEGIN xml XML_END (xml)
279 | XML_BEGIN XML_END (EApp ((EVar (["Basis"], "cdata"), s (XML_BEGINleft, XML_ENDright)),
280 (EPrim (Prim.String ""), s (XML_BEGINleft, XML_ENDright))),
281 s (XML_BEGINleft, XML_ENDright))
282
271 rexp : ([]) 283 rexp : ([])
272 | ident EQ eexp ([(ident, eexp)]) 284 | ident EQ eexp ([(ident, eexp)])
273 | ident EQ eexp COMMA rexp ((ident, eexp) :: rexp) 285 | ident EQ eexp COMMA rexp ((ident, eexp) :: rexp)
286
287 xml : xmlOne xml (let
288 val pos = s (xmlOneleft, xmlright)
289 in
290 (EApp ((EApp (
291 (ECApp ((EVar (["Basis"], "join"), pos),
292 (CWild (KRecord (KUnit, pos), pos), pos)), pos),
293 xmlOne), pos),
294 xml), pos)
295 end)
296 | xmlOne (xmlOne)
297
298 xmlOne : NOTAGS (EApp ((EVar (["Basis"], "cdata"), s (NOTAGSleft, NOTAGSright)),
299 (EPrim (Prim.String NOTAGS), s (NOTAGSleft, NOTAGSright))),
300 s (NOTAGSleft, NOTAGSright))
301 | BEGIN_TAG DIVIDE GT (EApp ((EApp ((EVar (["Basis"], "tag"), s (BEGIN_TAGleft, GTright)),
302 (EVar ([], BEGIN_TAG), s (BEGIN_TAGleft, GTright))),
303 s (BEGIN_TAGleft, GTright)),
304 (EApp ((EVar (["Basis"], "cdata"), s (BEGIN_TAGleft, GTright)),
305 (EPrim (Prim.String ""), s (BEGIN_TAGleft, GTright))),
306 s (BEGIN_TAGleft, GTright))), s (BEGIN_TAGleft, GTright))