macOS
brew install peglocal Homebrew formula metadata
sudo port install pegMacPorts ports tree · devel/peg/Portfile · source: api.github.com
brew
Program to perform pattern matching on text. Version 0.1.19 via Homebrew; verified 2026-06-14.
install
brew install peglocal Homebrew formula metadata
sudo port install pegMacPorts ports tree · devel/peg/Portfile · source: api.github.com
sudo apk add pegAlpine Linux edge package indexes · peg · source: dl-cdn.alpinelinux.org
sudo apt install pegDebian stable package indexes · peg · source: deb.debian.org
nix profile install nixpkgs#pegnixpkgs package indexes · pkgs/by-name/pe/peg/package.nix · source: api.github.com
sudo pacman -S pegArch Linux sync databases · peg · source: geo.mirror.pkgbuild.com
sudo zypper install pegopenSUSE Tumbleweed package metadata · peg · source: download.opensuse.org
overview
Program to perform pattern matching on text
history
peg and leg are recursive-descent parser generators for C. They process Parsing Expression Grammars and generate C parsers, with `peg` following Bryan Ford's original PEG syntax and `leg` using conventions intended as an alternative to lex and yacc.
Ian Piumarta's official page lists peg/leg as tools for generating recursive-descent parsers from Parsing Expression Grammars. The first public release in the official version history is 0.1.1 on 2007-05-15.
The manual page explains that peg reads grammar files or standard input and generates C source defining `yyparse()`, while leg uses a syntax intended to make it attractive to users familiar with lex and yacc workflows.
The official version history shows steady maintenance through 0.1.19 stable in 2023, including reentrant parsing support, error actions, UTF-8 fixes, C++ support improvements, and Windows/Mac build files.
peg/leg spread through Unix-like package managers as a small C parser-generation tool: the input metadata lists Homebrew, Debian, Ubuntu, Arch, MacPorts, Nix, Alpine, and openSUSE package names.
Its niche is smaller than yacc-family tools, but it remains useful where a project wants PEG-style ordered choice, unlimited backtracking, and combined scanning and parsing in generated C.
Typical use is to run `peg` or `leg` over a grammar file and compile or include the generated C source in a client program.
The official manual documents options such as `-o` for output file selection, `-P` for suppressing `#line` directives, `-v` for verbose mode, and `-V` for version output.
peg/leg is package-manager-friendly because it is a compact C command-line tool with a stable manual page, source tarballs, and a long version history.
For package nerds it is also a useful contrast with lex/yacc: a small PEG-based generator that produces embeddable C parsers without requiring a larger parser framework.
security posture
narrow executable package without higher-risk signals.
green risk · low confidence · appliance
Before unattended agent use, check whether the tool reads plaintext credentials, writes remote state, publishes artifacts, or shells out to plugins.
executables
| Command | Kind | Exposure | Note |
|---|---|---|---|
leg | cli | global executable | |
peg | cli | global executable |
freshness
These signals separate page generation age, package-manager activity, and upstream release comparison. Version lag is warned only when an evidence URL and comparable versions are present.
https://www.piumarta.com/software/peg/
install metadata
| Package key | brew:peg |
|---|---|
| Version | 0.1.19 |
| Package manager | Homebrew |
| Package manager page | https://formulae.brew.sh/formula/peg |
| Homepage | https://www.piumarta.com/software/peg/ |
| Upstream docs | https://www.piumarta.com/software/peg |
| License | MIT |
| Source archive | https://www.piumarta.com/software/peg/peg-0.1.19.tar.gz |
| Last updated | 2026-06-14T14:47:59+02:00 |
| Pulse | updated |
| Bottle | available (on arm64_linux, arm64_monterey, arm64_sequoia, arm64_sonoma, arm64_tahoe, arm64_ventura, monterey, sonoma, ventura, x86_64_linux) |
| Homebrew post-install | not defined |
| Service | none declared |
registry facts
| Source Database | Homebrew formula API |
|---|---|
| Tap | homebrew/core |
| Full Name | peg |
| Aliases |
|
| Version Scheme | 0 |
| Revision | 0 |
| Bottle Stable Root URL | https://ghcr.io/v2/homebrew/core |
| Deprecated | no |
| Disabled | no |
| Keg Only | no |
| URL Keys |
|
source database matches
Matches are pulled from external package-manager indexes and kept separate from local Automic Vault package links.
peg 0.1.20+really0.1.18-1
recursive-descent parser generators for C
https://piumarta.com/software/peg/
sudo apt install pegpeg
nix profile install nixpkgs#pegpeg 0.1.18-1build1
recursive-descent parser generators for C
http://piumarta.com/software/peg/
sudo apt install pegpeg 0.1.18-r1
Recursive-descent parser generators for C
https://www.piumarta.com/software/peg/
sudo apk add pegpeg-doc 0.1.18-r1
Recursive-descent parser generators for C (documentation)
https://www.piumarta.com/software/peg/
sudo apk add peg-docpeg 0.1.19-1
recursive-descent parser generators for C
http://piumarta.com/software/peg/
sudo pacman -S pegpeg 0.1.20-1.7
Recursive-Descent parser generators for C
https://piumarta.com/software/peg/
sudo zypper install pegpeg
sudo port install pegsource trail
This page is generated by av-web from the private package SQLite artifact built by scripts/generate-pkg-sqlite.py.
View the package source record on GitHub.