view python/c3/builder.py @ 175:a51b3c956386

Added function call in expressions
author Windel Bouwman
date Fri, 19 Apr 2013 22:15:54 +0200
parents 49f1ab80d040
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