comparison src/compiler.sml @ 26:4ab19c19665f

Closure conversion
author Adam Chlipala <adamc@hcoop.net>
date Tue, 10 Jun 2008 15:56:33 -0400
parents 0a762c73824d
children 537db4ee89f4
comparison
equal deleted inserted replaced
25:0a762c73824d 26:4ab19c19665f
101 if ErrorMsg.anyErrors () then 101 if ErrorMsg.anyErrors () then
102 NONE 102 NONE
103 else 103 else
104 SOME (Monoize.monoize cenv file) 104 SOME (Monoize.monoize cenv file)
105 105
106 fun cloconv eenv cenv filename =
107 case monoize eenv cenv filename of
108 NONE => NONE
109 | SOME file =>
110 if ErrorMsg.anyErrors () then
111 NONE
112 else
113 SOME (Cloconv.cloconv file)
114
106 fun testParse filename = 115 fun testParse filename =
107 case parse filename of 116 case parse filename of
108 NONE => print "Failed\n" 117 NONE => print "Failed\n"
109 | SOME file => 118 | SOME file =>
110 (Print.print (SourcePrint.p_file file); 119 (Print.print (SourcePrint.p_file file);
153 (Print.print (MonoPrint.p_file MonoEnv.basis file); 162 (Print.print (MonoPrint.p_file MonoEnv.basis file);
154 print "\n")) 163 print "\n"))
155 handle MonoEnv.UnboundNamed n => 164 handle MonoEnv.UnboundNamed n =>
156 print ("Unbound named " ^ Int.toString n ^ "\n") 165 print ("Unbound named " ^ Int.toString n ^ "\n")
157 166
167 fun testCloconv filename =
168 (case cloconv ElabEnv.basis CoreEnv.basis filename of
169 NONE => print "Failed\n"
170 | SOME file =>
171 (Print.print (FlatPrint.p_file FlatEnv.basis file);
172 print "\n"))
173 handle FlatEnv.UnboundNamed n =>
174 print ("Unbound named " ^ Int.toString n ^ "\n")
175
158 end 176 end