rd-parse

Generic minimalist recursive descent parser. Define your grammar in pure Javascript.

npm install rd-parse
4 downloads in the last week
9 downloads in the last month

rd-parse

A generic minimalist recursive-descent parser in Javascript. Originally inspired by Oleg Andreev's blog post and code

rd-parse allows you to define your grammar directly in Javascript in a very expressive human readable fashion. Check out an example. It should be pretty much self-explanatory.

npm install rd-parse

The parser produces a linked list of token nodes, tagging start, end, and optionally the original text content corresponding to the matched rules that you wrapped in a Capture directive when defining your grammar.

node.name will contain a tag name, and node.value - the original text content, unless (as a convention) the tag.name starts with '@', in which case node.value is undefined.

Thus, the parser just does the dirty job of recursively checking your syntax and outputting a token stream that can be processed further in a semantic context of your grammar in a more or less linear fashion.

npm loves you