Dmitry Savenko

Software Engineer. Get in touch:

Project: PEG Parser

27 Jul 2011

PEG Fantom library is a Parsing expression grammar parser in Fantom with some unique features (see below).

The main resources about PEG:

Also some docs are available in the docs directory in the repository:

Special feature of this parser is that it allows to parse really big files, even if the file and/or the parsed tree wouldn’t fit into RAM.

Another feature is that it is incremental: you can parse a part of a text, then stop it and parse the rest of the text afterwards. It saves time in situations, when you’re getting the text slowly, because it allows to start parsing very early instead of waiting for the full text.

Meta grammar is not hardcoded and can be changed using the parser’s API (only PEG expressions are hardcoded). This means, that you can modify/extend the grammar relatively easily, without patching the parser itself.

As a pure Fantom library, it can be compiled into Java or JavaScript.

Examples