diff src/compiler.sml @ 1961:0652f295e0fa

New compiler option: -stop
author Adam Chlipala <adam@chlipala.net>
date Sun, 19 Jan 2014 13:08:01 -0500
parents ac1be85e91ad
children b15a4c2cb542
line wrap: on
line diff
--- a/src/compiler.sml	Sat Jan 18 08:34:19 2014 -0500
+++ b/src/compiler.sml	Sun Jan 19 13:08:01 2014 -0500
@@ -86,6 +86,9 @@
 
 val doDumpSource = ref (fn () => ())
 
+val stop = ref (NONE : string option)
+fun setStop s = stop := SOME s
+
 fun transform (ph : ('src, 'dst) phase) name = {
     func = fn input => let
                   val () = if !debug then
@@ -102,6 +105,10 @@
                       (!doDumpSource ();
                        doDumpSource := (fn () => ());
                        NONE)
+                  else if !stop = SOME name then
+                      (Print.eprint (#print ph v);
+                       ErrorMsg.error ("Stopped compilation after phase " ^ name);
+                       NONE)
                   else
                       (if !dumpSource then
                            doDumpSource := (fn () => Print.eprint (#print ph v))