comparison src/monoize.sml @ 821:395a5d450cc0

Chars and more string operations
author Adam Chlipala <adamc@hcoop.net>
date Tue, 26 May 2009 12:25:06 -0400
parents 91f465ded07e
children 669ac5e9a69e
comparison
equal deleted inserted replaced
820:91f465ded07e 821:395a5d450cc0
760 (L'.TFun ((L'.TFfi ("Basis", "string"), loc), (L'.TFfi ("Basis", "bool"), loc)), loc), 760 (L'.TFun ((L'.TFfi ("Basis", "string"), loc), (L'.TFfi ("Basis", "bool"), loc)), loc),
761 (L'.EAbs ("y", (L'.TFfi ("Basis", "string"), loc), 761 (L'.EAbs ("y", (L'.TFfi ("Basis", "string"), loc),
762 (L'.TFfi ("Basis", "bool"), loc), 762 (L'.TFfi ("Basis", "bool"), loc),
763 (L'.EBinop ("!strcmp", (L'.ERel 1, loc), (L'.ERel 0, loc)), loc)), loc)), loc), 763 (L'.EBinop ("!strcmp", (L'.ERel 1, loc), (L'.ERel 0, loc)), loc)), loc)), loc),
764 fm) 764 fm)
765 | L.EFfi ("Basis", "eq_char") =>
766 ((L'.EAbs ("x", (L'.TFfi ("Basis", "char"), loc),
767 (L'.TFun ((L'.TFfi ("Basis", "char"), loc), (L'.TFfi ("Basis", "bool"), loc)), loc),
768 (L'.EAbs ("y", (L'.TFfi ("Basis", "char"), loc),
769 (L'.TFfi ("Basis", "bool"), loc),
770 (L'.EBinop ("==", (L'.ERel 1, loc), (L'.ERel 0, loc)), loc)), loc)), loc),
771 fm)
765 | L.EFfi ("Basis", "eq_time") => 772 | L.EFfi ("Basis", "eq_time") =>
766 ((L'.EAbs ("x", (L'.TFfi ("Basis", "time"), loc), 773 ((L'.EAbs ("x", (L'.TFfi ("Basis", "time"), loc),
767 (L'.TFun ((L'.TFfi ("Basis", "time"), loc), (L'.TFfi ("Basis", "bool"), loc)), loc), 774 (L'.TFun ((L'.TFfi ("Basis", "time"), loc), (L'.TFfi ("Basis", "bool"), loc)), loc),
768 (L'.EAbs ("y", (L'.TFfi ("Basis", "time"), loc), 775 (L'.EAbs ("y", (L'.TFfi ("Basis", "time"), loc),
769 (L'.TFfi ("Basis", "bool"), loc), 776 (L'.TFfi ("Basis", "bool"), loc),
969 in 976 in
970 ordEx ((L'.TFfi ("Basis", "string"), loc), 977 ordEx ((L'.TFfi ("Basis", "string"), loc),
971 boolBin "<", 978 boolBin "<",
972 boolBin "<=") 979 boolBin "<=")
973 end 980 end
981 | L.EFfi ("Basis", "ord_char") =>
982 let
983 fun charBin s =
984 (L'.EAbs ("x", (L'.TFfi ("Basis", "char"), loc),
985 (L'.TFun ((L'.TFfi ("Basis", "char"), loc), (L'.TFfi ("Basis", "bool"), loc)), loc),
986 (L'.EAbs ("y", (L'.TFfi ("Basis", "char"), loc),
987 (L'.TFfi ("Basis", "bool"), loc),
988 (L'.EBinop (s, (L'.ERel 1, loc), (L'.ERel 0, loc)), loc)), loc)), loc)
989 in
990 ordEx ((L'.TFfi ("Basis", "char"), loc),
991 charBin "<",
992 charBin "<=")
993 end
974 | L.EFfi ("Basis", "ord_time") => 994 | L.EFfi ("Basis", "ord_time") =>
975 let 995 let
976 fun boolBin s = 996 fun boolBin s =
977 (L'.EAbs ("x", (L'.TFfi ("Basis", "time"), loc), 997 (L'.EAbs ("x", (L'.TFfi ("Basis", "time"), loc),
978 (L'.TFun ((L'.TFfi ("Basis", "time"), loc), (L'.TFfi ("Basis", "bool"), loc)), loc), 998 (L'.TFun ((L'.TFfi ("Basis", "time"), loc), (L'.TFfi ("Basis", "bool"), loc)), loc),
1001 let 1021 let
1002 val s = (L'.TFfi ("Basis", "string"), loc) 1022 val s = (L'.TFfi ("Basis", "string"), loc)
1003 in 1023 in
1004 ((L'.EAbs ("s", s, s, (L'.ERel 0, loc)), loc), fm) 1024 ((L'.EAbs ("s", s, s, (L'.ERel 0, loc)), loc), fm)
1005 end 1025 end
1026 | L.EFfi ("Basis", "show_char") =>
1027 ((L'.EFfi ("Basis", "charToString"), loc), fm)
1006 | L.EFfi ("Basis", "show_bool") => 1028 | L.EFfi ("Basis", "show_bool") =>
1007 ((L'.EFfi ("Basis", "boolToString"), loc), fm) 1029 ((L'.EFfi ("Basis", "boolToString"), loc), fm)
1008 | L.EFfi ("Basis", "show_time") => 1030 | L.EFfi ("Basis", "show_time") =>
1009 ((L'.EFfi ("Basis", "timeToString"), loc), fm) 1031 ((L'.EFfi ("Basis", "timeToString"), loc), fm)
1010 | L.ECApp ((L.ECApp ((L.ECApp ((L.EFfi ("Basis", "show_xml"), _), _),_), _), _), _) => 1032 | L.ECApp ((L.ECApp ((L.ECApp ((L.EFfi ("Basis", "show_xml"), _), _),_), _), _), _) =>
1076 val s = (L'.TFfi ("Basis", "string"), loc) 1098 val s = (L'.TFfi ("Basis", "string"), loc)
1077 in 1099 in
1078 ((L'.ERecord [("Read", (L'.EAbs ("s", s, (L'.TOption s, loc), 1100 ((L'.ERecord [("Read", (L'.EAbs ("s", s, (L'.TOption s, loc),
1079 (L'.ESome (s, (L'.ERel 0, loc)), loc)), loc), readType' (s, loc)), 1101 (L'.ESome (s, (L'.ERel 0, loc)), loc)), loc), readType' (s, loc)),
1080 ("ReadError", (L'.EAbs ("s", s, s, (L'.ERel 0, loc)), loc), readErrType (s, loc))], loc), 1102 ("ReadError", (L'.EAbs ("s", s, s, (L'.ERel 0, loc)), loc), readErrType (s, loc))], loc),
1103 fm)
1104 end
1105 | L.EFfi ("Basis", "read_char") =>
1106 let
1107 val t = (L'.TFfi ("Basis", "char"), loc)
1108 in
1109 ((L'.ERecord [("Read", (L'.EFfi ("Basis", "stringToChar"), loc), readType' (t, loc)),
1110 ("ReadError", (L'.EFfi ("Basis", "stringToChar_error"), loc), readErrType (t, loc))],
1111 loc),
1081 fm) 1112 fm)
1082 end 1113 end
1083 | L.EFfi ("Basis", "read_bool") => 1114 | L.EFfi ("Basis", "read_bool") =>
1084 let 1115 let
1085 val t = (L'.TFfi ("Basis", "bool"), loc) 1116 val t = (L'.TFfi ("Basis", "bool"), loc)