I'd like to see the AST for a code file or procedure. I've seen references to renderTree, but I'm struggling to get a simple working example.
The following works for Python. How can I do something similar with Nim?
import ast
print ast.dump(ast.parse("for i in range(10): print i"),True,True)
import macros
dumpTree:
for i in 0..9:
echo i
This prints:
StmtList
ForStmt
Ident !"i"
Infix
Ident !".."
IntLit 0
IntLit 9
StmtList
Command
Ident !"echo"
Ident !"i"