diff src/compiler.sml @ 26:4ab19c19665f

Closure conversion
author Adam Chlipala <adamc@hcoop.net>
date Tue, 10 Jun 2008 15:56:33 -0400
parents 0a762c73824d
children 537db4ee89f4
line wrap: on
line diff
--- a/src/compiler.sml	Tue Jun 10 13:14:45 2008 -0400
+++ b/src/compiler.sml	Tue Jun 10 15:56:33 2008 -0400
@@ -103,6 +103,15 @@
         else
             SOME (Monoize.monoize cenv file)
 
+fun cloconv eenv cenv filename =
+    case monoize eenv cenv filename of
+        NONE => NONE
+      | SOME file =>
+        if ErrorMsg.anyErrors () then
+            NONE
+        else
+            SOME (Cloconv.cloconv file)
+
 fun testParse filename =
     case parse filename of
         NONE => print "Failed\n"
@@ -155,4 +164,13 @@
     handle MonoEnv.UnboundNamed n =>
            print ("Unbound named " ^ Int.toString n ^ "\n")
 
+fun testCloconv filename =
+    (case cloconv ElabEnv.basis CoreEnv.basis filename of
+         NONE => print "Failed\n"
+       | SOME file =>
+         (Print.print (FlatPrint.p_file FlatEnv.basis file);
+          print "\n"))
+    handle FlatEnv.UnboundNamed n =>
+           print ("Unbound named " ^ Int.toString n ^ "\n")
+
 end