Search code examples
code-generation

When generating code, what language should you generate?


I've worked on a number of products that make use of code generation. It seems to be the only way to achieve both a high degree of user-customizability and high execution speed.

The downside is that we are requiring users to install a compiler (primarily on MS Windows).

This has been an on-going headache, because vendors like MS keep obsoleting compilers, and some users tend to have more than one compiler installed.

We're considering using GNU C, and possibly C++, but even there, there are continual version issues.

I've considered possibly generating assembly language, in an effort to get off the compiler-version-treadmill, but assembly languages are all machine-specific.

Ideally there would be some way to produce generated code that would be flexible, run fast, and not expose us to the whims of third-party providers.

Maybe I'm overlooking something simple, like Java. Any ideas would be appreciated. Thanks.


Solution

  • If you're considering C and even assembler, take a look at LLVM first: http://llvm.org