[cfe-dev] about AST of clang

Douglas Gregor dgregor at apple.com
Fri Apr 20 12:57:07 PDT 2012


On Apr 13, 2012, at 2:42 AM, Zhe Chen <mr.zhechen at gmail.com> wrote:

> Hi Clang list,
> 
> I noticed there is an AST file format used for higher-level
> representations of C codes under Clang.
> 
> What I want to do is make the parse trees of C programs, and then the
> trees can be edited, e.g., insert new node, modify existing nodes,
> etc. Finally, I want to compile these modified trees into executables.
> 
> Is it possible?  Moreso, is it practical?  I'd like to know where can
> I find such examples or supporting features from clang.

The Clang AST is not designed to be edited. It can be done, but ensuring that the resulting AST is well-formed is a non-trivial task. 

	- Doug



More information about the cfe-dev mailing list