This is my first post in this forum so I do apologize in advance if my question is not relevant, too trivial or has already been addressed.
I would like to develop a tool that would consume scala syntax-trees (as the title suggests). More specifically it would be great if I could consume the trees after each compilation phase.
My research led me to Dotty’s TASTY interchange format which seemed to be what I was looking for (i.e., a serialization format for the AST). Perhaps it is. However, I was not able to find adequate documentation on-line to figure out how to extract it and consume it.
I also looked at dotc compiler flags and couldn’t figure out an obvious approach. I noticed the option : “-print-tasty” but I couldn’t verify the expected output or perhaps I am missing something ?
Of course one can always print the ASTs after each phase using the scala printer (i.e., -Yshow-trees etc.). Is this my only option ? If it is, then fine.
Ideally, it would be great if I could consume the ASTs in a more structured format if you will (like JSON).
My strategy at the moment is to extend/modify/hack the AST printing classes of the Scala compiler to print out a more manageable version of the ASTs but before I do that I would like to make sure that there is no alternative.
I would really appreciate your help/feedback !!
Thank you in advance.