diff src/lacweb.grm @ 12:d89477f07c1e

Fun with records
author Adam Chlipala <adamc@hcoop.net>
date Fri, 28 Mar 2008 17:34:57 -0400
parents a455a9f85cc3
children f1c36df29ed7
line wrap: on
line diff
--- a/src/lacweb.grm	Fri Mar 28 15:20:46 2008 -0400
+++ b/src/lacweb.grm	Fri Mar 28 17:34:57 2008 -0400
@@ -62,6 +62,7 @@
  | eexp of exp
  | eapps of exp
  | eterm of exp
+ | rexp of (con * exp) list
 
 %verbose                                (* print summary of errors *)
 %pos int                                (* positions *)
@@ -147,7 +148,13 @@
        | FN SYMBOL DARROW eexp          (EAbs (SYMBOL, NONE, eexp), s (FNleft, eexpright))
 
        | LPAREN eexp RPAREN DCOLON cexp (EAnnot (eexp, cexp), s (LPARENleft, cexpright))
+       | eterm DOT ident                (EField (eterm, ident), s (etermleft, identright))
 
 eterm  : LPAREN eexp RPAREN             (#1 eexp, s (LPARENleft, RPARENright))
 
        | SYMBOL                         (EVar SYMBOL, s (SYMBOLleft, SYMBOLright))
+       | LBRACE rexp RBRACE             (ERecord rexp, s (LBRACEleft, RBRACEright))
+
+rexp   :                                ([])
+       | ident EQ eexp                  ([(ident, eexp)])
+       | ident EQ eexp COMMA rexp       ((ident, eexp) :: rexp)