

Let's make a shit JavaScript interpreter Part one. - illumen
http://renesd.blogspot.com/2010/06/lets-make-shit-javascript-interpreter.html

======
stcredzero
_The Crockford article is great, since it is free, short, and well written
javascript. Unlike the 1973 paper it gets the ideas from... which is behind a
paywall, long, and uses a 1973 language called "(l,(i,(s,(p))))"._

The article's goals are noble, but in this one spot, we seem to be flirting
with flaunting one's ignorance and thinking it wit.

Anyhow, here's a slicker way of doing it. Grab an ANTLR grammar for
ecmascript. A quick Google for "ANTLR ecmascript grammar" yields:

<http://www.antlr.org/grammar/1153976512034/ecmascriptA3.g>

In addition, there is a (somewhat buggy) Python target for ANTLR 3 which is
probably good enough for a project like this.

<http://www.antlr.org/wiki/display/ANTLR3/Antlr3PythonTarget>

Voila, a way to generate a parser in Python.

~~~
eru
> "(l,(i,(s,(p))))"

And Lisp doesn't even use commas (very much).

~~~
eru

      ((l i) (s p))
    

would have been better. Would have emphasized that functions are first-class
citizens. (I know, this syntax works only in Scheme.)

