There are no standards for storing AST, or, more importantly, from your point of view, exchanging them between tools. The reason is that ASTs are grammar dependent (which vary: C has a lot, depending on the particular compiler and version) and parsing technology.
There were many attempts to define universal forms of AST in several languages, but none of them worked; semantics of operators are changing a lot. (Consider only the “+”: what does this mean? In Fortran, you can add arrays, in Java, you can “add” strings).
However, specific ASTs can be easily recorded. A simple means is to use some kind of notation, in which the node is identified along with its recursive children, using some kind of enclosed "parentheses".
Lisp S expressions are a common way to do this. You can see an example of the S-expression style created by our tools .
People also used XML for this, but it is rather cumbersome. Here you can see the XML output example .
source share