User:Realazthat/Projects wishlist/HLML
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.
Goals
- 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
NoGoals
- 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?
Features
- Comments get transformed as well
- Mainly for functions not interacting with a runtime much
- Small common runtime API (for strings and other primitives)
Languages
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++
- LLVM IR
- ...
Methodology
High Level Markup Language
HLML => XSL => XML => XSL => {Output language}
- Starting with High Level Markup Language, an XML format mirroring this language,
- An XSLT converts it to the target language XML markup equivalent,
- 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}
Related
- wp:ROSE_compiler_framework
- wp:DMS_Software_Reengineering_Toolkit
- wp:Source_code_generation
- http://www.program-transformation.org/
- http://rosettacode.org/wiki/Main_Page
- A wiki that archives algorithms in as many languages as possible; this superset language would be able to generate the code for entire website with one page of code for each algorithm, providing interfaces for the runtimes are somehow factored in, or ignored
- Unified Modeling Language in general
- List of Unified Modeling Language tools
- wp:ArgoUML in particular; it has BSD license, generates C++, C#, Java, PHP4, PHP5, Ruby, Ada, Delphi and SQL, reverses Java
- C'Dent
- Seems to do exactly the goals of this project
- Output Languages
- Perl
- Python
- PHP
- Ruby
- JavaScript
- Scala
- Java
- ActionScript
- Python 3
- Perl 6
- Go
- PIR
- C'Dent
- See also: http://www.acmeism.org/, community based on my generic-crazy premise
Further Research
- http://www.esolangs.org/wiki/List_of_ideas, http://www.esolangs.org/wiki/Works_in_progress
- List of fascinating programming language ideas