Mercurial > lcfOS
comparison python/ppci/display.py @ 96:a350055d6119
movage
author | windel |
---|---|
date | Mon, 24 Dec 2012 13:30:12 +0100 |
parents | python/libs/compiler/display.py@32078200cdd6 |
children |
comparison
equal
deleted
inserted
replaced
95:4a37d6992bd3 | 96:a350055d6119 |
---|---|
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) |