Using clang to translate a program in c++ to C or other languages

Hi,

I would like to know the possible approaches to translate a program in C++ to another language such as C using Clang. Should I walk in the AST and emit the code or should I create a new AST in the other language for example?.

Thanks in advanced,

Miguel

Hi,

I would like to know the possible approaches to translate a program in C++
to another language such as C using Clang. Should I walk in the AST and
emit the code or should I create a new AST in the other language for
example?.

The general advice I've seen given most often on this list is to walk the
AST and emit the code.

Cheers,
/Manuel

+cfe-dev

Manuel,

Is there any class of clang to be used in order to prepare and emit the code, such as the Rewriter class or this one does not apply in this case?

Thanks,

Miguel

Isn't this already available in Clang? Or was that Objective-C to C?

Hi,

The one I saw is Objective-C to C but I have not seen any example related to C++.

Miguel

Hi,

The one I saw is Objective-C to C but I have not seen any example related to C++.

It is objective-C to C++ translator. But it only translates objective-C specific ASTs and bypasses
the C ASTs.

- Fariborz