Hi,
I created a tool for debugging the compiler. You can log any function. It actually modifies your function, before each line it checks the local variables, prints them (if they were newly introduced or modified), and also prints the lines in the code, and the stack, if it was modified.
The tool is not documented. If there is interest, then I can spend more time with it. I know that it is not perfect.
very good job indeed, we need more tools like this to speed up development not only for nim compiler, any other projects could also benefits.
I will try it soon.
I imagine tools like this can be extended to generate/mapping function calls into program flow(visual flowchart, mindmap, callgraph or something like that) -- that can be very useful to analyze a piece of code from many different angles.
I remember this cool trace visualizer that got popular a couple of years ago: https://www.youtube.com/watch?v=4vtKRE9an_I
It was a commercial effort and the author abandoned it in the end I think, but the code was published here: https://github.com/traceglMPL/tracegl
Perhaps you can take this even further and experiment with full-program tracing and integration with such a visualizer.
Currently I'm missing destructors, without them I can't write a valid XML (it is hard to close the last tag without knowing when your program will end). XMLs are great, because you can close and open the tree nodes in the browser.
By the way, I spent most of my time digging info from types in the compiler, what's why this tool was useful.