With Peasy, you write the parser by hand, just like to write any other kind of program. You need not play many balls like that any more., You just play one ball like so.
To use Peasy, just copy the module to your project, read it, modify it, write the grammar rules,, and remove any unnecessary
stuffs in Peasy, and parse with the grammar.
- classpeasy become modular Peasy, and becomes the default module peasy.js(peasy.coffee for coffeescript)
- original peasy.js(coffee) become nonmodularpeasy.js(coffee)
- document on modular Peasy
- document on nonmodular Peasy
The annotated peasy.coffee is best document for Peasy at the moment.
If you're a pythoner, maybe you'd like to see the annotated peasy.py.
See the tests in /test for samples of left recursive grammars and how to parse them.
See here for a sample grammar in Peasy.
For arithemetic expression, here is a sample:
The sample parser for a real language, here is [my translation from coffeescript's jison grammar:]
(https://github.com/chaosim/coffee-script/blob/master/src/parser.coffee)
and it's transcompiled from [this coffeescript source:]
(https://github.com/chaosim/coffee-script/blob/master/src/parser.coffee)
The original grammar.coffee, [from which lib/coffeescript/parser.js is generated:]
(https://github.com/jashkenas/coffee-script/blob/master/src/grammar.coffee)
the project's repository is on github https://github.com/chaosim/peasy.
Peasy uses the nodeunit test framework, see the folder "test"
To report or search for bugs, please goto https://github.com/chaosim/peasy/issues, or email to [email protected]
peasy is developed and tested on Windows 7, node.js 0.10.0, coffeescript 1.6.2.
MIT: see LICENSE