A pretty shitty PEG parser written in TypeScript.
http://en.wikipedia.org/wiki/Parsing_expression_grammar
In Shitty PEG, there is no DSL for defining grammars. It's Just JavaScript™.
Because of this, you can write parsers which can be type-checked by TypeScript, or written in CoffeeScript or Purescript without any special plugins.
-
Support for common white-space and indentation significant grammars. Shitty PEG is white-space significant by default.
-
Stash and retrieve arbitrary data in context of the parsing "stack".
-
Easily define delimited lists.
-
Synchronous execution. No streams right now.
-
Not particularly fast.
npm install shitty-peg
var peg = require('shitty-peg');
peg.parse(peg.source('abc'), myParser);
function myParser(p) {
return p.many(/^[a-z]/);
}