While examining aspell to figure out how to write my own spell checker in Java, I wondered how much work it would be to convert aspell to some dialect of C which is close enough to Java that it's possible to compile both a C and a Java version from the same source.
Of course, there is UML which promises that you can "model" your problem "once" and then "generate code for any language" but that a) usually doesn't include algorithms (only dependencies and relations) and b) the resulting code is ... well ... "obviously written by a computer" ahem
So I was wondering: Does anyone know or has anyone used a "meta language" which allows to be compiled in C++ and Java from the same code base? What did you use? Can you have a set of rules which allow to write a simple parser which can fix the final gap to make plain C++ the code compile with Java? Or would you go the other way around?
Definition "transpiler": A program which reads code in language A and converts it into code for language B. The difference between a compiler and a transpiler is that the compiler usually converts from a high to a low level language (C -> Assembler, Java -> Bytecode) while the transpiler converts between languages at (roughly) the same level. Examples: (C++ -> C, Pascal -> C). Think StarTrek(TM) translators.