Mercurial > urweb
comparison 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 |
comparison
equal
deleted
inserted
replaced
1960:93f3e35a7967 | 1961:0652f295e0fa |
---|---|
84 val dumpSource = ref false | 84 val dumpSource = ref false |
85 val doIflow = ref false | 85 val doIflow = ref false |
86 | 86 |
87 val doDumpSource = ref (fn () => ()) | 87 val doDumpSource = ref (fn () => ()) |
88 | 88 |
89 val stop = ref (NONE : string option) | |
90 fun setStop s = stop := SOME s | |
91 | |
89 fun transform (ph : ('src, 'dst) phase) name = { | 92 fun transform (ph : ('src, 'dst) phase) name = { |
90 func = fn input => let | 93 func = fn input => let |
91 val () = if !debug then | 94 val () = if !debug then |
92 print ("Starting " ^ name ^ "....\n") | 95 print ("Starting " ^ name ^ "....\n") |
93 else | 96 else |
99 else | 102 else |
100 (); | 103 (); |
101 if ErrorMsg.anyErrors () then | 104 if ErrorMsg.anyErrors () then |
102 (!doDumpSource (); | 105 (!doDumpSource (); |
103 doDumpSource := (fn () => ()); | 106 doDumpSource := (fn () => ()); |
107 NONE) | |
108 else if !stop = SOME name then | |
109 (Print.eprint (#print ph v); | |
110 ErrorMsg.error ("Stopped compilation after phase " ^ name); | |
104 NONE) | 111 NONE) |
105 else | 112 else |
106 (if !dumpSource then | 113 (if !dumpSource then |
107 doDumpSource := (fn () => Print.eprint (#print ph v)) | 114 doDumpSource := (fn () => Print.eprint (#print ph v)) |
108 else | 115 else |