Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Hmm, your definition of transpiler does not differ of the one of a '<a href="http://en.wikipedia.org/wiki/Compiler" rel="nofollow noreferrer">compiler</a>' ;-) "translating from language A to language B".</p> <p>Basically, high level languages differ because you program to a different 'machine model' abstraction. For example Java is slightly higher level due to it's virtual machine model which is more 'virtual' (managed code...). They encourage <em>different</em> programming styles and have different purposes.</p> <p>Of course you can add a librarie to C++ for garbage collection and other things and then translate Java to that, but then you do not really have idiomatic C++. What GCC (and GCJ) does, is translating Java+libgcj and c++ directly into an intermediate representation (so that you don't loose too much efficiency by having a c or c++ intermediate step). Often the intermediate step can be C language, used as a portable assembler (but it has disadvantages, see C-- discussions).</p> <p>As you said generated code is not what you want, tools like ROSE will help, but come on, you won't do template metaprogramming with that ;-) In fact it will give you yet another abstract machine to program to, which will roughly be a subset of languages you want to generate code for. There are other tools that make you program to models in different languages, for example in the field of component programming (like <a href="http://fractal.objectweb.org/" rel="nofollow noreferrer">Fractal</a>).</p> <p>There are also compilers from higher level languages to higher level languages. Source-to-source compilers compile to high level languages: often from language A to language A, they are used mainly for optimization. Others compilers generate code in high level languages in domain specific cases: e.g. pyjamas generates javascript from python code, Brook generates C++ and gpu shaders code from Brook (streaming) language....</p> <p>But none of those is something you want, programming languages are different, and the only way people have found to unify them, is by compiling them to a common machine model, that's the idea behind Microsoft's CLR, even more than behind the JVM, because the CLR is really broad: you can do unmanaged code, i.e. compile C++ to it (efficiently... not by considering the memory as an array of bytes...). LLVM is quite similiar, but the intermediate representation is not target agnostic.</p> <p>Conclusion: One Virtual Machine to rule them all...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload