Parse stan code

Hi, Is there a way to parse stan code and obtain the AST from it? I know that all the interfaces do that themselves. Can I just use the parser from them?

Sorry nobody replied sooner. I’ve been super bogged down here.

The AST is a C++ data structure—there’s not even a way to pretty print it. If you look at the C++ code in stan-dev/stan at path src/stan/lang/compiler.hpp you can see how it calls the parser to generate the AST and then the generator to turn that into C++. That shows you how to get the AST as a C++ structure for the entire program.