comparison python/c3/builder.py @ 289:bd2593de3ff8

Semifix burn2
author Windel Bouwman
date Thu, 21 Nov 2013 15:46:50 +0100
parents a747a45dcd78
children 6aa721e7b10b
comparison
equal deleted inserted replaced
288:a747a45dcd78 289:bd2593de3ff8
1 import logging 1 import logging
2 import ppci 2 import ppci
3 from . import Parser, TypeChecker, Analyzer, CodeGenerator 3 from . import Parser, TypeChecker, Analyzer, CodeGenerator
4 from .analyse import AddScope
4 5
5 6
6 class Builder: 7 class Builder:
7 """ 8 """
8 Generates IR-code from c3 source. 9 Generates IR-code from c3 source.
34 if not pkg: 35 if not pkg:
35 self.ok = False 36 self.ok = False
36 continue 37 continue
37 # Store for later use: 38 # Store for later use:
38 packages[pkg.name] = pkg 39 packages[pkg.name] = pkg
40 # Fix scopes:
39 for pkg in packages.values(): 41 for pkg in packages.values():
40 # TODO: merge the two below? 42 if not AddScope(self.diag).addScope(pkg):
43 self.ok = False
44 # TODO: fix error handling better
45 for pkg in packages.values():
41 if not self.al.analyzePackage(pkg, packages): 46 if not self.al.analyzePackage(pkg, packages):
42 self.ok = False 47 self.ok = False
43 continue 48 continue
49 for pkg in packages.values():
44 if not self.tc.checkPackage(pkg): 50 if not self.tc.checkPackage(pkg):
45 self.ok = False 51 self.ok = False
46 continue 52 continue
47 for pkg in s_pkgs: 53 for pkg in s_pkgs:
48 yield pkg 54 yield pkg