Yes, the goal was the control flow of the program.

Yeah, looking more at what `PNode` tree contains, I see that it is really just 
syntax. (The `if` statement `PNode` contains things like `nkIdent` ":".) I need 
the _semantic [tree](https://forum.nim-lang.org/postActivity.xml#tree) of the 
code. Basically, like Lisp's braces. If I understand Nim right, NimNodes must 
be it. And, I bet, the `compiler` module does have some representation of the 
semantics somewhere inside.

I.e. `parseStmt` fits the goal exactly. But, as the original question answer 
from Araq says, it works only at compile time.

I'll check out npeg. [1](https://supakeen.com/weblog/npotw-npeg.html) 
[2](https://github.com/zevv/npeg?tab=readme-ov-file). From the first glance, it 
seems like another one of those ultra-formal syntax parsers that CS people make 
all the time in universities. I am looking for something way simpler, namely a 
runtime `parseStmt`. I am not trying to write a thesis on parsing regular 
expressions here. It is just a toy. I want to convert the code into some 
standard "GraphML"-like file, that can be understood by any popular software 
for graphs.

It would also be nice if this "runtime `parseStmt`" could optionally process 
the macros in the code and output the 
_[runtime](https://forum.nim-lang.org/postActivity.xml#runtime) semantic tree.

Reply via email to