Cross-platform idiomatic code generation

Some languages cross-compile. Things like Xtend and Shen generate source code, whereas things like Bigloo and Fantom target bytecode. For some reason I day dream about tools to translate a Nice Language into Regular Day Job Languages while somehow maintaining an idiomatic source-level code style in each of those.

Model driven design tools talk about it sometimes: Practical Model-to-Code Transformation in Four Object-Oriented Languages. Admittedly that's constraining things a bit since they are all OO, and not e.g. 1 OO, 1 FP, 1 Logic target.

This paper describes a practical framework that generates idiomatic code in four different object- oriented languages, Java, C++, Eiffel and C#, starting from an intermediate model expressed as an XML parse tree. Effort was directed towards ensuring that the generated systems executed with identical semantics.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I finally read this paper

It is interesting, but it is not about anything I recognize as modeling. The XML format used to generate Java, C#, C++, or Eiffel code is itself code: it has the same fine granularity as any other programming language. So what we have here is a programming language, not particularly easy to read or write, and a compiler for it with four back ends.