Take the 2-minute tour ×

are there any languages that generate and compile C++ code underhand? e.g. to simplify syntax for functional programming or metaprogramming etc.

share|improve this question
What do you mean by 'underhand'? –  sje397 Jan 31 '11 at 13:16
so such language compiler is just producing C++ code and compiles it –  Andy T Jan 31 '11 at 13:17
I'm sure there are, that's what the #line directive is all about. Various DSLs no doubt, nothing mainstream. –  Hans Passant Jan 31 '11 at 13:19
Somehow I doubt it happens often. C++ is a pain to understand and would generally not be the first target for code generation. –  John Smith Jan 31 '11 at 13:23

5 Answers 5

up vote 3 down vote accepted

Felix compiles from a ML-style function language into C++: http://felix-lang.org/

Also, haXe has a C++ backend: http://haxe.org/

share|improve this answer

SPECS does.

It’s essentially a different syntax for C++ that removes many of the pitfalls that are due to ambiguities in C++’ grammar.

share|improve this answer
I knew about it years ago, sounded very promising. But since then I've never heard anything more and thought the idea was dead. Is there an implementation? Is it being actively used? –  Fabio Ceconello Jan 31 '11 at 13:31

QT framework generates C++ code. Refer to QT metaobject compiler for details

share|improve this answer

Facebook's HipHop translates PHP into C++.

share|improve this answer

Rational Rose is an application that is used for UML modelling; after designing your model you can generate the corresponding C++ code.

share|improve this answer

Your Answer


