Using of parse tree externally

Robert Dewar dewar@gnat.com
Fri Oct 20 07:25:00 GMT 2000


<<The parser's syntax tree will also be interesting for cross referencing,
if you have a give AST node, in what parser rule was that node created from?
What where the tokens on the stack, or inherited that might be needed.
In the gcc -Dy  dumps, you have the entire source code of the program,
albeit run through the "Fleischwolf" or meatgrinder.
That might be of interest to the two-way reverse engineering tools ala
rose/together and co.,
you can then get then entire token/rule stream associated with a AST, and be
able to reconstruct the original source code from an give dump.
>>

Well most certainly the AST should contain source location information,
generally the AST is precisely a superset of the parser syntax tree.
Clearly for cross-referencing you need visibility analysis to be
performed when you have a block structured language like C, where 
you can have many instances of the same identifier in the same function.


More information about the Gcc mailing list