minimal clang for AST use

Hey All,

I am working to build a minimal clang that doesn't include any llvm
code generation abilities. This is intended to analyze a source code
base and produce various code generation files based on the clang AST.

I modified various files and such to remove most of llvm (except
LLVMSupport) from the mix; if anyone is interested I could tell you
exactly what I did.

One thing that would be neat would be if someone were to build an
application to enable quick creation of code generators. If we could
map the AST to a more useable scripting system and thus quickly write
an action that processed the AST from one or multiple files combined.
The key would be to map the AST to some generic and easily scriptable
object model (or map a scripting system to the AST directly).

Then another thing about this is that the system automatically clears
the AST and preprocessor when processing files on the command line. I
work around this by creating a header that includes everything I want
and then only specifying this header on the command line.

Anyway, just some thoughts. It looks like I will be spending time
code generating some more things and a little more slick framework for
this use case would be sweet.

Chris

Chris, I'm interested in the instructions for minimizing clang for this
use...

Does it happen to include whitespace in the serialization? One thing I
would definitely like is to be able to pipe the serialized output into code
generator that would spit out the exact file that you ran clang on.

Regards,

-Ryan

Hi,

I am working to build a minimal clang that doesn't include any llvm
code generation abilities. This is intended to analyze a source code
base and produce various code generation files based on the clang AST.

I modified various files and such to remove most of llvm (except
LLVMSupport) from the mix; if anyone is interested I could tell you
exactly what I did.

I'd be interested too. My application only transformes the AST and rewrite it.

> One thing that would be neat would be if someone were to build an
> application to enable quick creation of code generators. If we could
> map the AST to a more useable scripting system and thus quickly write
> an action that processed the AST from one or multiple files combined.
> The key would be to map the AST to some generic and easily scriptable
> object model (or map a scripting system to the AST directly).

Regarding the scripting model you might want to check out some papers (e.g. http://www.springerlink.com/content/v2114255v58xt260/).
Currently I implement my transformations in C++ but I have already thought about some more declarative AST transformation rules too. Anything in that direction would be very interesting.

Best regards
Olaf Krzikalla