I know there is dumpTree etc, but is there any way to actually print the AST as the Nim code it represents? For example, the tree:
StmtList
Command
Ident "echo"
StrLit "Hello, World!"
would print:
echo "Hello, World!"
repr :)
import macros
macro test: untyped =
result = nnkStmtList.newTree(
nnkCommand.newTree(
ident"echo", newLit("Hello, World!")
)
)
echo repr result
test()