summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-08-31 14:33:22 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-08-31 14:33:22 -0400
commitb145f505390243386da2992877a276edc8ab0256 (patch)
tree9ab9f9542690843728071520a851af4fe5d581c6 /src
parentd43dc372d0dbc90031696d8503c05654e6605f84 (diff)
Monoized binary operators
Diffstat (limited to 'src')
-rw-r--r--src/monoize.sml38
1 files changed, 36 insertions, 2 deletions
diff --git a/src/monoize.sml b/src/monoize.sml
index e908b162..7344c22f 100644
--- a/src/monoize.sml
+++ b/src/monoize.sml
@@ -684,6 +684,38 @@ fun monoExp (env, st, fm) (all as (e, loc)) =
(L.ECApp (
(L.ECApp (
(L.ECApp (
+ (L.ECApp (
+ (L.ECApp (
+ (L.EFfi ("Basis", "sql_binary"), _),
+ _), _),
+ _), _),
+ _), _),
+ _), _),
+ _), _),
+ _) =>
+ let
+ val s = (L'.TFfi ("Basis", "string"), loc)
+ fun sc s = (L'.EPrim (Prim.String s), loc)
+ in
+ ((L'.EAbs ("c", s, (L'.TFun (s, (L'.TFun (s, s), loc)), loc),
+ (L'.EAbs ("e1", s, (L'.TFun (s, s), loc),
+ (L'.EAbs ("e2", s, s,
+ strcat loc [sc "(",
+ (L'.ERel 1, loc),
+ sc " ",
+ (L'.ERel 2, loc),
+ sc " ",
+ (L'.ERel 0, loc),
+ sc ")"]), loc)), loc)), loc),
+ fm)
+ end
+ | L.EFfi ("Basis", "sql_and") => ((L'.EPrim (Prim.String "AND"), loc), fm)
+ | L.EFfi ("Basis", "sql_or") => ((L'.EPrim (Prim.String "OR"), loc), fm)
+
+ | L.ECApp (
+ (L.ECApp (
+ (L.ECApp (
+ (L.ECApp (
(L.EFfi ("Basis", "sql_comparison"), _),
_), _),
_), _),
@@ -696,11 +728,13 @@ fun monoExp (env, st, fm) (all as (e, loc)) =
((L'.EAbs ("c", s, (L'.TFun (s, (L'.TFun (s, s), loc)), loc),
(L'.EAbs ("e1", s, (L'.TFun (s, s), loc),
(L'.EAbs ("e2", s, s,
- strcat loc [(L'.ERel 1, loc),
+ strcat loc [sc "(",
+ (L'.ERel 1, loc),
sc " ",
(L'.ERel 2, loc),
sc " ",
- (L'.ERel 0, loc)]), loc)), loc)), loc),
+ (L'.ERel 0, loc),
+ sc ")"]), loc)), loc)), loc),
fm)
end