Andrey Shchekin Andrey Shchekin - 2 months ago 9
Javascript Question

Is there a framework for defining parsers in JavaScript?

Is there a JavaScript framework that allows to define a parsing grammar using JavaScript syntax, similar to the way Irony does it for C#?

Answer Source

I don't know much about how Irony works, but Chris Double has a library that lets you define grammars in JavaScript here: http://www.bluishcoder.co.nz/2007/10/javascript-parser-combinators.html. The code is available on GitHub.

It's a "parser combinator" library which means you combine parsers for each production in your grammar into a larger parser that parses the whole thing. Each "sub-grammar" is a just a function that you create by calling the library functions.