Mercurial > urweb
comparison 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 |
comparison
equal
deleted
inserted
replaced
37:367f058aba23 | 38:d16ef24de78b |
---|---|
65 NONE | 65 NONE |
66 else | 66 else |
67 SOME out | 67 SOME out |
68 end | 68 end |
69 | 69 |
70 fun corify eenv cenv filename = | 70 fun explify eenv filename = |
71 case elaborate eenv filename of | 71 case elaborate eenv filename of |
72 NONE => NONE | 72 NONE => NONE |
73 | SOME (file, _) => | 73 | SOME (file, _) => |
74 if ErrorMsg.anyErrors () then | 74 if ErrorMsg.anyErrors () then |
75 NONE | 75 NONE |
76 else | 76 else |
77 SOME (Explify.explify file) | |
78 | |
79 fun corify eenv filename = | |
80 case elaborate eenv filename of | |
81 NONE => NONE | |
82 | SOME (file, _) => | |
83 if ErrorMsg.anyErrors () then | |
84 NONE | |
85 else | |
77 SOME (Corify.corify file) | 86 SOME (Corify.corify file) |
78 | 87 |
79 fun reduce eenv cenv filename = | 88 fun reduce eenv filename = |
80 case corify eenv cenv filename of | 89 case corify eenv filename of |
81 NONE => NONE | 90 NONE => NONE |
82 | SOME file => | 91 | SOME file => |
83 if ErrorMsg.anyErrors () then | 92 if ErrorMsg.anyErrors () then |
84 NONE | 93 NONE |
85 else | 94 else |
86 SOME (Reduce.reduce (Shake.shake file)) | 95 SOME (Reduce.reduce (Shake.shake file)) |
87 | 96 |
88 fun shake eenv cenv filename = | 97 fun shake eenv filename = |
89 case reduce eenv cenv filename of | 98 case reduce eenv filename of |
90 NONE => NONE | 99 NONE => NONE |
91 | SOME file => | 100 | SOME file => |
92 if ErrorMsg.anyErrors () then | 101 if ErrorMsg.anyErrors () then |
93 NONE | 102 NONE |
94 else | 103 else |
95 SOME (Shake.shake file) | 104 SOME (Shake.shake file) |
96 | 105 |
97 fun monoize eenv cenv filename = | 106 fun monoize eenv cenv filename = |
98 case shake eenv cenv filename of | 107 case shake eenv filename of |
99 NONE => NONE | 108 NONE => NONE |
100 | SOME file => | 109 | SOME file => |
101 if ErrorMsg.anyErrors () then | 110 if ErrorMsg.anyErrors () then |
102 NONE | 111 NONE |
103 else | 112 else |
136 Print.print (ElabPrint.p_file ElabEnv.basis file); | 145 Print.print (ElabPrint.p_file ElabEnv.basis file); |
137 print "\n")) | 146 print "\n")) |
138 handle ElabEnv.UnboundNamed n => | 147 handle ElabEnv.UnboundNamed n => |
139 print ("Unbound named " ^ Int.toString n ^ "\n") | 148 print ("Unbound named " ^ Int.toString n ^ "\n") |
140 | 149 |
150 fun testExplify filename = | |
151 (case explify ElabEnv.basis filename of | |
152 NONE => print "Failed\n" | |
153 | SOME file => | |
154 (Print.print (ExplPrint.p_file ExplEnv.basis file); | |
155 print "\n")) | |
156 handle ExplEnv.UnboundNamed n => | |
157 print ("Unbound named " ^ Int.toString n ^ "\n") | |
158 | |
141 fun testCorify filename = | 159 fun testCorify filename = |
142 (case corify ElabEnv.basis CoreEnv.basis filename of | 160 (case corify ElabEnv.basis filename of |
143 NONE => print "Failed\n" | 161 NONE => print "Failed\n" |
144 | SOME file => | 162 | SOME file => |
145 (Print.print (CorePrint.p_file CoreEnv.basis file); | 163 (Print.print (CorePrint.p_file CoreEnv.basis file); |
146 print "\n")) | 164 print "\n")) |
147 handle CoreEnv.UnboundNamed n => | 165 handle CoreEnv.UnboundNamed n => |
148 print ("Unbound named " ^ Int.toString n ^ "\n") | 166 print ("Unbound named " ^ Int.toString n ^ "\n") |
149 | 167 |
150 fun testReduce filename = | 168 fun testReduce filename = |
151 (case reduce ElabEnv.basis CoreEnv.basis filename of | 169 (case reduce ElabEnv.basis filename of |
152 NONE => print "Failed\n" | 170 NONE => print "Failed\n" |
153 | SOME file => | 171 | SOME file => |
154 (Print.print (CorePrint.p_file CoreEnv.basis file); | 172 (Print.print (CorePrint.p_file CoreEnv.basis file); |
155 print "\n")) | 173 print "\n")) |
156 handle CoreEnv.UnboundNamed n => | 174 handle CoreEnv.UnboundNamed n => |
157 print ("Unbound named " ^ Int.toString n ^ "\n") | 175 print ("Unbound named " ^ Int.toString n ^ "\n") |
158 | 176 |
159 fun testShake filename = | 177 fun testShake filename = |
160 (case shake ElabEnv.basis CoreEnv.basis filename of | 178 (case shake ElabEnv.basis filename of |
161 NONE => print "Failed\n" | 179 NONE => print "Failed\n" |
162 | SOME file => | 180 | SOME file => |
163 (Print.print (CorePrint.p_file CoreEnv.basis file); | 181 (Print.print (CorePrint.p_file CoreEnv.basis file); |
164 print "\n")) | 182 print "\n")) |
165 handle CoreEnv.UnboundNamed n => | 183 handle CoreEnv.UnboundNamed n => |