11 ms·
A graph of programming languages connected through compilers
- psergeant 8y agoI’d really love to be able to view cycles more easily in this graph
- pjmlp 8y agoNice visualization, it can be improved though. There are Java compilers directly to native code though, the Oracle JVM isn't the only path.
- AstralStorm 8y agoEvery road leads to GCC, or in this case, GCJ. ;)
- pulse7 8y agoAccording to this graph one could actually get from Java to Objective-C to LLVM-IR to Machine Code... Or with LLVM-IR to C in the last step you could get from Java to C...
- esrauch 8y agoOne problem with this graph is that not all links actually support the full language. J2objc actually places constraints on your code so in some sense it's really compiling some (large) subsets of Java.
- pjmlp 8y agoSure, the point was about direct generation, without those intermediate steps.
- mihaifm 8y agoIt seems like it allows the nodes to be dragged to rearrange them. But yeah, it definitely needs a better graph.
- frou_dh 8y ago> There are Java compilers directly to native code though Dude, if there was some kind of wiki documenting HN lore, there would have to be a page on you drilling this fact into our skulls for years on end! :) https://hn.algolia.com/?query=java%20native%20pjmlp&sort=byPopularity&prefix&page=1&dateRange=all&type=comment https://hn.algolia.com/?query=java%20native%20pjmlp&sort=byP...
- pjmlp 8y agoWell, if some devs would bother to learn how to use their tooling properly instead of keeping urban myths alive, that wouldn't be needed. :)
- magnat 8y agoA 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-compilation-why-jit-when-you-can-codegen/ https://blogs.msdn.microsoft.com/alphageek/2016/10/13/native... [2] http://www.ikvm.net/userguide/ikvmc.html http://www.ikvm.net/userguide/ikvmc.html [3] https://stackoverflow.com/questions/43540878/what-languages-can-be-compiled-to-web-assembly-or-wasm https://stackoverflow.com/questions/43540878/what-languages-...
- AdamM12 8y agoIsn't Python to C using CPython missing? Edit: Or I guess technically python byte code. [1] [1] http://effbot.org/zone/python-compile.htm http://effbot.org/zone/python-compile.htm
- chrisseaton 8y ago> Isn't Python to C using CPython missing? Python doesn't compile Python to C, non-technically or otherwise. Where did you get that impression? I presume they don't include internal IRs like Python bytecode, as it's not any kind of shared or standardised format. Otherwise you'd be including tons of different compiler IRs.
- AdamM12 8y agoI thought it maps your code to the base Py_Object like how writing an extension works? Idk only done a little bit of that and need to dive into the process more. On my todo list so if you have some links that have a good explanation of this that would be great. Unfortunately was unable to take compilers in school so missed out on the conceptual aspect of the compilation process. edit: found the docs on python.org for the compiler [1] [1] https://devguide.python.org/compiler/ https://devguide.python.org/compiler/
- chrisseaton 8y ago
- Micoloth 8y agoInteractive 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 8y agoI 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.
- mic47 8y agoSo, 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.
- esrauch 8y agoI looked at js2py (the most surprising-to-me link in that chain) the code it generates already kind of explodes on loc. I think it's probably very unlikely there is a fixed point instead of an exponential explosion of your program as you run it through the chain.
- sorokod 8y agoLike when you auto-translate English -> Japanese -> English. Very unlikely you will recover the original Good fun though.
- taejo 8y agoBy 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 8y agoI am iterested in an example that cycles on Google translate - can you share one?
- chrisseaton 8y ago> I am iterested in an example that cycles on Google translate - can you share one? Just translate 'hello' back and forth in any pair of languages I tried.
- Bjartr 8y agoThere's a web site dedicated to this http://translationparty.com http://translationparty.com
- mic47 8y agoFor 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
- andyonthewings 8y agoLooks 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 8y agoMore specifically a PR to update https://github.com/mohd-akram/compilers/blob/master/src/compilers.coffee https://github.com/mohd-akram/compilers/blob/master/src/comp.... One could argue that source and target should allow arrays. But in general someone needs to maintain an up-to-date "awesome-compilers" list.
- jcelerier 8y agogoddamn Haxe and Python messing everything up :p https://imgur.com/a/PgNWLbG https://imgur.com/a/PgNWLbG
- thelastidiot 8y agoDid Javascript become the babelfish of all languages?
- progval 8y agoIt makes a lot more sense when you see Javascript as "machine code" for browsers.
- skriticos2 8y agoyes https://www.destroyallsoftware.com/talks/the-birth-and-death-of-javascript https://www.destroyallsoftware.com/talks/the-birth-and-death...
- theandrewbailey 8y agoI remember YavaScript!
- divan 8y agoConverted graph into JSON format compatible with D3, graph and others: https://pastebin.com/aA1sPaai https://pastebin.com/aA1sPaai
- neilsimp1 8y agoThis 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/.
- contravariant 8y agoWell 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.
- jarfil 8y ago44 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?
- chrisseaton 8y ago> how is it even possible? Instead of compiling to machine code, you compile to another language instead. C++ was originally compiled to C, for example. Why would you think it wasn't possible?
- progval 8y agoThere's ActionScript, which can only be interpreted.
- auscompgeek 8y agoHm. I thought Flash has bytecode rather than ActionScript being plain interpreted.
- deleted 8y ago[deleted]
- larsiusprime 8y agoYou are correct. ActionScript compiles to ABC (ActionScript ByteCode) which is run by the AVM (ActionScript Virtual Machine).
- bkul_ 8y agoDoes it count interpreters?
- ChrisLomont 8y agoInterpreted only
- koonsolo 8y agoHaxe basically compiles to any other language. So why would it need to go straight to Machine Code? It is super-multiplatform.
- bluedino 8y agoWhere is Pascal?
- joseluisq 8y agoWhere is Smalltalk ?
- bla2 8y agoAlmost 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.
- myrloc 8y agoWait.. wasm compiles to Java Bytecode?
- kodablah 8y agoQuite 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-regex https://github.com/cretz/asmble/tree/master/examples/rust-re...
- amelius 8y agoIt 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 8y ago> 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 8y agoBut 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 8y agoIt'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 8y agoWhat 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.
- im3w1l 8y agog++ can turn c++ to assembly
- maccio92 8y agoWhere is php -> c# through peachpie? Pretty significant project
- drtz 8y agoMy main takeaway: people want to avoid writing JavaScript about as much as they want to avoid writing machine code or Java bytecode.
- deleted 8y ago[deleted]
- bjpirt 8y agoAlternative takeaway: Javascript is so widely deployed that most languages have found a way to compile to it
- bamboo_7 8y agoAlternativev (joke) takeaway: Javascript is as important to computers as machine code
- bcaa7f3a8bbc 8y agoAlternative 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/JavaScriptIsAssemblyLanguageForTheWebSematicMarkupIsDeadCleanVsMachinecodedHTML.aspx https://www.hanselman.com/blog/JavaScriptIsAssemblyLanguageF...
- deleted 8y ago[deleted]
- Waterluvian 8y agoI think the quality of JavaScript as a language is completely irrelevant. It is because it's the only* language that runs in web browsers. So if you want your stuff to run there, you have to target JavaScript. If WATFIV was the only language that ran in browsers, everything would target it, too.
- bunderbunder 8y ago
- bla2 8y agoBEAM (the Erlang VM) + Erlang, Elixir, hipe-llvm seems like a good addition to the graph.
- azhenley 8y agoIs this a challenge to see if we can make this a fully connected graph?
- ThJ 8y agoI tried in vain to find WebAssembly. Why would you include JavaScript but not WebAssembly in a graph that has LLVM in it?
- hiimnate 8y agoIt does have WebAssembly, but its incorrectly labeled as targeting Java Bytecode.
- chrisseaton 8y ago> 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!
- DougBTX 8y agoThat line is labelled with https://github.com/cretz/asmble https://github.com/cretz/asmble
- pohl 8y agoWhat stands out to me is the absence of anything targeting WebAssembly. This must be a work in progress.
- kevin42 8y agoIt 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-languages-that-compile-to-js https://github.com/jashkenas/coffeescript/wiki/list-of-langu...
- Keyframe 8y agoDude, where's my lisp?
- jacksmith21006 8y agoDart should not be connected through JS. If under stand what the graph represents.
- StavrosK 8y agoClearly we need to make a machine code (de)compiler to JS.
- 3pt14159 8y agoVery cool. Looks like it is missing cython, but a great graphic none the less.
- ivanceras 8y agoI 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 8y agoI 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.
- technologia 8y agoJust nitpicking, but why wouldn't Ruby connect to C in this graph?
- weatherlight 8y agoI thought the same thing...c via MRI als0 C++ via Rubinius.
- technologia 8y agoChalk 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
- verall 8y agoI 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 8y ago> writing cross-platform C++ I think you are looking for WASM and it is doable today. WASM can target the JVM.
- eximius 8y agoOooh, Python to Rust! It would be so thoroughly incomprehensible!
- 52-6F-62 8y agoKudos 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 8y agoI guess that PyPy could directly compile only RPython (subset of Python) so it could be a bit of hassle to get proper code :)
- MrWhiz 8y agoIs hphpc still banging around somewhere inside HHVM? That would connect PHP -> C++.