Skip to content
Erlang library and packrat parser-generator for parsing expression grammars.
Erlang Makefile
Latest commit 9e57d8e Apr 7, 2016 Sean Cribbs Bump to 1.7.4
Failed to load latest commit information.
extra bugfix + test for unicode support Aug 18, 2014
priv review tweaks Aug 18, 2014
src Bump to 1.7.4 Apr 7, 2016
test use unicode code points instead of hardcoding utf8 chars in parser_test Aug 19, 2014
.gitignore Add hex.pm support and publish. Jul 30, 2015
.travis.yml
LICENSE Add MIT license. Jun 10, 2009
Makefile Fix a dialyzer warning in generated code and add xref target to makefile Feb 18, 2014
README.textile Add travis-ci build status widget Jun 23, 2015
rebar Add a recent rebar and update the Makefile for dialyzer. Jan 1, 2014
rebar.config Add hex.pm support and publish. Jul 30, 2015

README.textile

Neotoma

About

Neotoma is a packrat parser-generator for Erlang for Parsing Expression Grammars (PEGs).
It consists of a parsing-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.

Neotoma is licensed under the MIT License (see LICENSE).

Features

  1. Simple, declarative parsers generated from even simpler grammars.
  2. Fully integrated, single-pass lexical and syntactic analysis (a feature of PEGs).
  3. Packrat-style memoization, boasting parse-time bound linearly to the input size (at the expense of memory usage).
  4. In-place semantic analysis/transformation, supporting single-pass end-to-end in some applications.
  5. Erlang code-generation for the lexical/syntactic analysis piece, with the option of semantic analysis/transformation inline, or in a separate module.
  6. Line/column number tracking for easy resolution of parsing errors.

Installation

  1. Clone the repository from github:
    $ git clone git://github.com/seancribbs/neotoma.git
  2. Symlink or copy the cloned repository to somewhere in your Erlang code path. $ERLANG_HOME/lib is best.
  3. Build the source:
    $ make

Usage

  1. After making sure the library is in your code path, fire up an Erlang shell.
  2. To generate a parser from a PEG, use neotoma:file/1,2 (more detailed documentation pending). For PEG examples, see the extra/ directory in the repository.
1> neotoma:file("extra/arithmetic.peg").
This will place arithmetic.erl in the same directory as the .peg file by default.

Contributing

Please send pull-requests to ‘seancribbs’ on github. When submitting a patch, eunit tests are strongly encouraged.

Something went wrong with that request. Please try again.