16 lines
341 B
Python
16 lines
341 B
Python
|
|
from parser.nodes import *
|
|
|
|
class Compiler(object):
|
|
def __init__(self, ast):
|
|
self.ast = ast
|
|
|
|
def compile(self, out):
|
|
self.ast.visit(self.first_pass, out)
|
|
return True
|
|
|
|
def first_pass(self, node, out):
|
|
if isinstance(node, CExprNode):
|
|
out.write(node.cstring)
|
|
out.write('\n')
|