User:Realazthat/Projects wishlist/HLML

From Rosetta Code
Revision as of 01:29, 14 October 2010 by rosettacode>Realazthat
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

See JavaML for suggested implementation.

Write a language, or use an existing language that allows for high level transformations among along the common (OO) language family. There exists a subset of each of these languages that is common among all of them, in that it is possible to express one in another; ie. to translate from one to another one-to-one.

This project is about the language and its structure, not about the runtime libraries.


  • Model object interfaces, and their implementation as a series of access to other interfaces (in addition to some primitives)
  • Meant for generic algorithms that are platform independent


  • Won't arbitrarily convert one language to another
    • Won't guarantee functional equivalence.

Things to consider

  • Python's integers overflow into arbitrary precision integers etc.
  • Operator overloading not supported in some languages; function name manglanging will result
  • Syntactic sugar will probably probably produce lots of mangled output; eg. anonymous classes, anonymous functions etc.
  • Generics/templates?


  • Comments get transformed as well
  • Mainly for functions not interacting with a runtime much
  • Small common runtime API (for strings and other primitives)


These are languages that I have experience in, and I believe I can translate a large subset of the language structure from one to the other. In particular, I believe I can translate from the higher level languages here to all the others.

High level languages:

  • Java
  • Python
  • JavaScript
  • PHP
  • Haxe
  • AS3

Low level languages:

  • C++
  • ...


High Level Markup Language

HLML => XSL => XML => XSL => {Output language}
  1. Starting with High Level Markup Language, an XML format mirroring this language,
  2. An XSLT converts it to the target language XML markup equivalent,
  3. Which gets transformed to the output language

If there is no suitable markup equivalent for the target language:

HLML => XSL => {Output language}

A suggestion of an existing language to use would be Java, as someone already designed an XML equivalent, called JavaML which could serve as our HLML. Note: I have already successfully (to some extent) used JavaML and XSLT to convert Java to C++.

Note: To extend this to other input languages, change the methodology as follows (prepend to the current methodology):

{Language EBNF} => XML => XSL => HLML => XSL => XML => XSL => {Output language}


Further Research