Mercurial > lcfOS
view python/c3/builder.py @ 168:49f1ab80d040
Added awesome icons
author | Windel Bouwman |
---|---|
date | Fri, 22 Mar 2013 19:09:38 +0100 |
parents | 0b5b2ee6b435 |
children | 46d62dadd61b |
line wrap: on
line source
import ppci from . import Parser, Semantics, TypeChecker, Analyzer, CodeGenerator, AstPrinter class Builder: def __init__(self, diag): self.diag = diag self.p = Parser(diag) self.tc = TypeChecker(diag) self.al = Analyzer(diag) self.cg = CodeGenerator() self.ap = AstPrinter() def build(self, src): # Store src for later: self.src = src self.pkg = self.p.parseSource(src) self.al.analyzePackage(self.pkg) self.tc.checkPackage(self.pkg) ok = len(self.diag.diags) == 0 if ok: i = self.cg.gencode(self.pkg) return i