I’m pleased to announce yet another update to Neotoma. The major features and changes in this release:
- Transformation/semantic analysis code can be written inline with the PEG, enclosed in backticks (
`) before the concluding semi-colon for each reduction. The variables available to your code are
Node(the parse result, including transformed results of subtrees), and
Idx(the current index into the input).
- To do an identity transformation on a rule (i.e. pass along the result unchanged), use the tilde (
~) instead of backtick-quoted code.
- Extra functions for use inside your parser can be added to the end of the PEG, also enclosed in backticks (
- All internal uses of the process dictionary have been expunged and instead use the memoization table.
- All of the modules have been renamed and the parser re-bootstrapped. The most significant user-facing change is that
peg_genis now called
neotoma. See the commit for more details.
What is Neotoma?
Neotoma is a packrat parser-generator for Erlang for Parsing Expression Grammars (PEGs). It consists of a parser-combinator library with memoization routines, a parser for PEGs, and a utility to generate parsers from PEGs. It is inspired by treetop, a Ruby library with similar aims, and parsec, the parser-combinator library for Haskell.