Re:Js.js - A JavaScript interpreter in JavaScript
by charliesome on Monday January 02, 2012 @08:06PM
(#3418154)
It's probably cheating a little to just grab an existing Javascript interpreter written in C++, compile that with emscripten and call it a Javascript interpreter in Javascript. When you compile C++ code, do you say that the program is in Assembly?
Re:Js.js - A JavaScript interpreter in JavaScript
by jterrace on Monday January 02, 2012 @08:25PM
(#3418207)
Agreed, it's partially cheating, although a lot of work went into getting it to compile to LLVM and patching it work with Emscripten. That's not where it stops though. The plan is to make the library work just like the SpiderMonkey JS API, which will require wrapper scripts in JS.
Re:Js.js - A JavaScript interpreter in JavaScript
by gkoberger on Monday January 02, 2012 @08:50PM
(#3418277)
Other than prototyping new JS features (or to say you did it), what's the use? It will never come close to being fast enough to be a viable alternative, like PyPy is.
Re:Js.js - A JavaScript interpreter in JavaScript
by Animus7 on Monday January 02, 2012 @06:32PM
(#3417874)
I don't even think the worst part is the download (which can be cached). The worst part is the fact that you're running your script, interpreted by a weirdly generated unoptimized script, interpreted by a scripting engine which only then runs on metal. I'm shooting in the dark, but I'd bet the performance and memory usage would be a disaster for anything but Hello, world.
Re:Js.js - A JavaScript interpreter in JavaScript
by spullara on Monday January 02, 2012 @08:01PM
(#3418143)
Actually, right now, even Hello world is a disaster. My guess is that this will drive some interesting improvements to emscripten and LLVM so there may be some benefits down the line.
Re:Js.js - A JavaScript interpreter in JavaScript
by cdata on Monday January 02, 2012 @10:01PM
(#3418418)
I'm not super familiar with Narcissus in practice, but on paper your projects sound very similar. Were there any interesting reasons why you opted to make this project instead?
Re:Js.js - A JavaScript interpreter in JavaScript
by joshfraser on Monday January 02, 2012 @09:41PM
(#3418382)
There are plenty of things I've done in my life that didn't make a lot of sense, but I did them just because I could. I'll happily put js.js in the same bucket and give props for creativity over usefulness.
Re:Js.js - A JavaScript interpreter in JavaScript
by stan_rogers on Monday January 02, 2012 @07:53PM
(#3418125)
It's similar to the metacircular Scheme interpreter in Scheme in SICP. It's not that interpreting JavaScript in JavaScript (especially if that JavaScript is running on a full-blown and more efficient interpreter itself) is a practical end, but that it demonstrates a concept: language as data and data as language. As an implementation, it is merely interesting -- but imagine writing code in a language closer to the problem domain you're working with that just happens to run on JavaScript.
Re:Js.js - A JavaScript interpreter in JavaScript
by jterrace on Monday January 02, 2012 @06:43PM
(#3417909)
Not quite. It will support everything that SpiderMonkey's API supports when embedding the interpreter into a C++ application. Much more powerful than eval().
Re:Js.js - A JavaScript interpreter in JavaScript
by Animus7 on Monday January 02, 2012 @06:24PM
(#3417850)
> Instead of trying to create an interpreter from scratch, SpiderMonkey is compiled into LLVM and then emscripten translates the output into JavaScript.
Heh, this is pretty much the epitome of hacking: needlessly complicated, ultimately pointless, but still awesome, clever and inspiring.
Heh, this is pretty much the epitome of hacking: needlessly complicated, ultimately pointless, but still awesome, clever and inspiring.