summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-07-13 12:56:39 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-07-13 12:56:39 -0400
commit3c2cf28f8c508355be291a3ce2ecc9bb571f97dd (patch)
tree080575b2de86cc12064fbcb794b8341d5de9313a /src
parent46c36cb682c91bbfad52b35c68d8332757c2bbce (diff)
Cjr ready for dispatch code generation
Diffstat (limited to 'src')
-rw-r--r--src/cjr.sml2
-rw-r--r--src/cjr_print.sml8
-rw-r--r--src/mono.sml2
-rw-r--r--src/mono_print.sml9
-rw-r--r--src/monoize.sml7
5 files changed, 20 insertions, 8 deletions
diff --git a/src/cjr.sml b/src/cjr.sml
index a47c77fe..1aacfb60 100644
--- a/src/cjr.sml
+++ b/src/cjr.sml
@@ -61,6 +61,6 @@ datatype decl' =
withtype decl = decl' located
-type file = decl list * int list
+type file = decl list * (string * int) list
end
diff --git a/src/cjr_print.sml b/src/cjr_print.sml
index 32c43d23..f3beb023 100644
--- a/src/cjr_print.sml
+++ b/src/cjr_print.sml
@@ -173,8 +173,12 @@ fun p_decl env ((d, _) : decl) =
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
diff --git a/src/mono.sml b/src/mono.sml
index 4092891e..861b4db0 100644
--- a/src/mono.sml
+++ b/src/mono.sml
@@ -61,7 +61,7 @@ withtype exp = exp' located
datatype decl' =
DVal of string * int * typ * exp * string
- | DExport of int
+ | DExport of string * int
withtype decl = decl' located
diff --git a/src/mono_print.sml b/src/mono_print.sml
index 07065b3a..c3738c59 100644
--- a/src/mono_print.sml
+++ b/src/mono_print.sml
@@ -166,9 +166,12 @@ fun p_decl env ((d, _) : decl) =
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
diff --git a/src/monoize.sml b/src/monoize.sml
index 266a031a..f58e56ea 100644
--- a/src/monoize.sml
+++ b/src/monoize.sml
@@ -228,7 +228,12 @@ fun monoDecl env (all as (d, loc)) =
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 =