Re:Google Dart Will Not Be the Next Default Programming Lang...
by skybrian on Sunday April 26, 2015 @12:38PM
(#9442297)
The Closure compiler both parses and prints JavaScript (it can be used as a minimizer) and it's written in Java.
Also, if you're writing a compiler that outputs JavaScript you need to print JavaScript, not parse it, and you can use whatever subset you like. There are hundreds of projects to do this. JavaScript is actually an easier compiler target to deal with than x86 since it's not assembly language and you can read the output, and you don't have to deal with things like register allocation.
The hard part isn't generating code; it's making it run fast and reducing the output size so it's competitive with hand-written JavaScript, having great interop with JavaScript so you can reuse existing libraries, and making the whole ecosystem easy to use (editors, debuggers, and so on). GWT was a pioneer in this and TypeScript and Dart are solid efforts. I'm also a fan of GopherJS and Elm. I'm not going to try to pick winners but I think one of them will eventually succeed.
As a target language, JavaScript would be fine if it had some additional data types like 64 bit ints. ES6 helps by adding a built-in Map type, and providing a common module system which will help interop.
Disclosure: formerly on GWT, now on Dart. But I try not to be partisan.
Also, if you're writing a compiler that outputs JavaScript you need to print JavaScript, not parse it, and you can use whatever subset you like. There are hundreds of projects to do this. JavaScript is actually an easier compiler target to deal with than x86 since it's not assembly language and you can read the output, and you don't have to deal with things like register allocation.
The hard part isn't generating code; it's making it run fast and reducing the output size so it's competitive with hand-written JavaScript, having great interop with JavaScript so you can reuse existing libraries, and making the whole ecosystem easy to use (editors, debuggers, and so on). GWT was a pioneer in this and TypeScript and Dart are solid efforts. I'm also a fan of GopherJS and Elm. I'm not going to try to pick winners but I think one of them will eventually succeed.
As a target language, JavaScript would be fine if it had some additional data types like 64 bit ints. ES6 helps by adding a built-in Map type, and providing a common module system which will help interop.
Disclosure: formerly on GWT, now on Dart. But I try not to be partisan.