changeset 208:63a2f2322c1f

-timing option for command-line compiler
author Adam Chlipala <adamc@hcoop.net>
date Sat, 16 Aug 2008 10:54:46 -0400 (2008-08-16)
parents cc68da3801bc
children 1487c712eb12
files src/explify.sml src/main.mlton.sml
diffstat 2 files changed, 27 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/explify.sml	Thu Aug 14 18:35:08 2008 -0400
+++ b/src/explify.sml	Sat Aug 16 10:54:46 2008 -0400
@@ -39,6 +39,7 @@
       | L.KRecord k => (L'.KRecord (explifyKind k), loc)
 
       | L.KUnit => (L'.KUnit, loc)
+      | L.KTuple _ => raise Fail "Explify KTuple"
 
       | L.KError => raise Fail ("explifyKind: KError at " ^ EM.spanToString loc)
       | L.KUnif (_, _, ref (SOME k)) => explifyKind k
@@ -67,6 +68,9 @@
 
       | L.CUnit => (L'.CUnit, loc)
 
+      | L.CTuple _ => raise Fail "Explify CTuple"
+      | L.CProj _ => raise Fail "Explify CProj"
+
       | L.CError => raise Fail ("explifyCon: CError at " ^ EM.spanToString loc)
       | L.CUnif (_, _, _, ref (SOME c)) => explifyCon c
       | L.CUnif _ => raise Fail ("explifyCon: CUnif at " ^ EM.spanToString loc)
--- a/src/main.mlton.sml	Thu Aug 14 18:35:08 2008 -0400
+++ b/src/main.mlton.sml	Sat Aug 16 10:54:46 2008 -0400
@@ -25,4 +25,26 @@
  * POSSIBILITY OF SUCH DAMAGE.
  *)
 
-val () = Compiler.compile (CommandLine.arguments ())
+fun doArgs (args, (timing, sources)) =
+    case args of
+        [] => (timing, rev sources)
+      | arg :: rest =>
+        let
+            val acc =
+                if size arg > 0 andalso String.sub (arg, 0) = #"-" then
+                    case arg of
+                        "-timing" => (true, sources)
+                      | _ => raise Fail ("Unknown option " ^ arg)
+                else
+                    (timing, arg :: sources)
+        in
+            doArgs (rest, acc)
+        end
+
+val (timing, sources) = doArgs (CommandLine.arguments (), (false, []))
+
+val () =
+    if timing then
+        Compiler.time Compiler.toCjrize sources
+    else
+        Compiler.compile sources