This repository has been archived by the owner. It is now read-only.
🐏 a recursive-descent parser generator for PEG
C GAP Other
Switch branches/tags
Nothing to show
Clone or download
#27 Compare This branch is 70 commits ahead of whymirror:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.


greg used to be _why's fork of Ian Piumarta's peg/leg, with the following differences:

  • Re-entrant
  • Some bug fixes

Since then, better error handling and other various features have been added.


The most comprehensive example of greg usage is in nagaqueen, an ooc grammar, used in rock, an ooc compiler written in ooc.

Build instructions

With a GCC-like compiler, make should give you a greg executable.

If you modify greg.g (greg's own grammar is written in LEG), run make grammar to regenerate greg.c using greg itself, then run make again to build it.

Contributor guidelines

  • GitHub pull requests are the preferred way to submit contributions.
  • Don't modify greg.c, instead, modify greg.g and regenerate it as shown above.
  • Make sure greg is still self-hosting before you submit your code.
  • Major changes warrant a version bump, but they also warrant discussions.

For a list of contributors, see the GitHub contributor graph.


peg/leg is copyright (c) 2007 by Ian Piumarta released under an MIT license. As is greg.