Peggy

A simple parser generator that produces fast parsers with excellent error r...

README

Peggy


Peggy is a simple parser generator for JavaScript that produces fast parsers
with excellent error reporting. You can use it to process complex data or
computer languages and build transformers, interpreters, compilers and other
tools easily.

Peggy is the successor of PEG.js.

Migrating from PEG.js


Peggy version 1.x.x is API compatible with the most recent PEG.js release.
Follow these steps to upgrade:

1. Uninstall pegjs (and @types/pegjs if you're using the DefinitelyTyped type definitions - we now include type definitions as part of peggy itself).
2. Replace all require("pegjs") or import ... from "pegjs" with require("peggy") or import ... from "peggy" as appropriate.
3. Any scripts that use the pegjs cli should now use peggy instead.
4. That's it!

Features


- Simple and expressive grammar syntax
- Integrates both lexical and syntactical analysis
- Parsers have excellent error reporting out of the box
- Based on [parsing expression
  grammar](http://en.wikipedia.org/wiki/Parsing_expression_grammar) formalism
  — more powerful than traditional LL(_k_) and LR(_k_) parsers
- Usable from your browser, from the command line,
  or via JavaScript API
- Source map support

Getting Started


Online version is the easiest way to generate a
parser. Just enter your grammar, try parsing few inputs, and download generated
parser code.

Documentation


Full documentation is available at peggyjs.org.

Development


To get started, check out peggy, install the dependencies, and run build:

  1. ```bash
  2. git clone https://github.com/peggyjs/peggy.git
  3. cd peggy
  4. npm install
  5. (cd docs && npm install)
  6. (cd web-test && npm install)
  7. npm run build
  8. npm run test:web
  9. ```

Please see the Contribution Guidelines for details on how
to contribute code.

Links



Peggy was originally developed by David Majda
(@dmajda). It is currently maintained by

You are welcome to contribute code. Unless your contribution is really trivial
first — this can prevent wasted effort on both sides.