Mercurial > urweb
comparison src/main.mlton.sml @ 208:63a2f2322c1f
-timing option for command-line compiler
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sat, 16 Aug 2008 10:54:46 -0400 |
parents | 8921f0344193 |
children | 8bb46d87b074 |
comparison
equal
deleted
inserted
replaced
207:cc68da3801bc | 208:63a2f2322c1f |
---|---|
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
25 * POSSIBILITY OF SUCH DAMAGE. | 25 * POSSIBILITY OF SUCH DAMAGE. |
26 *) | 26 *) |
27 | 27 |
28 val () = Compiler.compile (CommandLine.arguments ()) | 28 fun doArgs (args, (timing, sources)) = |
29 case args of | |
30 [] => (timing, rev sources) | |
31 | arg :: rest => | |
32 let | |
33 val acc = | |
34 if size arg > 0 andalso String.sub (arg, 0) = #"-" then | |
35 case arg of | |
36 "-timing" => (true, sources) | |
37 | _ => raise Fail ("Unknown option " ^ arg) | |
38 else | |
39 (timing, arg :: sources) | |
40 in | |
41 doArgs (rest, acc) | |
42 end | |
43 | |
44 val (timing, sources) = doArgs (CommandLine.arguments (), (false, [])) | |
45 | |
46 val () = | |
47 if timing then | |
48 Compiler.time Compiler.toCjrize sources | |
49 else | |
50 Compiler.compile sources |