2007-08-05
This is the companion file to my paper on Vaughan Pratt's Top Down Operator Precedence. The paper presents a parser for Simplified JavaScript that is written in Simplified Javascript. It is chapter 9 of Beautiful Code. This page loads that parser and runs the parser on itself.
This page loads three JavaScript files:
| tokens.js | This file installs the String.prototype.tokens method. It
produces an array of simple tokens from a string. |
| parse.js | This file installs the make_parse function which produces
the parse function. The indirection was done so that we could conveniently
recover the source of the function. |
| json2.js | This file installs the JSON.stringify method.
It is used to display the parse tree. |
The text that follows is the parse tree that the parser generated by parsing itself.