summaryrefslogtreecommitdiff
path: root/src/main.mlton.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-08-16 10:54:46 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-08-16 10:54:46 -0400
commit3c28b7024034c5969525035f8b602272441dd323 (patch)
tree58f214872ae9ff1225f891a808c7c720ec501611 /src/main.mlton.sml
parent7bdc4cabdb8e5efbc4a194fe0bfe9442c7644798 (diff)
-timing option for command-line compiler
Diffstat (limited to 'src/main.mlton.sml')
-rw-r--r--src/main.mlton.sml24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/main.mlton.sml b/src/main.mlton.sml
index c24cc7c7..e6a973b2 100644
--- a/src/main.mlton.sml
+++ b/src/main.mlton.sml
@@ -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