7 ms·
List of languages that compile to JS
- ionfish 16y agoTwo Haskell compilers (UHC and YHC) have JavaScript backends which convert their core languages to JS. I've added them to the wiki page.
- boneheadmed 16y agoThis is a great list. I was just thinking about what might be out there the other day. I'm very interested in Ruby --> JS. However haven't tried them. I followed Charles Nutter's work on JRuby for a while and it seems to me that it's extremely involved to actually compile a fully functioning ruby into another language and/or bytecode.
- clyfe 16y agoFeel free to contribute, it's a wiki!
- JoeCamel 16y agoList of interpreters implemented in JavaScript for various languages would be also nice. I think they can be useful for educational purposes i.e. writing interactive materials on the web.
- cromulent 16y agoWasabi? http://www.joelonsoftware.com/items/2006/09/01b.html http://www.joelonsoftware.com/items/2006/09/01b.html
- btilly 16y agoI just contributed http://www-sop.inria.fr/indes/scheme2js/ http://www-sop.inria.fr/indes/scheme2js/. I thought about including the fact that Pugs had a JavaScript backend then decided not to because Pugs never was completed (and likely never will be).
- po 16y agoAdded emscripten which to my untrained eyes seems like the place where a lot of gains can be made. You can gain a lot by removing the middleman but sometimes you can gain a lot by adding one.
- wahnfrieden 16y agoEmscripten is the most exciting project IMO - it's basically a more portable NaCl. I wonder if Google will start using it if they're serious about NaCl.
- profquail 16y agoWebSharper lets you compile F# to JS (it's a commercial product though.)
- dsherhrt 16y ago●---------------------------------------● Happy New Year◎,◎appy shopping ●---------------------------------------● ●------ http://goo.gl/l5v0b http://goo.gl/l5v0b ------● ●------ http://goo.gl/l5v0b http://goo.gl/l5v0b ------● ●------ http://goo.gl/l5v0b http://goo.gl/l5v0b ------● ●------ http://goo.gl/l5v0b http://goo.gl/l5v0b ------● ●------ http://goo.gl/l5v0b http://goo.gl/l5v0b ------● ●------ http://goo.gl/l5v0b http://goo.gl/l5v0b ------● ●------ http://goo.gl/l5v0b http://goo.gl/l5v0b ------● ●------ http://goo.gl/l5v0b http://goo.gl/l5v0b ------● ●------ http://goo.gl/l5v0b http://goo.gl/l5v0b ------● ●------ http://goo.gl/l5v0b http://goo.gl/l5v0b ------● ●------ http://goo.gl/l5v0b http://goo.gl/l5v0b ------● ●------ http://goo.gl/l5v0b http://goo.gl/l5v0b ------● ●------ http://goo.gl/l5v0b http://goo.gl/l5v0b ------● ●------ http://goo.gl/l5v0b http://goo.gl/l5v0b ------● ●------ http://goo.gl/l5v0b http://goo.gl/l5v0b ------● ●------ http://goo.gl/l5v0b http://goo.gl/l5v0b ------● ●---------------------------------------● Happy New Year◎,◎appy shopping ●------------------------------------●--
- msy 16y agoI note that doesn't read 'good JS' or 'fast JS'. You can put me in a tutu but I won't be a prima ballerina.
- Zak 16y agoDefine good in this context. I'm inclined to say that if it doesn't have cross-browser bugs and it's fast, then it's good. The output being readable to human programmers probably shouldn't be a goal when JS is being used as a compiler target.
- msy 16y agoI'd define good as it takes full advantage of the javascript language and produces & can be used to create structures optimised for javascript, not the language it was written in.
- stcredzero 16y agoThis is why I think it's better to reduce the context-switch between server and browser and not eliminate it. There's going to be a context-switch there no matter what you do, so there's no sense in paying such high prices to try to eliminate it.
- gruseom 16y agoAgreed in principle, but readability still matters a great deal for debugging. There's vastly more browser tool support for JS (e.g. Firebug) than for languages targeting JS. These tools get harder to take advantage of as one's compiled JS gets less readable. Sometimes I think the holy grail for what we do would be a Slime-like REPL in the web browser that speaks Parenscript, maps to source code, and had full debugging support. In the meantime, though, things like Firebug are indispensable.
- sedachv 16y ago"The output being readable to human programmers probably shouldn't be a goal when JS is being used as a compiler target." Everyone says that until they have to debug the generated JavaScript in IE.
- katox 16y agoFantom (http://fantom.org/ http://fantom.org/) also compiles to javascript. However this platform is supported via direct AST transformation not runtime bytecode generation as for JVM or CLR.
- amadiver 16y agoAny tools that work in the opposite direction? ( e.g., JS -> C )
- spicyj 16y agoYou can use a JavaScript engine such as V8 to run JavaScript code anywhere, but I don't know of any native compilers.
- praptak 16y agoRhino does JS -> Java bytecode internally but I don't think you can grab those classes and execute them outside Rhino. A full compiler would of course always have the problem of dynamically generated JS, i.e eval().
- sedachv 16y agoRed Daly has a JavaScript to Parenscript (Common Lisp) translator: https://github.com/gonzojive/js-to-parenscript https://github.com/gonzojive/js-to-parenscript The generated code from that won't run without a JS runtime implementation in CL backing the JS-specific Parenscript forms, which currently doesn't exist to my knowledge (it's not hard to write, just not very useful). This is useful by itself for writing JS analysis and transformation tools and moving JS code to Lisp. There's CL-JavaScript: http://marijnhaverbeke.nl/cl-javascript/ http://marijnhaverbeke.nl/cl-javascript/ This is a translator/compiler/"simulator" (http://www.cs.aau.dk/~normark/oo-scheme.html http://www.cs.aau.dk/~normark/oo-scheme.html) that provides good integration between the two languages.
- Zak 16y agoHow about a list of languages that compile to PHP? haXe is the only mature one I know about.
- rbxbx 16y agohttp://news.ycombinator.com/item?id=833954 http://news.ycombinator.com/item?id=833954
- bobds 16y agoI just so happen to have this list. http://haxe.org/doc http://haxe.org/doc http://github.com/scriptor/pharen http://github.com/scriptor/pharen http://www.mathgladiator.com/projects/kira/ http://www.mathgladiator.com/projects/kira/ http://www.scriptol.net/ http://www.scriptol.net/ http://sunra.nachtkabarett.com/ http://sunra.nachtkabarett.com/ http://users.xelent.net/mlewis/tellpdf.php?seid=12457c30afd9fc8170b828f5d1face35 http://users.xelent.net/mlewis/tellpdf.php?seid=12457c30afd9... http://ialexi.com/portfolio/original-works/components/quirk/ http://ialexi.com/portfolio/original-works/components/quirk/ And a somewhat related list: https://github.com/ryantenney/php7 https://github.com/ryantenney/php7 Hacking the PHP compiler and standard libraries in the name of turning it into a not crappy language. https://github.com/tenderlove/phuby https://github.com/tenderlove/phuby Phuby wraps PHP in a loving embrace. Exposes a PHP runtime in ruby https://code.google.com/p/japha/ https://code.google.com/p/japha/ implementation of the Java 1.4.2 library in PHP https://github.com/lunant/lisphp https://github.com/lunant/lisphp Lisphp is a Lisp dialect written in PHP https://code.google.com/p/php-alternative-syntax/ https://code.google.com/p/php-alternative-syntax/ Scala inspired syntax for PHP https://code.google.com/p/java-php-toolkit/ https://code.google.com/p/java-php-toolkit/ a cross language compiler than transforms java code to php code deployable on any server supporting PHP >= 5.3 https://github.com/bendemott/pyhp https://github.com/bendemott/pyhp Pyhp is a way to execute PHP Source Code directly within Python Scripts https://github.com/ramen/phply https://github.com/ramen/phply PHP parser written in Python using PLY https://github.com/skeltoac/php_app https://github.com/skeltoac/php_app A PHP eval server for Erlang/OTP
- Scriptor 16y agoHey, creator of Pharen here. I've been procrastinating on another release for a while but still developing it. If anyone wants to check it out there is a better site over at http://scriptor.github.com/pharen http://scriptor.github.com/pharen.
- olavk 16y agoMascara (http://www.mascaraengine.com/ http://www.mascaraengine.com/) compiles a typed version of ECMAScript (based on Harmony and other proposals for ECMAScript extensions) into JavaScript. It is backwardly compatible with JavaScript, so you can gradually upgrade code to take advantage of it.
- ghenne 16y agoNS Basic/App Studio compiles Visual Basic style BASIC to JavaScript + HTML5. Also includes an IDE. Targets iOS and Android. (http://www.nsbasic.com/app http://www.nsbasic.com/app)
- wahnfrieden 16y agoWow, that's a blast from the past, from the Palm OS days. Interesting that they're still around.
- ghenne 16y agoNS Basic was actually around long before Palm OS, starting with the Newton. (!) We think /App Studio is our best yet.
- wahnfrieden 16y agoAh, nice! That's a long history - you've held out better than some of the other tools I remember using for Palm, like CASL, HB++ and AppForge. (Also amusing that Palm got their start on the Newton, with Graffiti.)
- 198d 16y agoAm I the only one who just plain doesn't understand the value these tools provide? From my perspective, why not just _write_ javascript? Seems ridiculous. I mean, they're fun and all, but no one sets out to do a project of meaning or scale and chooses these tools, do they?
- jgfoot 16y agoI enjoy using CoffeeScript on my hobby projects. If you write your server code in a language like Python or Ruby, CoffeeScript makes Javascript more familiar. It adds nice features like list comprehensions, and I prefer the way it handles classes and objects. But no, it isn't for everyone.
- windsurfer 16y agoThe same reason people don't just write in assembly (or more accuratley, C) to write a desktop application very often. Javascript is the assembly language of the web.
- defrex 16y agoThat analogy breaks down though. JavaScript is just as much of a high-level language as most of the things that are compiling to it. Most of the time the reason people don't just write in JavaScript is because they don't like it's _style_, rather then with C or assembly, where the goal is to work at a higher level to avoid writing boilerplate and managing things are are unnecessary.
- wahnfrieden 16y agoIt doesn't break down entirely though. Imagine we were all restricted to C++ for writing desktop software (although that's nonsensical, it's the case with JS and the web) - wouldn't it be reasonable to start developing other languages that compile to C++? If you can output JS that's fast enough, why not?
- sedachv 16y agoI agree with you esp. when it comes to GWT - going from Java to JavaScript is going from a terrible language to an ok one. There are two reasons why it has become popular: Java programmers don't want to learn JavaScript It comes with good UI building tools If GWT didn't have good UI building tools, Java programmers wouldn't have any excuse not to learn JS and program normal web applications. But here's a tool that lets them use their existing Java knowledge to build halfway decent web GUIs. This is just another example of how technologies are chosen by considerations other than objective technical merits.
- lukeinth 16y agoI didn't see haXe on the list so added it. Seems its often overlooked when people talk about languages which compile to JS.
- chadaustin 16y agoFor those that think JavaScript makes a good VM format for the web, I've written a couple blog posts recently on this topic: http://chadaustin.me/2011/01/native-client-is-widely-misunderstood-and-what-google-should-do-about-it/ http://chadaustin.me/2011/01/native-client-is-widely-misunde... http://chadaustin.me/2011/01/digging-into-javascript-performance/ http://chadaustin.me/2011/01/digging-into-javascript-perform... Basically, we need another 10x to 30x in performance for JavaScript to match native code performance...
- swolchok 16y agoYour lines of code measurement would be more compelling if you used sloccount instead of wc -l. Also, are you counting the lines of code in directories with tests in the name for Mozilla? I don't grok that find(3) incantation fully.
- sedachv 16y agoThank you for posting this list! I don't think I would have ever heard about http://cluecc.sourceforge.net/ http://cluecc.sourceforge.net/ otherwise. It seems like a really big deal, I'm very surprised I haven't heard about it before. Def. checking it out.
- baltcode 16y agoHow about Links at http://groups.inf.ed.ac.uk/links/ http://groups.inf.ed.ac.uk/links/ and HOP at www.hop.inria.fr in the tierless category. Also, why isn't there a tierless JS since we can already run JS on the client and server side? I asked this question here: http://news.ycombinator.com/item?id=2068395 http://news.ycombinator.com/item?id=2068395