peg - Import of Ian Piumarta's peg/leg recursive-descent parser generators for C

  •        116

peg and leg are tools for generating recursive-descent parsers: programs that perform pattern matching on text. They processes a Parsing Expression Grammar (PEG)[Ford 2004] to produce a program that recognises legal sentences of that grammar. peg processes PEGs written using the original syntax described by Ford.



Related Projects

peg - Peg, Parsing Expression Grammar, is an implementation of a Packrat parser generator.

  •    Go

Peg, Parsing Expression Grammar, is an implementation of a Packrat parser generator. A Packrat parser is a descent recursive parser capable of backtracking. The generated parser searches for the correct parsing of the input.

rust-peg - Parsing Expression Grammar (PEG) parser generator for Rust

  •    Rust

This is a simple parser generator based on Parsing Expression Grammars. Please see the release notes for updates.

PEGTL - Parsing Expression Grammar Template Library

  •    C++

The Parsing Expression Grammar Template Library (PEGTL) is a zero-dependency C++ header-only parser combinator library for creating parsers according to a Parsing Expression Grammar (PEG). Grammars are written as regular C++ code, created with template programming (not template meta programming), i.e. nested template instantiations that naturally correspond to the inductive definition of PEGs (and other parser-combinator approaches).

pigeon - Command pigeon generates parsers in Go from a PEG grammar.

  •    Go

The pigeon command generates parsers based on a parsing expression grammar (PEG). Its grammar and syntax is inspired by the PEG.js project, while the implementation is loosely based on the parsing expression grammar for C# 3.0 article. It parses Unicode text encoded in UTF-8. See the godoc page for detailed usage. Also have a look at the Pigeon Wiki for additional information about Pigeon and PEG in general.

language - A fast PEG parser written in JavaScript with first class errors

  •    Objective-J

Language.js is an experimental new parser based on PEG (Parsing Expression Grammar), with the special addition of the "naughty OR" operator to handle errors in a unique new way. It makes use of memoization to achieve linear time parsing speed, and support for automatic cut placement is coming to maintain mostly constant space as well (for a discussion of cut operators see: The most unique addition Language.js makes to PEG is how it handles errors. No parse ever fails in Language.js, instead SyntaxErrorNodes are placed into the resultant tree. This makes it trivial to do things like write syntax highlighters that have live error reporting. This also means that Language.js is very competent at handling multiple errors (as opposed to aborting on the first one that is reached).

tinyexpr - tiny recursive descent expression parser, compiler, and evaluation engine for math expressions

  •    C

TinyExpr is a very small recursive descent parser and evaluation engine for math expressions. It's handy when you want to add the ability to evaluation math expressions at runtime without adding a bunch of cruft to you project. In addition to the standard math operators and precedence, TinyExpr also supports the standard C math functions and runtime binding of variables.

parboiled2 - A macro-based PEG parser generator for Scala 2.10+

  •    Scala

parboiled2 is a Scala 2.11+ library enabling lightweight and easy-to-use, yet powerful, fast and elegant parsing of arbitrary input text. It implements a macro-based parser generator for Parsing Expression Grammars (PEGs), which runs at compile time and translates a grammar rule definition (written in an internal Scala DSL) into corresponding JVM bytecode.PEGs are an alternative to Context-Free Grammars (CFGs) for formally specifying syntax, they make a good replacement for regular expressions and have some advantages over the "traditional" way of building parsers via CFGs (like not needing a separate lexer/scanner phase).


  •    CSharp

OILexer is a LL parser generator for C# aimed at simple language parsing for language enthusiasts. Does not use recursive descent or bottom-up parsing methods, but rather, a top-down deterministic model is employed. This is a portion of the Abstraction Project.

parsimonious - The fastest pure-Python PEG parser I can muster

  •    Python

Parsimonious aims to be the fastest arbitrary-lookahead parser written in pure Python—and the most usable. It's based on parsing expression grammars (PEGs), which means you feed it a simplified sort of EBNF notation. Parsimonious was designed to undergird a MediaWiki parser that wouldn't take 5 seconds or a GB of RAM to do one page, but it's applicable to all sorts of languages. You can have forward references and even right recursion; it's all taken care of by the grammar compiler. The first rule is taken to be the default start symbol, but you can override that.

neotoma - Erlang library and packrat parser-generator for parsing expression grammars.

  •    Erlang

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

JetPAG: Jet Parser Auto-Generator

  •    C++

JetPAG is a recursive-descent parser and lexical analyzer generator focused on high efficiency, usability and readability of generated code. JetPAG generates fast recognizers and aids developers with useful tools for simplifying input interpretation.

Pegged - A Parsing Expression Grammar (PEG) module, using the D programming language.

  •    D

Pegged is a parsing expression grammar (PEG) generator implemented in the D programming language. The idea is to give the generator a PEG, with the syntax presented in the reference article . From this grammar definition a set of related parsers will be created, to be used at runtime or compile time.

Visual Studio 2005 Addin for Coco/R


Coco/R is a compiler generator, which takes an attributed grammar of a source language and generates a scanner and a parser for this language. The scanner works as a deterministic finite automaton. The parser uses recursive descent. LL(1) conflicts can be resolved by a multi-s...

The Spirit Parser Library

  •    C++

Spirit is an object oriented recursive descent parser generator framework implemented using template meta-programming techniques.

Common Text Transformation Library

  •    C++

Common Text Transformation Library of C++ classes and functions to parse and modify STL strings. CTTL substring classes may be compared, inserted, replaced, and parsed with EBNF grammars. Compiled program implements recursive descent LL(INF) parser.

pegjs - PEG.js: Parser generator for JavaScript

  •    Javascript

PEG.js 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.Online version is the easiest way to generate a parser. Just enter your grammar, try parsing few inputs, and download generated parser code.

JSONStream - rawStream.pipe(JSONStream.parse()).pipe(streamOfObjects)

  •    Javascript

The .. operator is the recursive descent operator from JSONPath, which will match a child at any depth (see examples below).If your keys have keys that include . or * etc, use an array instead. ['row', true, /^doc/].


  •    C++

Scannerless recursive descent C++ parser generator

canopy - A parser compiler for Java, JavaScript, Python, Ruby

  •    Javascript

Canopy is a parser compiler targeting Java, JavaScript, Python and Ruby. It takes a file describing a parsing expression grammar and compiles it into a parser module in the target language. The generated parsers have no runtime dependency on Canopy itself. For usage documentation see

Madness - Recursive Descent Into Madness

  •    Swift

Your parsers can produce your own model objects directly, making Madness ideal for experimenting with grammars, for example in a playground. See Madness.playground for some examples of parsing with Madness.