diff applications/ide/compiler/display.py @ 39:600f48b74799

Move ide
author windel
date Fri, 03 Feb 2012 18:40:43 +0100
parents ide/compiler/display.py@92df07bc2081
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/applications/ide/compiler/display.py	Fri Feb 03 18:40:43 2012 +0100
@@ -0,0 +1,21 @@
+from .nodes import *
+
+def printNode(node, indent=0):
+     """
+      Print visitor
+        all printing goes in here
+     """
+     print(' '*indent+str(node))
+     if type(node) is Procedure:
+       print(' '*indent+'  PARAMETERS:')
+       for p in node.parameters:
+         printNode(p, indent+4)
+       if node.block:
+         print(' '*indent+'  CODE:')
+         printNode(node.block, indent+4)
+     elif type(node) is Module:
+       print(node.symtable)
+       printNode(node.initcode, indent+2)
+     else:
+       for c in node.getChildren():
+         printNode(c, indent+2)