27 ms·
The Language-Language Matrix
- axman6 13y ago"Try running phpjs (JavaScript → PHP) in PHPPHP (PHP → PHP) in PHP.rb (PHP → Ruby) in HotRuby (Ruby → JavaScript) in Narcissus (JavaScript → JavaScript) in Narcissus (JavaScript → JavaScript)!"
- chrismorgan 13y agoI am astonished that PyPy does not appear on this chart.
- sitkack 13y agoPyPy is an implementation. I guess you could call it manually to output C code (then it would sit next to Shedskin), but it isn't normally used that way. I think there should be bounties for getting certain paths through the transpiler graph working.
- chrismorgan 13y agoVarious of the other things in there are implementations. To take a direct parallel, compare it with PHPPHP. PyPy allows you to run Python code inside any Python implementation.
- sitkack 13y agoYou are correct, it should totally be on this list. Both as Python on Python and Python -> C.
- advisedwang 13y agoI sent a pull request, maybe it will be soon.
- smnrchrds 13y agoNow it is in the wrong column: Python → Scala.
- illicium 13y agoIt does, but for some reason in the Python -> Scala category
- njbooher 13y agoI'm more surprised that Cython isn't there.
- Thrymr 13y agohttps://github.com/tcr/langlangmatrix/pull/32 https://github.com/tcr/langlangmatrix/pull/32
- sitkack 13y agoThere was a similar project mentioned here before showing transpiler chains, can't find it. Seems like it should be mentioned.
- madhuprasanna 13y agoNice. Some observations: Many languages compile to JavaScript(has highest number of source languages). Java(I think JVM) and C++(native binaries??) has higher source languages. Clojure has highest target languages(good to learn then). Java to Java => Beanshell is interesting.
- tkirchner 13y agoThis indicates that JavaScript is a pain in the ass, which it is. This is neither an argument against JavaScript nor was it indended as one, just a personal observation from a long-time JavaScript programmer.
- nilliams 13y ago> This indicates that JavaScript is a pain in the ass Or as another commenter pointed out that people want to write for the browser and want to use their favourite language to do so.
- tkirchner 13y agoMaybe when analysing the stats it helps to distinguish between the intention of the one implementing the transcompiler (e.g. fun, proof-of-concept, research, money, actual need in a project, ...) and the size of the user-base of the transcompiler (in relation to the user-base of the language that is transcompiled to). Lets say JS's user-base is pretty huge in relation to other languages (which is not an argument for JS). The stats show that a lot of languages transcompile to javascript, so I would indicate a real need for such projects, otherwise there would probably just exist a few as fun/proof-of-concept-projects. Similar situation for C/C++ (maybe due to lack of high-level features) and Java (due to lack of practical features). On the other hand: languages that only have a few or no transcompilers that compile to them, does not mean, they are better useable. There could be other things that make writing transcompilers very hard.
- tkirchner 13y agoMaybe the fact that there are many compilers that target language A means that either language A is easy to target (so transforming to it is a fun hack) or no-one wants to program directly in language A or both (or more). I believe an example of A is JavaScript.
- publicfig 13y agoThis is pretty great, thanks! I would love to see the top row with the language names move down with the page. I really think that would make this easier to read.
- minusSeven 13y agono need to learn javascript as all languages can compile into it. :D
- iskander 13y agoPython -> Scala = PyPy?
- batbomb 13y agoC++ on C++ = Cling, although it's a bit physics centric
- malkia 13y agoAlso this https://github.com/stevedonovan/UnderC https://github.com/stevedonovan/UnderC
- chalst 13y agoOmission: there's a very nice on-the-fly compiler, which supports writing an embedded intepreter, for (an old dialect of) Lua in OCaml, written by Norman Ramsey [1]. It's part of the C-- distribution [2]. [1]: http://www.cs.tufts.edu/~nr/pubs/maniaws-abstract.html http://www.cs.tufts.edu/~nr/pubs/maniaws-abstract.html [2]: http://www.cminusminus.org/c-downloads/ http://www.cminusminus.org/c-downloads/
- mattparlane 13y agoVery nice. It looks to me like PHP.rb should be in Ruby -> PHP rather than PHP -> Ruby.
- polskibus 13y agono mention of recently announced scala.js. Otherwise, good job, I'll be monitoring the list!
- mtrimpe 13y agoIt's impressive to see how many runtimes Clojure has already been ported to. I'm starting to get my hopes up for a world where a Clojure FRP core drives apps in a host of target languages.
- juliangamble 13y agoWhat we see in Clojure (like other Lisps) is minimal syntax directed at the idea of homoiconicity. This means that the program's structure is similar to its syntax. It also means that we can represent the program as a data structure in the language itself. So (1) Simple syntax, and (2) being able to represent the program structure in the language easily, both lead to making it easy to build compilers, interpreters and bytecode compilers. The barrier to entry for these tasks is lower in Clojure. Many would also say that (1) and (2) make Clojure a joy to program in, but I'll leave that to the reader to judge for themselves.
- nilliams 13y ago> Many would also say that (1) and (2) make Clojure a joy to program in, ... Yep, the opposing view being that the lack of syntax that some see as a benefit actually makes it inexpressive, compared to a language with more syntax that expresses its ideas more like human language (e.g. Ruby, Python). > but I'll leave that to the reader to judge for themselves. Same! Not made my mind up yet, currently struggling through the Clojure book.
- danenania 13y agoI recently came across this new Clojure book: http://www.braveclojure.com/ http://www.braveclojure.com/ Seems like potentially an accessible and entertaining intro to the language. Perhaps it could be a good way to get your feet wet before diving into one of the larger tomes.
- nilliams 13y agoThanks!
- swah 13y agoI have to agree with Yegge, good tools are a big problem (http://googlehow.com/2013/10/09/stanford-seminar-googles-steve-yegge-on-grok/ http://googlehow.com/2013/10/09/stanford-seminar-googles-ste...). His project becomes more important as more compilers are written - I hope it exists outside Google someday.
- fabriceleal 13y agoNo entry for (Common Lisp → Common Lisp) or (Scheme → Scheme)?
- collyw 13y agoIs it just me, or does the fact that every other language is getting translated to Javascript suggest a lot of problems with the language that so many people are willing to write translators? (I am not a big fan of JS myself, but I also don't feel I have used the language enough to be competent with it).
- strictfp 13y agoI'm more inclined to believed that people want to run their programs in a browser, and js is a requirement in that runtime environment. Most devs are sadly quite reluctant to trying out new languages, and would rather recompile.
- collyw 13y agoI wouldn't expect any of my Python code to just run in the browser, whatever translation layer I am using (ok, maybe small snippets, but not any code that does anything significant). Its basically a whole different platform you are coding.
- strictfp 13y agoNo, but a lot of devs are fine switching platforms, but not languages. I don't know why, I think it's fun, but many people are scared of new languages.
- rtpg 13y agoDoes having a foreign function interface to C mean that C is better? It's better to see Javascript as a bytecode than as a language in these cases. It just happens that the bytecode looks like the language.
- sitkack 13y agoIt has absolutely nothing to do with the quality of the language and entirely to do with the reach of the platform. People aren't writing transpilers so they can get Haskell to run on Rhino.
- collyw 13y agoIt would be interesting to do a "chineese whispers" type experiment on these and see what comes out at the end of translating code through multiple languages.
- _delirium 13y agoHere's C in Common Lisp: https://github.com/vsedach/Vacietis#readme https://github.com/vsedach/Vacietis#readme
- kibwen 13y agoIt seems a bit arbitrary to omit mention of Lua's native ability to be trivially embedded in C and C++ programs. Why limit yourself to transpilers?
- freehunter 13y agoYeah I thought it was odd when they had N/A for Lua to C++. They have Clojure listed at Clojure to Java, why not have Lua listed as Lua to C++? It's darn close to the same thing.
- tpoindex 13y agoCibyl and NestedVM seem to be in the wrong cell. These take C/C++ source and produce Java. Come to think of it, the Java target should probably be "Java/JVM" as NestedVM can skip Java, going straight to JVM bytecode. Another suggestion of code I've played with before: http://IKVM.net http://IKVM.net to run Java (JVM bytecode) on C#, errr, .NET CIL.
- rikkus 13y agoTake the languages which can be compiled to Java bytecode, throw in IKVM.NET, add the list of languages which can be compiled for the CLR, and you might have the longest list of languages which can run on one platform?
- kibwen 13y agoThen consider that Javascript runs on the JVM, and add every language which can be compiled to Javascript. Then consider that, via Emscripten, any language which targets LLVM can be compiled to Javascript, so add every language with an LLVM frontend. The consider that C has an LLVM frontend, and add every language which can be compiled to C. Yes, indeed! We now live in a time where your Chicken Scheme codebase can be compiled to C, then compiled to Javascript, then intepreted in a Javascript interpreter that is being interpreted on a Java interpreter that is being interpreted on a .Net interpreter.
- rikkus 13y agoAlmost. The JavaScript bytecode is turned into JVM bytecode which is then turned into CLR bytecode which is then JITted and runs as compiled native code. I think. Did I miss something?
- ggchappell 13y agoNice. Isn't it a bit odd that "C/C++" is a single category? That works in certain contexts, but certainly (1) C is a much more common compilation target than C++, and (2) C is much easier to handle as a source language than C++. So in this table it does not make sense to think of the two as one thing.