Mercurial > lcfOS
view python/c3/builder.py @ 202:f22b431f4113
Added arm add instruction
author | Windel Bouwman |
---|---|
date | Sat, 15 Jun 2013 10:02:50 +0200 |
parents | b01429a5d695 |
children | 8b2f20aae086 |
line wrap: on
line source
import ppci from . import Parser, Semantics, TypeChecker, Analyzer, CodeGenerator, AstPrinter class Builder: """ Generates IR-code from c3 source. Reports errors to the diagnostics system """ def __init__(self, diag): self.diag = diag self.parser = Parser(diag) self.tc = TypeChecker(diag) self.al = Analyzer(diag) self.cg = CodeGenerator() self.ap = AstPrinter() def build(self, src): """ Create IR-code from sources """ pkg = self.parser.parseSource(src) if not pkg: return if not self.al.analyzePackage(pkg): return if not self.tc.checkPackage(pkg): return # Only return ircode when everything is OK ircode = self.cg.gencode(pkg) return ircode