diff src/flat_util.sml @ 52:198172560b73

FFI through cloconv
author Adam Chlipala <adamc@hcoop.net>
date Sun, 22 Jun 2008 10:17:34 -0400
parents 537db4ee89f4
children 5182f0c80d2e
line wrap: on
line diff
--- a/src/flat_util.sml	Sun Jun 22 10:12:23 2008 -0400
+++ b/src/flat_util.sml	Sun Jun 22 10:17:34 2008 -0400
@@ -61,6 +61,7 @@
             joinL compareFields (xts1, xts2)
         end
       | (TNamed n1, TNamed n2) => Int.compare (n1, n2)
+      | (TFfi (m1, x1), TFfi (m2, x2)) => join (String.compare (m1, m2), fn () => String.compare (x1, x2))
 
       | (TTop, _) => LESS
       | (_, TTop) => GREATER
@@ -74,6 +75,9 @@
       | (TRecord _, _) => LESS
       | (_, TRecord _) => GREATER
 
+      | (TNamed _, _) => LESS
+      | (_, TNamed _) => GREATER
+
 and compareFields ((x1, t1), (x2, t2)) =
     join (String.compare (x1, x2),
           fn () => compare (t1, t2))
@@ -108,6 +112,7 @@
                                          xts,
                      fn xts' => (TRecord xts', loc))
               | TNamed _ => S.return2 cAll
+              | TFfi _ => S.return2 cAll
     in
         mft
     end
@@ -152,6 +157,11 @@
                 EPrim _ => S.return2 eAll
               | ERel _ => S.return2 eAll
               | ENamed _ => S.return2 eAll
+              | EFfi _ => S.return2 eAll
+              | EFfiApp (m, x, es) =>
+                S.map2 (ListUtil.mapfold (fn e => mfe ctx e) es,
+                     fn es' =>
+                        (EFfiApp (m, x, es'), loc))
               | ECode _ => S.return2 eAll
               | EApp (e1, e2) =>
                 S.bind2 (mfe ctx e1,