diff src/compiler.sml @ 109:813e5a52063d

Remove closure conversion in favor of zany fun with modules, which also replaces 'page'
author Adam Chlipala <adamc@hcoop.net>
date Sun, 13 Jul 2008 10:17:06 -0400
parents 5f04adf47f48
children 3739af9e727a
line wrap: on
line diff
--- a/src/compiler.sml	Thu Jul 10 16:05:14 2008 -0400
+++ b/src/compiler.sml	Sun Jul 13 10:17:06 2008 -0400
@@ -111,9 +111,11 @@
 
 fun parse fnames =
     let
+        fun nameOf fname = capitalize (OS.Path.file fname)
+
         fun parseOne fname =
             let
-                val mname = capitalize (OS.Path.file fname)
+                val mname = nameOf fname
                 val lac = OS.Path.joinBaseExt {base = fname, ext = SOME "lac"}
                 val lig = OS.Path.joinBaseExt {base = fname, ext = SOME "lig"}
 
@@ -137,7 +139,13 @@
                     SOME (Source.DStr (mname, sgnO, (Source.StrConst ds, loc)), loc)
             end
 
-        val ds = List.mapPartial parseOne fnames            
+        val ds = List.mapPartial parseOne fnames
+        val ds =
+            let
+                val final = nameOf (List.last fnames)
+            in
+                ds @ [(Source.DExport (Source.StrVar final, ErrorMsg.dummySpan), ErrorMsg.dummySpan)]
+            end handle Empty => ds
     in
         if ErrorMsg.anyErrors () then
             NONE
@@ -224,22 +232,13 @@
         else
             SOME (MonoOpt.optimize file)
 
-fun cloconv job =
+fun cjrize job =
     case mono_opt job of
         NONE => NONE
       | SOME file =>
         if ErrorMsg.anyErrors () then
             NONE
         else
-            SOME (Cloconv.cloconv file)
-
-fun cjrize job =
-    case cloconv job of
-        NONE => NONE
-      | SOME file =>
-        if ErrorMsg.anyErrors () then
-            NONE
-        else
             SOME (Cjrize.cjrize file)
 
 fun testParse job =
@@ -322,15 +321,6 @@
     handle MonoEnv.UnboundNamed n =>
            print ("Unbound named " ^ Int.toString n ^ "\n")
 
-fun testCloconv job =
-    (case cloconv job of
-         NONE => print "Failed\n"
-       | SOME file =>
-         (Print.print (FlatPrint.p_file FlatEnv.empty file);
-          print "\n"))
-    handle FlatEnv.UnboundNamed n =>
-           print ("Unbound named " ^ Int.toString n ^ "\n")
-
 fun testCjrize job =
     (case cjrize job of
          NONE => print "Failed\n"