[cfe-dev] create source 2 source compiler with clang libraries

John McCall rjmccall at apple.com
Sat Aug 28 01:42:21 PDT 2010


On Aug 28, 2010, at 1:27 AM, Chi wrote:
> Quoting John McCall <rjmccall at apple.com>:
>> On Aug 27, 2010, at 7:04 AM, Chi wrote:
>>> I would like to (initially) create a src-to-src compiler to compile some language extension I thought up for parallel programming. What I had in mind was to have to extend the C grammar, and have a compiler produce legal C (gnu/c99) out of it again. So I wanted to ask if Clang could help me do this in a intuitive/easy way?
>> 
>> Yes, definitely.
>> 
>> I should say that if you're hoping to make a source-to-object compiler in the end, you may find that it's not that much more complicated to start out with one.  People often underestimate the complexity of writing source-to-source compilers that do any sort of interesting transformation, and it's quite easy to run into the limits of the approach.  Of course, this only works if your target architecture has an LLVM backend.  That said, you can use a Clang-based parser with either approach.
> 
> Thanks John,
> 
> A source-to-object compiler would be indeed nicer, but I might run into some portability problems as we might want to use it on a Microblaze platform or Tilera. I see you have experimental support for Microblaze, is there any development in the direction of the Tilera?

Not that I know of.  That's indeed a pretty strong objection to using a source-to-object compiler;  I guess you don't have much choice but to deal with the source-to-source issues.

Good luck!

John.



More information about the cfe-dev mailing list