Mercurial > lcfOS
view python/c3/builder.py @ 201:d5debbfc0200
Added all 27 core instructions of msp430
author | Windel Bouwman |
---|---|
date | Thu, 13 Jun 2013 00:07:28 +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