comparison src/lacweb.grm @ 174:7ee424760d2f

Elaborating module constructor patterns; parsing record patterns
author Adam Chlipala <adamc@hcoop.net>
date Thu, 31 Jul 2008 11:28:55 -0400
parents 8221b95cc24c
children b2d752455182
comparison
equal deleted inserted replaced
173:8221b95cc24c 174:7ee424760d2f
41 EOF 41 EOF
42 | STRING of string | INT of Int64.int | FLOAT of Real64.real 42 | STRING of string | INT of Int64.int | FLOAT of Real64.real
43 | SYMBOL of string | CSYMBOL of string 43 | SYMBOL of string | CSYMBOL of string
44 | LPAREN | RPAREN | LBRACK | RBRACK | LBRACE | RBRACE 44 | LPAREN | RPAREN | LBRACK | RBRACK | LBRACE | RBRACE
45 | EQ | COMMA | COLON | DCOLON | TCOLON | DOT | HASH | UNDER | UNDERUNDER | BAR 45 | EQ | COMMA | COLON | DCOLON | TCOLON | DOT | HASH | UNDER | UNDERUNDER | BAR
46 | DIVIDE | GT 46 | DIVIDE | GT | DOTDOTDOT
47 | CON | LTYPE | VAL | REC | AND | FOLD | UNIT | KUNIT 47 | CON | LTYPE | VAL | REC | AND | FOLD | UNIT | KUNIT
48 | DATATYPE | OF 48 | DATATYPE | OF
49 | TYPE | NAME 49 | TYPE | NAME
50 | ARROW | LARROW | DARROW 50 | ARROW | LARROW | DARROW
51 | FN | PLUSPLUS | MINUSMINUS | DOLLAR | TWIDDLE 51 | FN | PLUSPLUS | MINUSMINUS | DOLLAR | TWIDDLE
102 102
103 | branch of pat * exp 103 | branch of pat * exp
104 | branchs of (pat * exp) list 104 | branchs of (pat * exp) list
105 | pat of pat 105 | pat of pat
106 | pterm of pat 106 | pterm of pat
107 | rpat of (string * pat) list * bool
107 108
108 | attrs of (con * exp) list 109 | attrs of (con * exp) list
109 | attr of con * exp 110 | attr of con * exp
110 | attrv of exp 111 | attrv of exp
111 112
349 | cpath (PCon (#1 cpath, #2 cpath, NONE), s (cpathleft, cpathright)) 350 | cpath (PCon (#1 cpath, #2 cpath, NONE), s (cpathleft, cpathright))
350 | UNDER (PWild, s (UNDERleft, UNDERright)) 351 | UNDER (PWild, s (UNDERleft, UNDERright))
351 | INT (PPrim (Prim.Int INT), s (INTleft, INTright)) 352 | INT (PPrim (Prim.Int INT), s (INTleft, INTright))
352 | STRING (PPrim (Prim.String STRING), s (STRINGleft, STRINGright)) 353 | STRING (PPrim (Prim.String STRING), s (STRINGleft, STRINGright))
353 | LPAREN pat RPAREN (pat) 354 | LPAREN pat RPAREN (pat)
355 | LBRACE RBRACE (PRecord ([], false), s (LBRACEleft, RBRACEright))
356 | UNIT (PRecord ([], false), s (UNITleft, UNITright))
357 | LBRACE rpat RBRACE (PRecord rpat, s (LBRACEleft, RBRACEright))
358
359 rpat : STRING EQ pat ([(STRING, pat)], false)
360 | DOTDOTDOT ([], true)
361 | STRING EQ pat COMMA rpat ((STRING, pat) :: #1 rpat, #2 rpat)
354 362
355 rexp : ([]) 363 rexp : ([])
356 | ident EQ eexp ([(ident, eexp)]) 364 | ident EQ eexp ([(ident, eexp)])
357 | ident EQ eexp COMMA rexp ((ident, eexp) :: rexp) 365 | ident EQ eexp COMMA rexp ((ident, eexp) :: rexp)
358 366