
A graph of programming languages connected through compilers - andyonthewings
https://akr.am/languages/
======
andyonthewings
Looks like everyone want to add some missing info. The github source code link
can be found at the top right corner. For easy reference, here it is
[https://github.com/mohd-akram/languages](https://github.com/mohd-
akram/languages)

~~~
kodablah
More specifically a PR to update [https://github.com/mohd-
akram/compilers/blob/master/src/comp...](https://github.com/mohd-
akram/compilers/blob/master/src/compilers.coffee). One could argue that source
and target should allow arrays. But in general someone needs to maintain an
up-to-date "awesome-compilers" list.

------
mic47
So, you can apparently compile C++ to LLVM-IR, then to Javascript, then to
Python and then to C++ (you can do similar feat with C). Wonder if there is a
fix point, or it diverges.

~~~
sorokod
Like when you auto-translate English -> Japanese -> English. Very unlikely you
will recover the original

Good fun though.

~~~
taejo
By the pigeonhole principle, any such iteration must either enter a cycle, or
the translations must be unbounded in length. If you experiment, you will find
that Google Translate usually lands in the first category; transpilers usually
land in the second.

~~~
sorokod
I am iterested in an example that cycles on Google translate - can you share
one?

~~~
Bjartr
There's a web site dedicated to this
[http://translationparty.com](http://translationparty.com)

~~~
sorokod
Thanks!

------
bla2
Almost all compilers producing machine code can instead also produce assembly.
In fact, many compilers internally produce assembly and then run an assembler
to produce machine code. So the Assembly node is missing many in arrows.

------
jcelerier
goddamn Haxe and Python messing everything up :p
[https://imgur.com/a/PgNWLbG](https://imgur.com/a/PgNWLbG)

------
divan
Converted graph into JSON format compatible with D3, graph and others:
[https://pastebin.com/aA1sPaai](https://pastebin.com/aA1sPaai)

------
verall
I can finally fulfill my dream of writing cross-platform C++ by transpiling
for the JVM. It's just too bad I have to convert from LLVM to JS to Python
first. And then I could convert back to C++ and start over again...

Neat visualization! I wonder how large it could get if people could add their
own nodes and edges.

~~~
nerpderp83
> writing cross-platform C++

I think you are looking for WASM and it is doable today. WASM can target the
JVM.

------
magnat
A few missing items:

\- CIL to C++ using CoreRT/AoT compiler [1]

\- JVM to CIL using ikvmc [2]

\- Quite a few languages to WebAssembly using LLVM [3]

\- J# if you are willing to include dead but somewhat significant languages

[1]
[https://blogs.msdn.microsoft.com/alphageek/2016/10/13/native...](https://blogs.msdn.microsoft.com/alphageek/2016/10/13/native-
compilation-why-jit-when-you-can-codegen/)

[2]
[http://www.ikvm.net/userguide/ikvmc.html](http://www.ikvm.net/userguide/ikvmc.html)

[3] [https://stackoverflow.com/questions/43540878/what-
languages-...](https://stackoverflow.com/questions/43540878/what-languages-
can-be-compiled-to-web-assembly-or-wasm)

~~~
kyberias
\- Quite a few languages to WebAssembly using LLVM

Languages are compiled to LLVM IR and then to WebAssembly. These are shown,
right?

~~~
auscompgeek
The graph doesn't show LLVM IR compiles to WASM. It does show LLVM IR to JS
via Emscripten though.

------
ivanceras
I like the graphing library used in this one. A quick look and search at the
code leads me to this [https://github.com/cytoscape/cytoscape.js-cose-
bilkent](https://github.com/cytoscape/cytoscape.js-cose-bilkent)

~~~
jaggirs
I can vouch for this library, I recently had to do some graphing and tried
sigmajs first, but I ended up rewriting it to use cytoscape. Cytoscape is
incredibly powerfull, although it would help if they had split up the
documentation into multiple pages so that Google works on it.

------
52-6F-62
Kudos to the first person to get one of these working right for anything
beyond Hello World:

JavaScript -> Js2Py -> PyPy -> Machine Code

JavaScript -> Js2Py -> CIL -> LLVM IR (-> Machine Code)

JavaScript -> Js2Py -> Pythran -> C++ -> LLVM IR/Machine Code

That's got to look like spaghetti by the end, no?

~~~
szatkus
I guess that PyPy could directly compile only RPython (subset of Python) so it
could be a bit of hassle to get proper code :)

------
thelastidiot
Did Javascript become the babelfish of all languages?

~~~
skriticos2
yes

[https://www.destroyallsoftware.com/talks/the-birth-and-
death...](https://www.destroyallsoftware.com/talks/the-birth-and-death-of-
javascript)

~~~
theandrewbailey
I remember YavaScript!

------
jarfil
44 languages

42 languages compile to Machine Code

Wait, what? There are 2 languages that don't compile to Machine Code? Which
ones are those, and how is it even possible?

~~~
DannyB2
Java compiles to a bytecode which is not machine code. Once bytecode is
executed on target platform runtime, it is then compiled down to machine code.

But there's more to it than that. The bytecode is actually interpreted at
first by the JVM runtime. The code is also continuously dynamically profiled.
There are two compilers C1 and C2.

Whatever functions are using the most cpu time get compiled using C1. C1
rapidly compiles to poorly optimized code, but this is a big speedup over the
bytecode interpreter. The function is also scheduled to be compiled again in
the near future using the C2 compiler. The C2 compiler spends a lot of time
compiling, optimizing and aggressively inlining.

But there's more. C2 can optimize its compile for the exact target instruction
set, plus extensions, for the actual hardware it is running on at the moment.
An ahead of time C compiler cannot do that. It needs to generate x86-64 code
that runs on a large variety of hardware processors.

But there's more. The C2 compiler can optimize based on the entire global
program. Suppose a function call from one author's library to another author's
library can be optimized in some way by writing a different version of that
function. C2 can take advantage of this and do it where a C compiler can not
because it doesn't know anything about the insides of the other library it is
calling -- which might be rewritten tomorrow, or might not be written yet.
Once the Java program is started, the C2 compiler can see all parts of the
running program an optimize as needed.

But there's more. Suppose YOUR function X calls MY function Y. If your
function X is using much CPU, it gets compiled to machine code by C1, and then
in a short time gets recompiled again by C2. The C2 compiler might inline my Y
function into your X function. Now suppose the class containing my Y function
gets dynamically reloaded. Your X function now has a stale inlined version of
my Y function. So the JVM runtime changes your X function back to being
bytecode interpreted once again. If your Y function is using a lot of CPU,
then it gets compiled again by C1, and then in a while, by C2.

All this happens in a garbage collected runtime platform.

It is why Java programs seem to start up, but take a few minutes to "warm up"
when they start running fast. Many Java workloads are long running servers, so
startup is infrequent.

Now you know why Java can run fast for only six times the amount of memory as
a C program.

~~~
pjmlp
This is when describing how the Hotspot JVM would execute a Java application.

There are other ways to execute Java applications.

~~~
DannyB2
That is true.

------
drtz
My main takeaway: people want to avoid writing JavaScript about as much as
they want to avoid writing machine code or Java bytecode.

~~~
bjpirt
Alternative takeaway: Javascript is so widely deployed that most languages
have found a way to compile to it

~~~
bamboo_7
Alternativev (joke) takeaway: Javascript is as important to computers as
machine code

~~~
bcaa7f3a8bbc
Alternative non-joke: JavaScript is important to the web, just like machine
code is important to computers. Actually, many believed JavaScript was the
assembly of the web (just attempt to read the minimized scripts running in
your browser), until WebAssembly...

* [https://www.hanselman.com/blog/JavaScriptIsAssemblyLanguageF...](https://www.hanselman.com/blog/JavaScriptIsAssemblyLanguageForTheWebSematicMarkupIsDeadCleanVsMachinecodedHTML.aspx)

------
Keyframe
Dude, where's my lisp?

~~~
tempodox
Right, sbcl generates some damn good x86_64, even interactively.

------
bla2
BEAM (the Erlang VM) + Erlang, Elixir, hipe-llvm seems like a good addition to
the graph.

------
kevin42
It seems like there is a lot missing from this graph. There's a ton of info
for conversion to javascript here:

[https://github.com/jashkenas/coffeescript/wiki/list-of-
langu...](https://github.com/jashkenas/coffeescript/wiki/list-of-languages-
that-compile-to-js)

------
ThJ
I tried in vain to find WebAssembly. Why would you include JavaScript but not
WebAssembly in a graph that has LLVM in it?

~~~
hiimnate
It does have WebAssembly, but its incorrectly labeled as targeting Java
Bytecode.

~~~
chrisseaton
> incorrectly labeled as targeting Java Bytecode

[https://github.com/cretz/asmble](https://github.com/cretz/asmble)

The name of that tool is even labelled in the graph!

------
amelius
It says V8 compiles JavaScript to Machine Code, but is that really correct
given that the machine code is an intermediate product, and the result of
applying a JIT to a specialized piece of code (where part of the variables are
already known to the compiler)?

~~~
chrisseaton
> given that the machine code is an intermediate product

The machine code isn't the intermediate product - it's the final product. Some
internal IR is the intermediate product.

But yes it's normal convention in the industry to talk about JIT compilation
to machine code as 'compiling to machine code'.

~~~
amelius
But let's say, they added "decompilers" to the graph, and there is (say) a
decompiler from machine code to C. Then I'd assume, because there is a path in
the graph from JavaScript to C (going through machine code), that I can
translate from JavaScript to C. Except this isn't true because V8 is a JIT,
and doesn't output its internal representation.

~~~
chrisseaton
It's not a graph of compilers _to a file on disk_. It's a graph of compilers.
Just because it exists only in memory doesn't mean it doesn't exist. Has the
JavaScript been compiled to machine code. Yes, it has.

You mean that the JavaScript compilation is only valid for a given application
at a given point in time? Yes that's true.

~~~
amelius
What I meant is: the graph is more useful if you can apply the relations
transitively (i.e. find one or more paths between any two languages, and _use_
the compilers to walk along the path). The demo even suggests that by allowing
you to find a path, and leave the "directly" box unchecked.

------
Micoloth
Interactive graph is nice, but what's with so few zoom levels? It's either too
small or too large.. Or is my mouse scroll wheel too sensitive?

~~~
alangpierce
I suspect it was developed on a trackpad, which has pixel-level scroll
precision. Zooming is a bit fast but generally fine on my MacBook Pro.
Probably anything like this should have a zoom slider (like Google Maps does)
for people without precise scrolling or pinch zoom.

------
neilsimp1
This is really neat. I noticed that although it does have Phalanger for PHP,
it's missing PeachPie: [https://www.peachpie.io/](https://www.peachpie.io/).

------
technologia
Just nitpicking, but why wouldn't Ruby connect to C in this graph?

~~~
weatherlight
I thought the same thing...c via MRI als0 C++ via Rubinius.

~~~
technologia
Chalk it up to being a WIP. The author apparently uses this repo to pull this
data in [https://github.com/mohd-akram/compilers](https://github.com/mohd-
akram/compilers)

------
psergeant
I’d really love to be able to view cycles more easily in this graph

------
maccio92
Where is php -> c# through peachpie? Pretty significant project

------
mic47
For Haskell -> JVM, there is Frege/Eta compiler. You could argue those are
dialects of Haskell, but are pretty close. The differences will be around FFI
because of jvm

------
contravariant
Well with all three of Haskell, CIL and C# (through D) compiling to machine
code, LLVM IR and Javascript it looks like the graph is no longer planar.

------
joseluisq
Where is Smalltalk ?

~~~
rkeene2
And Tcl (which can be compiled to machine code using TclQuadCode)

------
pjmlp
Nice visualization, it can be improved though.

There are Java compilers directly to native code though, the Oracle JVM isn't
the only path.

~~~
AstralStorm
Every road leads to GCC, or in this case, GCJ. ;)

~~~
sanxiyn
GCC 7 release removed GCJ.
[https://gcc.gnu.org/gcc-7/changes.html#java](https://gcc.gnu.org/gcc-7/changes.html#java)

------
myrloc
Wait.. wasm compiles to Java Bytecode?

~~~
kodablah
Quite directly[0] :-) There's even an example using Rust regex on the JVM to
get speedups in some cases [1].

0 - [https://github.com/cretz/asmble](https://github.com/cretz/asmble) 1 -
[https://github.com/cretz/asmble/tree/master/examples/rust-
re...](https://github.com/cretz/asmble/tree/master/examples/rust-regex)

------
MrWhiz
Is hphpc still banging around somewhere inside HHVM? That would connect PHP ->
C++.

------
3pt14159
Very cool. Looks like it is missing cython, but a great graphic none the less.

------
azhenley
Is this a challenge to see if we can make this a fully connected graph?

------
eximius
Oooh, Python to Rust! It would be so thoroughly incomprehensible!

------
StavrosK
Clearly we need to make a machine code (de)compiler to JS.

------
bluedino
Where is Pascal?

~~~
laumars
It's there. Albeit only the Free Pascal compiler

------
im3w1l
g++ can turn c++ to assembly

