comparison src/compiler.sml @ 193:8a70e2919e86

Specialization of single-parameter datatypes
author Adam Chlipala <adamc@hcoop.net>
date Fri, 08 Aug 2008 17:55:51 -0400
parents 88d46972de53
children f2cac0dba9bf
comparison
equal deleted inserted replaced
192:9bbf4d383381 193:8a70e2919e86
212 NONE => NONE 212 NONE => NONE
213 | SOME file => 213 | SOME file =>
214 if ErrorMsg.anyErrors () then 214 if ErrorMsg.anyErrors () then
215 NONE 215 NONE
216 else 216 else
217 SOME (Reduce.reduce (Shake.shake file)) 217 SOME (Reduce.reduce file)
218
219 fun specialize job =
220 case reduce job of
221 NONE => NONE
222 | SOME file =>
223 if ErrorMsg.anyErrors () then
224 NONE
225 else
226 SOME (Specialize.specialize file)
218 227
219 fun shake job = 228 fun shake job =
220 case reduce job of 229 case specialize job of
221 NONE => NONE 230 NONE => NONE
222 | SOME file => 231 | SOME file =>
223 if ErrorMsg.anyErrors () then 232 if ErrorMsg.anyErrors () then
224 NONE 233 NONE
225 else 234 else
330 (Print.print (CorePrint.p_file CoreEnv.empty file); 339 (Print.print (CorePrint.p_file CoreEnv.empty file);
331 print "\n")) 340 print "\n"))
332 handle CoreEnv.UnboundNamed n => 341 handle CoreEnv.UnboundNamed n =>
333 print ("Unbound named " ^ Int.toString n ^ "\n") 342 print ("Unbound named " ^ Int.toString n ^ "\n")
334 343
344 fun testReduce job =
345 (case reduce job of
346 NONE => print "Failed\n"
347 | SOME file =>
348 (Print.print (CorePrint.p_file CoreEnv.empty file);
349 print "\n"))
350 handle CoreEnv.UnboundNamed n =>
351 print ("Unbound named " ^ Int.toString n ^ "\n")
352
353 fun testSpecialize job =
354 (case specialize job of
355 NONE => print "Failed\n"
356 | SOME file =>
357 (Print.print (CorePrint.p_file CoreEnv.empty file);
358 print "\n"))
359 handle CoreEnv.UnboundNamed n =>
360 print ("Unbound named " ^ Int.toString n ^ "\n")
361
335 fun testTag job = 362 fun testTag job =
336 (case tag job of 363 (case tag job of
337 NONE => print "Failed\n"
338 | SOME file =>
339 (Print.print (CorePrint.p_file CoreEnv.empty file);
340 print "\n"))
341 handle CoreEnv.UnboundNamed n =>
342 print ("Unbound named " ^ Int.toString n ^ "\n")
343
344 fun testReduce job =
345 (case reduce job of
346 NONE => print "Failed\n" 364 NONE => print "Failed\n"
347 | SOME file => 365 | SOME file =>
348 (Print.print (CorePrint.p_file CoreEnv.empty file); 366 (Print.print (CorePrint.p_file CoreEnv.empty file);
349 print "\n")) 367 print "\n"))
350 handle CoreEnv.UnboundNamed n => 368 handle CoreEnv.UnboundNamed n =>