Introducing the Myna Parsing Library
Why another parsing library
I wrote Myna because I believed that:
- Code-generators (e.g. Jison, PEG.js, nearley, and ANTLR) are harder to work with than libraries or embedded DSLs (Domain Specific Languages)
Recursive Descent Parsers and Parsing Expression Grammars
A recursive descent parser is a parser that recognizes phrases in a grammar by trying to match the input to different grammar productions alternatives recursively until it succeeds, backtracking if a grammar production fails.
A Parsing Expression Grammar (PEG) is a formal way of expressing the grammar of a language that is based on string matching rather than string generation. Compared with other grammar forms like EBNF It allows grammars to have zero-length rules (assertions) and the order is strictly specified forcing it to be unambiguous.
As a result every PEG grammar can be easily apped to a recursive-descent parser.
This is my third open-source recursive-descent parsing library. My first was written in C++ and was called YARD. It was based on the idea of using templates to combine parsing rules defined as low-level types. It was inspired by the Boost.Spirit parser by Joel de Guzman and in turn inspired the PegTL by Colin Hirsch and Daniel Frey.
My second recursive-descent parsing library was the Jigsaw library written in C#.