diff src/main.mlton.sml @ 1086:99aebdf30257

-tc flag
author Adam Chlipala <adamc@hcoop.net>
date Thu, 24 Dec 2009 10:02:48 -0500
parents 36efaf119b85
children bed675db3aff
line wrap: on
line diff
--- a/src/main.mlton.sml	Thu Dec 24 09:56:09 2009 -0500
+++ b/src/main.mlton.sml	Thu Dec 24 10:02:48 2009 -0500
@@ -26,6 +26,7 @@
  *)
 
 val timing = ref false
+val tc = ref false
 val sources = ref ([] : string list)
 val demo = ref (NONE : (string * bool) option)
 
@@ -53,6 +54,9 @@
       | "-timing" :: rest =>
         (timing := true;
          doArgs rest)
+      | "-tc" :: rest =>
+        (tc := true;
+         doArgs rest)
       | "-output" :: s :: rest =>
         (Settings.setExe (SOME s);
          doArgs rest)
@@ -78,7 +82,13 @@
         SOME (prefix, guided) =>
         Demo.make {prefix = prefix, dirname = job, guided = guided}
       | NONE =>
-        if !timing then
+        if !tc then
+            (Compiler.check Compiler.toElaborate job;
+             if ErrorMsg.anyErrors () then
+                 OS.Process.exit OS.Process.failure
+             else
+                 ())
+        else if !timing then
             Compiler.time Compiler.toCjrize job
         else
             Compiler.compiler job