[cfe-dev] How to use Clang to translate from C++ to another language

Jean-Daniel Dupas devlists at shadowlab.org
Wed Mar 28 02:12:51 PDT 2012


Le 28 mars 2012 à 04:37, Tim Stowell a écrit :

> I've recently compiled Clang and LLVM on Windows. My goal is to use it to translate from C++ to another language (specifically Actionscript), but I'm not sure the best way to go about this. For example, if I invoke clang with the -ast-print "pretty print" option, it looks like Clang can get a faithful representation of the original code from its internal AST. Do I need to somehow mimic that code so I get a pretty print in my new language? Or should I walk the AST tree? Thanks for any help!

Have a look at the ObjC Rewriter (in lib/Rewrite), it convert Obj-C to C, so this is close to what you're looking for.


-- Jean-Daniel








More information about the cfe-dev mailing list