summaryrefslogtreecommitdiff
path: root/src/compiler.sml
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler.sml')
-rw-r--r--src/compiler.sml30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/compiler.sml b/src/compiler.sml
index 26ff6e2b..4276ed46 100644
--- a/src/compiler.sml
+++ b/src/compiler.sml
@@ -112,6 +112,15 @@ fun cloconv eenv cenv filename =
else
SOME (Cloconv.cloconv file)
+fun cjrize eenv cenv filename =
+ case cloconv eenv cenv filename of
+ NONE => NONE
+ | SOME file =>
+ if ErrorMsg.anyErrors () then
+ NONE
+ else
+ SOME (Cjrize.cjrize file)
+
fun testParse filename =
case parse filename of
NONE => print "Failed\n"
@@ -173,4 +182,25 @@ fun testCloconv filename =
handle FlatEnv.UnboundNamed n =>
print ("Unbound named " ^ Int.toString n ^ "\n")
+fun testCjrize filename =
+ (case cjrize ElabEnv.basis CoreEnv.basis filename of
+ NONE => print "Failed\n"
+ | SOME file =>
+ (Print.print (CjrPrint.p_file CjrEnv.basis file);
+ print "\n"))
+ handle CjrEnv.UnboundNamed n =>
+ print ("Unbound named " ^ Int.toString n ^ "\n")
+
+fun compile filename =
+ case cjrize ElabEnv.basis CoreEnv.basis filename of
+ NONE => ()
+ | SOME file =>
+ let
+ val outf = TextIO.openOut "/tmp/lacweb.c"
+ val s = TextIOPP.openOut {dst = outf, wid = 80}
+ in
+ Print.fprint s (CjrPrint.p_file CjrEnv.basis file);
+ TextIO.closeOut outf
+ end
+
end