1

CoffeeScript gets converted to JavaScript, Groovy to Java.

Is there a language that was designed to allow its functions to be converted into multiple languages?

One could write string manipulation or HTML snippet generation that could be used as a library, but if a similar requirement is found in another language, the functions of that library would need to be translated.

Is there such a language that includes two or more translation targets already?

I am mostly interested in Java, JavaScript, Perl.

I would be interested in C/C++, but only if there were safeguards to prevent buffer overflow vulnerabilities from being created.

700 Software
  • 85,281
  • 83
  • 234
  • 341
  • Not an answer, but something that I find interesing - PLiX (Programming language in XML), that can be used to generate Visual Basic, C# and PHP, and that has an open architecture for creating generators for other languages: http://sourceforge.net/projects/plix/ – Anders Marzi Tornblad Feb 22 '12 at 18:16

3 Answers3

4

What about Haxe? C++, Flash, JavaScript, and more.

Santiago V.
  • 1,088
  • 8
  • 24
  • Haxe is one of many languages that can be translated into others using a [source-to-source compiler](https://en.wikipedia.org/wiki/Source-to-source_compiler). – Anderson Green Jul 05 '16 at 04:10
0

UML - Unified Modeling Language, has several tools that can translate into C++, Java, and others. That's not really a "language" like C or Java, however. It's all diagrams.

I don't know much about other languages, but the Java bytecode, when the compiled with the right flags in javac, contains debugging information like line numbers, variable names, and (I think) comments. Unobfuscated Java bytecode can be decompiled into pretty readable source code.

Mutant Platypus
  • 145
  • 1
  • 8
0

I think what you're looking for is LLVM. Also, this similar question may be relevant.

Community
  • 1
  • 1
Mutant Platypus
  • 145
  • 1
  • 8
  • It would be helpful if you would elaborate. It is not clear from the home page that this allows you to write in one language and have finished code for two or more. It lists 11 projects under LLVM. – 700 Software Feb 23 '12 at 13:22