changeset 115:ff13d390ec60

Cjr ready for dispatch code generation
author Adam Chlipala <adamc@hcoop.net>
date Sun, 13 Jul 2008 12:56:39 -0400
parents 0644d3c3bedf
children c5d7ce9ddd57
files src/cjr.sml src/cjr_print.sml src/mono.sml src/mono_print.sml src/monoize.sml
diffstat 5 files changed, 20 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/cjr.sml	Sun Jul 13 12:51:58 2008 -0400
+++ b/src/cjr.sml	Sun Jul 13 12:56:39 2008 -0400
@@ -61,6 +61,6 @@
 
 withtype decl = decl' located
 
-type file = decl list * int list
+type file = decl list * (string * int) list
 
 end
--- a/src/cjr_print.sml	Sun Jul 13 12:51:58 2008 -0400
+++ b/src/cjr_print.sml	Sun Jul 13 12:56:39 2008 -0400
@@ -173,8 +173,12 @@
                  string "}"]
         end
 
-fun p_page env n = box [p_enamed env n,
-                        string "(lw_unit_v);"]
+fun p_page env (s, n) =
+    box [string "/* ",
+         string s,
+         string " */ ",
+         p_enamed env n,
+         string "(lw_unit_v);"]
 
 fun p_file env (ds, ps) =
     let
--- a/src/mono.sml	Sun Jul 13 12:51:58 2008 -0400
+++ b/src/mono.sml	Sun Jul 13 12:56:39 2008 -0400
@@ -61,7 +61,7 @@
 
 datatype decl' =
          DVal of string * int * typ * exp * string
-       | DExport of int
+       | DExport of string * int
 
 withtype decl = decl' located
 
--- a/src/mono_print.sml	Sun Jul 13 12:51:58 2008 -0400
+++ b/src/mono_print.sml	Sun Jul 13 12:56:39 2008 -0400
@@ -166,9 +166,12 @@
                  p_exp env e]
         end
 
-      | DExport n => box [string "export",
-                          space,
-                          p_enamed env n]
+      | DExport (s, n) => box [string "export",
+                               space,
+                               p_enamed env n,
+                               space,
+                               string "as",
+                               string s]
                           
 fun p_file env file =
     let
--- a/src/monoize.sml	Sun Jul 13 12:51:58 2008 -0400
+++ b/src/monoize.sml	Sun Jul 13 12:56:39 2008 -0400
@@ -228,7 +228,12 @@
             L.DCon _ => NONE
           | L.DVal (x, n, t, e, s) => SOME (Env.pushENamed env x n t (SOME e) s,
                                             (L'.DVal (x, n, monoType env t, monoExp env e, s), loc))
-          | L.DExport n => SOME (env, (L'.DExport n, loc))
+          | L.DExport n =>
+            let
+                val (_, _, _, s) = Env.lookupENamed env n
+            in
+                SOME (env, (L'.DExport (s, n), loc))
+            end
     end
 
 fun monoize env ds =