peg
« Back to VersTracker
Description:
Program to perform pattern matching on text
Type: Formula  |  Tracked Since: Dec 28, 2025
Links: Homepage  |  formulae.brew.sh
Category: Developer tools
Tags: parser-generator peg compiler-tools development parsing
Install: brew install peg
About:
Peg is a parser generator that constructs recursive descent parsers from Parsing Expression Grammar (PEG) specifications. It provides a robust alternative to traditional parser generators like Yacc or Bison, offering unambiguous grammar definitions and straightforward grammar composition. The tool is particularly valuable for creating parsers for configuration files, domain-specific languages, and data serialization formats.
Key Features:
  • Generates efficient C-based parsers from PEG grammars
  • Supports direct left-recursion and ordered choice for unambiguous parsing
  • Produces human-readable C code that's easy to debug and extend
  • Handles complex grammar features with simple, clean syntax
Use Cases:
  • Building parsers for custom configuration file formats
  • Implementing domain-specific languages (DSLs) for applications
  • Parsing and processing structured text data
  • Creating language translators or interpreters
Alternatives:
  • ANTLR – More feature-rich but generates Java-based parsers with larger runtime dependencies
  • Bison/Yacc – LALR parser generators requiring more complex grammar specifications and lookahead management
  • tree-sitter – Focuses on incremental parsing for syntax highlighting, less suitable for standalone parsers
Version History
Detected Version Rev Change Commit
Sep 11, 2025 8:30am 0 VERSION_BUMP 7eadb6e3