add a language to clang

Hi,

I’m willing to add a new language in clang.

I’d like to know what are the best practices before starting the actual implementation.

I’m already (kind of) familiar with clang/llvm, but I don’t want to waste an excessive amount of time in trying lousy options.

I synchronized clang on my local repository, and I read that http://llvm.org/docs/tutorial/LangImpl1.html.

I’d like to get feedbacks from people who actually did that kind of work, and know which are the pitfalls.

To make it short, these are my questions:

  • Branching strategy : what is the best way? Should I branch the whole llvm repository?

  • Code writing: Should I start writing code directly, targeting a small subset of the target language and iterate from that? Should I instead think a lot about my stuff and consider writing code once I’m sure I’ll be able to compile the entire language?

  • Commit : considering I’ve written a really good clang extension, and I want that to make it public. How can I merge to the trunk?

Many thanks,

Régis Portalez

What language/extension do you want to add?

Eli

As Eli says, this is dependent on what your language is - I have written my own Pascal compiler, and it is not part of clang, it uses NOTHING of clang in fact, just llvm. If your language isn’t very close to C, that would be my recommendation.

Hi, I’m thinking about adding a subset of typescript (http://www.typescriptlang.org/)

(excluding some javascript inherited features)

I would say that’s not similar enough to C to benefit from being part of the C compiler. You’re better off writing a standalone compiler.

That is of course just my assessment, and I’ve only written three languages, two interpreted and one compiler (using LLVM).