Mercurial > urweb
comparison src/compiler.sml @ 25:0a762c73824d
Monoize
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Tue, 10 Jun 2008 13:14:45 -0400 |
parents | ea15905e598d |
children | 4ab19c19665f |
comparison
equal
deleted
inserted
replaced
24:ea15905e598d | 25:0a762c73824d |
---|---|
68 end | 68 end |
69 | 69 |
70 fun corify eenv cenv filename = | 70 fun corify eenv cenv filename = |
71 case elaborate eenv filename of | 71 case elaborate eenv filename of |
72 NONE => NONE | 72 NONE => NONE |
73 | SOME (_, file) => SOME (Corify.corify file) | 73 | SOME (_, file) => |
74 if ErrorMsg.anyErrors () then | |
75 NONE | |
76 else | |
77 SOME (Corify.corify file) | |
74 | 78 |
75 fun reduce eenv cenv filename = | 79 fun reduce eenv cenv filename = |
76 case corify eenv cenv filename of | 80 case corify eenv cenv filename of |
77 NONE => NONE | 81 NONE => NONE |
78 | SOME file => SOME (Reduce.reduce (Shake.shake file)) | 82 | SOME file => |
83 if ErrorMsg.anyErrors () then | |
84 NONE | |
85 else | |
86 SOME (Reduce.reduce (Shake.shake file)) | |
79 | 87 |
80 fun shake eenv cenv filename = | 88 fun shake eenv cenv filename = |
81 case reduce eenv cenv filename of | 89 case reduce eenv cenv filename of |
82 NONE => NONE | 90 NONE => NONE |
83 | SOME file => SOME (Shake.shake file) | 91 | SOME file => |
92 if ErrorMsg.anyErrors () then | |
93 NONE | |
94 else | |
95 SOME (Shake.shake file) | |
96 | |
97 fun monoize eenv cenv filename = | |
98 case shake eenv cenv filename of | |
99 NONE => NONE | |
100 | SOME file => | |
101 if ErrorMsg.anyErrors () then | |
102 NONE | |
103 else | |
104 SOME (Monoize.monoize cenv file) | |
84 | 105 |
85 fun testParse filename = | 106 fun testParse filename = |
86 case parse filename of | 107 case parse filename of |
87 NONE => print "Failed\n" | 108 NONE => print "Failed\n" |
88 | SOME file => | 109 | SOME file => |
123 (Print.print (CorePrint.p_file CoreEnv.basis file); | 144 (Print.print (CorePrint.p_file CoreEnv.basis file); |
124 print "\n")) | 145 print "\n")) |
125 handle CoreEnv.UnboundNamed n => | 146 handle CoreEnv.UnboundNamed n => |
126 print ("Unbound named " ^ Int.toString n ^ "\n") | 147 print ("Unbound named " ^ Int.toString n ^ "\n") |
127 | 148 |
149 fun testMonoize filename = | |
150 (case monoize ElabEnv.basis CoreEnv.basis filename of | |
151 NONE => print "Failed\n" | |
152 | SOME file => | |
153 (Print.print (MonoPrint.p_file MonoEnv.basis file); | |
154 print "\n")) | |
155 handle MonoEnv.UnboundNamed n => | |
156 print ("Unbound named " ^ Int.toString n ^ "\n") | |
157 | |
128 end | 158 end |