Mercurial > urweb
diff src/compiler.sml @ 38:d16ef24de78b
Explify
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 19 Jun 2008 10:06:59 -0400 |
parents | 0ff8c2728634 |
children | 02f42e9a1825 |
line wrap: on
line diff
--- a/src/compiler.sml Tue Jun 17 17:14:21 2008 -0400 +++ b/src/compiler.sml Thu Jun 19 10:06:59 2008 -0400 @@ -67,7 +67,16 @@ SOME out end -fun corify eenv cenv filename = +fun explify eenv filename = + case elaborate eenv filename of + NONE => NONE + | SOME (file, _) => + if ErrorMsg.anyErrors () then + NONE + else + SOME (Explify.explify file) + +fun corify eenv filename = case elaborate eenv filename of NONE => NONE | SOME (file, _) => @@ -76,8 +85,8 @@ else SOME (Corify.corify file) -fun reduce eenv cenv filename = - case corify eenv cenv filename of +fun reduce eenv filename = + case corify eenv filename of NONE => NONE | SOME file => if ErrorMsg.anyErrors () then @@ -85,8 +94,8 @@ else SOME (Reduce.reduce (Shake.shake file)) -fun shake eenv cenv filename = - case reduce eenv cenv filename of +fun shake eenv filename = + case reduce eenv filename of NONE => NONE | SOME file => if ErrorMsg.anyErrors () then @@ -95,7 +104,7 @@ SOME (Shake.shake file) fun monoize eenv cenv filename = - case shake eenv cenv filename of + case shake eenv filename of NONE => NONE | SOME file => if ErrorMsg.anyErrors () then @@ -138,8 +147,17 @@ handle ElabEnv.UnboundNamed n => print ("Unbound named " ^ Int.toString n ^ "\n") +fun testExplify filename = + (case explify ElabEnv.basis filename of + NONE => print "Failed\n" + | SOME file => + (Print.print (ExplPrint.p_file ExplEnv.basis file); + print "\n")) + handle ExplEnv.UnboundNamed n => + print ("Unbound named " ^ Int.toString n ^ "\n") + fun testCorify filename = - (case corify ElabEnv.basis CoreEnv.basis filename of + (case corify ElabEnv.basis filename of NONE => print "Failed\n" | SOME file => (Print.print (CorePrint.p_file CoreEnv.basis file); @@ -148,7 +166,7 @@ print ("Unbound named " ^ Int.toString n ^ "\n") fun testReduce filename = - (case reduce ElabEnv.basis CoreEnv.basis filename of + (case reduce ElabEnv.basis filename of NONE => print "Failed\n" | SOME file => (Print.print (CorePrint.p_file CoreEnv.basis file); @@ -157,7 +175,7 @@ print ("Unbound named " ^ Int.toString n ^ "\n") fun testShake filename = - (case shake ElabEnv.basis CoreEnv.basis filename of + (case shake ElabEnv.basis filename of NONE => print "Failed\n" | SOME file => (Print.print (CorePrint.p_file CoreEnv.basis file);