comparison ide/compiler/display.py @ 1:92df07bc2081

Initial import of compiler
author windel
date Sun, 18 Sep 2011 19:00:29 +0200
parents
children
comparison
equal deleted inserted replaced
0:1a4faf9ef1ea 1:92df07bc2081
1 from .nodes import *
2
3 def printNode(node, indent=0):
4 """
5 Print visitor
6 all printing goes in here
7 """
8 print(' '*indent+str(node))
9 if type(node) is Procedure:
10 print(' '*indent+' PARAMETERS:')
11 for p in node.parameters:
12 printNode(p, indent+4)
13 if node.block:
14 print(' '*indent+' CODE:')
15 printNode(node.block, indent+4)
16 elif type(node) is Module:
17 print(node.symtable)
18 printNode(node.initcode, indent+2)
19 else:
20 for c in node.getChildren():
21 printNode(c, indent+2)