I suspect there're programs that instead of emitting machine code instead emit C++ code and then start a mainstream C++ compiler to compile it to machine code.

I can't find any notable examples except MIDL which emits some rather primitive code.

What are notable examples of such systems?

  • 2
    Most new languages go through a phase of emitting C code (before they get their own backend). Mainly this is because C compilers are nearly ubiquitous across all platforms and quite efficient. Commented Sep 27, 2011 at 14:57

5 Answers 5


HipHop from Facebook transforms PHP code into C++.


The Eiffel compiler in EiffelStudio compiles to C (maybe with some C++ in it). One reason why it takes ages to compile even the simples Eiffel programs.

The Haskell compiler GHC used to target a C-like language C--. Today, it generates machine code directly. A backend targetting LLVM also exists.

  • AFAIK, GHC can still emit C - at least the -C option is still there...
    – tdammers
    Commented Sep 27, 2011 at 9:57

It's possible with MATLAB/Simulink (you can choose C or C++ but C is more often use at least if the target is embedded).

Another example is ArgoUML (open source UML modeling tool).


Automatic code generation is common among design tools. For instance, you specify your design with UML, Statecharts or both and code is generated. You only have to fill in placeholders for implementing methods.

Examples of such tools are Rhapsody and Topcased.


Another example: the Stan probabilistic programming language compiles to C++ which is then compiled.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.