comparison src/urweb.grm @ 762:9021d44ba6b2

List notations
author Adam Chlipala <adamc@hcoop.net>
date Thu, 30 Apr 2009 15:10:13 -0400
parents 8323c1beef2e
children dc3fc3f3b834
comparison
equal deleted inserted replaced
761:16b34dc2e29c 762:9021d44ba6b2
930 | eexp GE eexp (native_op ("ge", eexp1, eexp2, s (eexp1left, eexp2right))) 930 | eexp GE eexp (native_op ("ge", eexp1, eexp2, s (eexp1left, eexp2right)))
931 931
932 | eexp PLUSPLUS eexp (EConcat (eexp1, eexp2), s (eexp1left, eexp2right)) 932 | eexp PLUSPLUS eexp (EConcat (eexp1, eexp2), s (eexp1left, eexp2right))
933 933
934 | eexp CARET eexp (native_op ("strcat", eexp1, eexp2, s (eexp1left, eexp2right))) 934 | eexp CARET eexp (native_op ("strcat", eexp1, eexp2, s (eexp1left, eexp2right)))
935
936 | eterm DCOLON eexp (let
937 val loc = s (etermleft, eexpright)
938 in
939 (EApp ((EVar (["Basis"], "Cons", Infer), loc),
940 (ERecord [((CName "1", loc),
941 eterm),
942 ((CName "2", loc),
943 eexp)], loc)), loc)
944 end)
935 945
936 bind : SYMBOL LARROW eapps (SYMBOL, NONE, eapps) 946 bind : SYMBOL LARROW eapps (SYMBOL, NONE, eapps)
937 | UNIT LARROW eapps (let 947 | UNIT LARROW eapps (let
938 val loc = s (UNITleft, eappsright) 948 val loc = s (UNITleft, eappsright)
939 in 949 in
1159 1169
1160 | UNDER (EWild, s (UNDERleft, UNDERright)) 1170 | UNDER (EWild, s (UNDERleft, UNDERright))
1161 1171
1162 | LET edecls IN eexp END (ELet (edecls, eexp), s (LETleft, ENDright)) 1172 | LET edecls IN eexp END (ELet (edecls, eexp), s (LETleft, ENDright))
1163 1173
1174 | LBRACK RBRACK (EVar (["Basis"], "Nil", Infer), s (LBRACKleft, RBRACKright))
1175
1164 edecls : ([]) 1176 edecls : ([])
1165 | edecl edecls (edecl :: edecls) 1177 | edecl edecls (edecl :: edecls)
1166 1178
1167 edecl : VAL vali ((EDVal vali, s (VALleft, valiright))) 1179 edecl : VAL vali ((EDVal vali, s (VALleft, valiright)))
1168 | VAL REC valis ((EDValRec valis, s (VALleft, valisright))) 1180 | VAL REC valis ((EDValRec valis, s (VALleft, valisright)))
1194 branchs: ([]) 1206 branchs: ([])
1195 | BAR branch branchs (branch :: branchs) 1207 | BAR branch branchs (branch :: branchs)
1196 1208
1197 pat : pterm (pterm) 1209 pat : pterm (pterm)
1198 | cpath pterm (PCon (#1 cpath, #2 cpath, SOME pterm), s (cpathleft, ptermright)) 1210 | cpath pterm (PCon (#1 cpath, #2 cpath, SOME pterm), s (cpathleft, ptermright))
1211 | pterm DCOLON pat (let
1212 val loc = s (ptermleft, patright)
1213 in
1214 (PCon (["Basis"], "Cons", SOME (PRecord ([("1", pterm),
1215 ("2", pat)], false), loc)),
1216 loc)
1217 end)
1199 1218
1200 pterm : SYMBOL (PVar SYMBOL, s (SYMBOLleft, SYMBOLright)) 1219 pterm : SYMBOL (PVar SYMBOL, s (SYMBOLleft, SYMBOLright))
1201 | cpath (PCon (#1 cpath, #2 cpath, NONE), s (cpathleft, cpathright)) 1220 | cpath (PCon (#1 cpath, #2 cpath, NONE), s (cpathleft, cpathright))
1202 | UNDER (PWild, s (UNDERleft, UNDERright)) 1221 | UNDER (PWild, s (UNDERleft, UNDERright))
1203 | INT (PPrim (Prim.Int INT), s (INTleft, INTright)) 1222 | INT (PPrim (Prim.Int INT), s (INTleft, INTright))
1207 | UNIT (PRecord ([], false), s (UNITleft, UNITright)) 1226 | UNIT (PRecord ([], false), s (UNITleft, UNITright))
1208 | LBRACE rpat RBRACE (PRecord rpat, s (LBRACEleft, RBRACEright)) 1227 | LBRACE rpat RBRACE (PRecord rpat, s (LBRACEleft, RBRACEright))
1209 | LPAREN ptuple RPAREN (PRecord (ListUtil.mapi (fn (i, p) => (Int.toString (i + 1), p)) ptuple, 1228 | LPAREN ptuple RPAREN (PRecord (ListUtil.mapi (fn (i, p) => (Int.toString (i + 1), p)) ptuple,
1210 false), 1229 false),
1211 s (LPARENleft, RPARENright)) 1230 s (LPARENleft, RPARENright))
1231 | LBRACK RBRACK (PCon (["Basis"], "Nil", NONE), s (LBRACKleft, RBRACKright))
1212 1232
1213 rpat : CSYMBOL EQ pat ([(CSYMBOL, pat)], false) 1233 rpat : CSYMBOL EQ pat ([(CSYMBOL, pat)], false)
1214 | INT EQ pat ([(Int64.toString INT, pat)], false) 1234 | INT EQ pat ([(Int64.toString INT, pat)], false)
1215 | DOTDOTDOT ([], true) 1235 | DOTDOTDOT ([], true)
1216 | CSYMBOL EQ pat COMMA rpat ((CSYMBOL, pat) :: #1 rpat, #2 rpat) 1236 | CSYMBOL EQ pat COMMA rpat ((CSYMBOL, pat) :: #1 rpat, #2 rpat)