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:
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.