Skip to content

peggyjs/peggy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

7361913 · Jul 8, 2022
Jul 7, 2022
Jun 9, 2021
Jul 1, 2022
Jul 8, 2022
Jun 20, 2022
Jun 23, 2022
May 28, 2021
Jul 1, 2022
Oct 20, 2021
Jun 1, 2022
Oct 20, 2021
Apr 13, 2021
May 27, 2022
Jun 9, 2021
Jul 6, 2022
May 27, 2022
Jun 24, 2022
Jul 1, 2022
Apr 14, 2021
May 28, 2022
May 29, 2022
May 21, 2022
Jun 11, 2022
Jun 11, 2022
May 31, 2022
Aug 12, 2021

Repository files navigation

Tests npm version License

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 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

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

You are welcome to contribute code. Unless your contribution is really trivial you should get in touch with us first — this can prevent wasted effort on both sides.