Mercurial > projects > dang
comparison dang/compiler.d @ 92:771ac63898e2 new_gen
A few better parser errors plus renaming most of the sema classes to match that they do now. Some have changes a lot.
author | Anders Johnsen <skabet@gmail.com> |
---|---|
date | Mon, 05 May 2008 18:44:20 +0200 |
parents | 1a24e61eb104 |
children | 48bb2287c035 |
comparison
equal
deleted
inserted
replaced
91:1a24e61eb104 | 92:771ac63898e2 |
---|---|
22 | 22 |
23 import gen.CodeGen; | 23 import gen.CodeGen; |
24 | 24 |
25 import sema.Visitor, | 25 import sema.Visitor, |
26 sema.AstAction, | 26 sema.AstAction, |
27 sema.SymbolTableBuilder, | 27 sema.ScopeBuilder, |
28 sema.ImplicitCast, | 28 sema.ScopeCheck, |
29 sema.Declarations; | 29 sema.TypeCheck; |
30 | 30 |
31 import Opt = dang.OptParse; | 31 import Opt = dang.OptParse; |
32 | 32 |
33 void checkFiles(char[][] *files) | 33 void checkFiles(char[][] *files) |
34 { | 34 { |
188 watch.start; | 188 watch.start; |
189 auto parser = new Parser(messages); | 189 auto parser = new Parser(messages); |
190 auto action = new AstAction(src_mgr); | 190 auto action = new AstAction(src_mgr); |
191 auto decls = cast(Decl[])parser.parse(src_mgr, lexer, action); | 191 auto decls = cast(Decl[])parser.parse(src_mgr, lexer, action); |
192 timings ~= Measurement("Lex + Parse", watch.stop); | 192 timings ~= Measurement("Lex + Parse", watch.stop); |
193 messages.checkErrors(); | 193 messages.checkErrors(ExitLevel.Parser); |
194 | 194 |
195 StopWatch watch2; | 195 StopWatch watch2; |
196 watch.start; | 196 watch.start; |
197 watch2.start; | 197 watch2.start; |
198 (new SymbolTableBuilder).visit(decls); | 198 (new ScopeBuilder).visit(decls); |
199 auto symbol_table = watch2.stop; | 199 auto scope_builder = watch2.stop; |
200 watch2.start; | 200 watch2.start; |
201 (new Declarations).visit(decls); | 201 (new ScopeCheck).visit(decls); |
202 auto declarations = watch2.stop; | 202 auto scope_check = watch2.stop; |
203 watch2.start; | 203 watch2.start; |
204 (new ImplicitCast).visit(decls); | 204 (new TypeCheck).visit(decls); |
205 auto implicit_casts = watch2.stop; | 205 auto type_check = watch2.stop; |
206 watch2.start; | 206 watch2.start; |
207 | 207 |
208 foreach (decl; decls) | 208 foreach (decl; decls) |
209 decl.simplify(); | 209 decl.simplify(); |
210 auto simplify = watch2.stop; | 210 auto simplify = watch2.stop; |
211 auto extra_stuff = watch.stop; | 211 auto extra_stuff = watch.stop; |
212 timings ~= Measurement("Extra stuff", watch.stop); | 212 timings ~= Measurement("Extra stuff", watch.stop); |
213 timings ~= Measurement(" - Building scopes", symbol_table); | 213 timings ~= Measurement(" - Building scopes", scope_builder); |
214 timings ~= Measurement(" - Extracting declarations", declarations); | 214 timings ~= Measurement(" - Checking scopes", scope_check); |
215 timings ~= Measurement(" - Making casts explicit", implicit_casts); | 215 timings ~= Measurement(" - Checking types", type_check); |
216 | 216 |
217 postParse(decls, src_mgr); | 217 postParse(decls, src_mgr); |
218 } | 218 } |
219 timings ~= Measurement("Total", total.stop); | 219 timings ~= Measurement("Total", total.stop); |
220 | 220 |