transform C code to C# code

Hi,

For my project, I have to implement a source-to-source transformation from C to C#.
I am only looking at a subset of C (including pointers, function calls, etc) as my input.
Is the clang front-end a good starting point for my problem ?

I have some experience with implementing LLVM optimizations. Is there some clang analogue
to http://llvm.org/docs/WritingAnLLVMPass.html where I can get a step-by-step guide of
how to implement a clang pass ?

Thanks
Pranav

Hi,

For my project, I have to implement a source-to-source transformation
from C to C#.
I am only looking at a subset of C (including pointers, function calls,
etc) as my input.
Is the clang front-end a good starting point for my problem ?

Yes. Clang fully supports the C language.

I have some experience with implementing LLVM optimizations. Is there
some clang analogue
to http://llvm.org/docs/WritingAnLLVMPass.html where I can get a
step-by-step guide of
how to implement a clang pass ?

No, but Clang has something else that may be exactly what you're looking
for: the Rewriter class. You can use it to rewrite source in place. Take
a look at RewriteObjc.cpp in lib/Rewrite: it's an excellent example of
how to use the Rewriter. It turns Objective-C code into regular old C
(actually, C++) code.

There's no how-to for this, but since so many people have asked this
before, someone should probably write one.

Chip