The ParseLR toolkit is a GLR and LR(1) parser as well as a finite state machine generator for use with the C# language on the .NET platform. It can be used to convert a formal grammar into C# source code that can parse data conforming to that grammar. Alternatively it can be used as an inline parser with dynamically changing input grammars, to generate and regenerate parsers for a changing grammar at run-time. Another feature that differentiates this parser from the many other parser generators available is that it allows guard conditions to be associated with each input token. This enables the tool to be used for grammar-driven finite state machine construction.

Applications for this toolkit are broad, and include: language compilers; structured document scanners and interpreters; syntax highlighting and verification; workflow engines built from scenario descriptions; state machines described by a formal grammar.

The current documentation, source code for examples, and the downloadable toolkit are all available through this link.

History

ParseLR was developed so that a number of other software products developed or worked on at Ropley IT Ltd were not reliant on third party parser generators for C# and .NET, which at the time of starting development were thin on the ground.

No third-party parser source code was used while writing ParseLR, and no third party parser was used to bootstrap the parser either. A hand-crafted LL parser was written to parse the grammar for the first LR parser initially. When the resulting parser generator was passing all its unit tests, the LR parser was used to parse and extend its own grammar, and the LL parser was discarded.

It has been decided to share this parser generator, its documentation and its samples with the wider developer community. Anyone interested in using it may feel free to do so, in commercial products as well as non-commercial projects. However, please note the 'use at your own peril' warranty for this software on the download page. By downloading the software you are agreeing to the terms and conditions. Supported contracts for this toolkit are available, but the toolkit itself can be used unsupported for free. Please provide feedback, if you encounter any issues, to sdsmith@ropley.com and we will gladly look at it as other project commitments allow.

Please note that we are sharing binaries, DLLs and documentation for the toolkit for download. At the moment we do not have plans to share the source code, as modified versions of parts of it are used for other commercial products. If there is sufficient interest, and the support burden becomes a distraction, the whole toolkit, source code included, may well be published on a source sharing site for open source involvement in the project at a later date. As there are currently a number of other parser generators out there for .NET, the suspicion is that there would never be the demand to make this worthwhile.

Sean D Smith, 13 June 2012

[1] D. Pager, A Practical General Method for Constructing LR(k) Parsers, Acta Informatica 7 (3) (1977) 249 - 268