1
|
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)
|