diff src/compiler.sml @ 132:25b28625d4df

Proper topological sorting in untangle
author Adam Chlipala <adamc@hcoop.net>
date Thu, 17 Jul 2008 12:40:21 -0400
parents 5df655503288
children 55d8cfa4d024
line wrap: on
line diff
--- a/src/compiler.sml	Thu Jul 17 12:19:44 2008 -0400
+++ b/src/compiler.sml	Thu Jul 17 12:40:21 2008 -0400
@@ -232,8 +232,17 @@
         else
             SOME (Monoize.monoize CoreEnv.empty file)
 
+fun mono_opt' job =
+    case monoize job of
+        NONE => NONE
+      | SOME file =>
+        if ErrorMsg.anyErrors () then
+            NONE
+        else
+            SOME (MonoOpt.optimize file)
+
 fun untangle job =
-    case monoize job of
+    case mono_opt' job of
         NONE => NONE
       | SOME file =>
         if ErrorMsg.anyErrors () then
@@ -339,6 +348,15 @@
     handle MonoEnv.UnboundNamed n =>
            print ("Unbound named " ^ Int.toString n ^ "\n")
 
+fun testMono_opt' job =
+    (case mono_opt' job of
+         NONE => print "Failed\n"
+       | SOME file =>
+         (Print.print (MonoPrint.p_file MonoEnv.empty file);
+          print "\n"))
+    handle MonoEnv.UnboundNamed n =>
+           print ("Unbound named " ^ Int.toString n ^ "\n")
+
 fun testUntangle job =
     (case untangle job of
          NONE => print "Failed\n"