3 ms·
Very cool: http://www.jwz.org/blog/2010/10/every-day-i-learn-something-new-and-stupid/#comment-1048 http://www.jwz.org/blog/2010/10/every-day-i-learn-something-
by tszming 15y ago
Very cool: http://www.jwz.org/blog/2010/10/every-day-i-learn-something-new-and-stupid/#comment-1048 http://www.jwz.org/blog/2010/10/every-day-i-learn-something-...
>> "Ten days to implement the lexer, parser, bytecode emitter (which I folded into the parser; required some code buffering to reorder things like the for(;;) loop head parts and body), interpreter, built-in classes, and decompiler. I had help only for jsdate.c, from Ken Smith of Netscape (who, per our over-optimistic agreement, cloned java.util.Date — Y2K bugs and all! Gosling…).
>> Sorry, not enough time for me to analyze tail position (using an attribute grammar approach: http://wiki.ecmascript.org/doku.php?id=strawman:proper_tail_calls http://wiki.ecmascript.org/doku.php?id=strawman:proper_tail_...). Ten days without much sleep to build JS from scratch, "make it look like Java" (I made it look like C), and smuggle in its saving graces: first class functions (closures came later but were part of the plan), Self-ish prototypes (one per instance, not many as in Self).
>> I'll do better in the next life."
- hedgehog 15y agoI also liked jwz's response farther down to criticism about selling out: "Brendan's house and my nightclub thank us for selling out early and often."
- bemmu 15y agoHaving never met a person this productive, could this really be possible?
- deleted 15y ago[deleted]
- kragen 15y agoMy first compiler (Ur-Scheme, which compiles the subset of Scheme it's written in, and runs faster when compiled with itself than when compiled with any other Scheme compiler I could find) took me only three weeks, including the time to debug all the crashes from emitting faulty assembly code. Ten days to implement the JS interpreter seems eminently reasonable, especially if you get to use things like lex and yacc, and it isn't your first interpreter ever.