Automic VaultAutomic Vault

brew

Install peg with Homebrew, apk, apt, MacPorts, Nix, pacman, zypper

Program to perform pattern matching on text. Version 0.1.19 via Homebrew; verified 2026-06-14.

install

Additional install commands

macOS

Homebrewverified · 100%
brew install peg

local Homebrew formula metadata

MacPortsverified · 94%
sudo port install peg

MacPorts ports tree · devel/peg/Portfile · source: api.github.com

Linux

Alpine Linux apkverified · 92%
sudo apk add peg

Alpine Linux edge package indexes · peg · source: dl-cdn.alpinelinux.org

Debian aptverified · 92%
sudo apt install peg

Debian stable package indexes · peg · source: deb.debian.org

Nixverified · 92%
nix profile install nixpkgs#peg

nixpkgs package indexes · pkgs/by-name/pe/peg/package.nix · source: api.github.com

Arch Linux pacmanverified · 92%
sudo pacman -S peg

Arch Linux sync databases · peg · source: geo.mirror.pkgbuild.com

openSUSE zypperverified · 92%
sudo zypper install peg

openSUSE Tumbleweed package metadata · peg · source: download.opensuse.org

overview

Package summary

Program to perform pattern matching on text

Commands and aliases

  • leg
  • peg

history

Project history and usage

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.

Project history

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.

Adoption history

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.

How it is used

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.

Why package nerds care

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.

Timeline

  • 2007-05-15: First public release, 0.1.1.
  • 2013-06-03: 0.1.11 added error actions, C++ support improvements, and Win32/Mac build files.
  • 2016-07-22: 0.1.18 added the `-P` option to disable `#line` directives.
  • 2023-03-06: 0.1.19 stable added experimental re-entrant parsing through `yyparsefrom_r()`.
  • 2023-11-19: 0.1.20 development version listed with experimental inline-action variables and semantic values.

Related projects

  • Bryan Ford's 2004 Parsing Expression Grammars paper is the formal grammar reference cited by the official page.
  • lex and yacc are the comparison point used by the official page and manual.

security posture

Risk level: green

narrow executable package without higher-risk signals.

Risk classifier

green risk · low confidence · appliance

Why

  • narrow executable package without higher-risk signals

Signals

  • metadata:no-higher-risk-signals

Install behavior

  • No Homebrew post-install hook is recorded in formula metadata.
  • Homebrew bottle metadata is available for 10 platform targets.

Recommended review

Before unattended agent use, check whether the tool reads plaintext credentials, writes remote state, publishes artifacts, or shells out to plugins.

executables

Installed executables

CommandKindExposureNote
legcliglobal executable
pegcliglobal executable

freshness

Version and 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.

page generated2026-07-08
manager version0.1.19
manager updated2026-06-14
local dataok
upstreamnot checked
latest detectednot detected

https://www.piumarta.com/software/peg/

install metadata

Package metadata

Package keybrew:peg
Version0.1.19
Package managerHomebrew
Package manager pagehttps://formulae.brew.sh/formula/peg
Homepagehttps://www.piumarta.com/software/peg/
Upstream docshttps://www.piumarta.com/software/peg
LicenseMIT
Source archivehttps://www.piumarta.com/software/peg/peg-0.1.19.tar.gz
Last updated2026-06-14T14:47:59+02:00
Pulseupdated
Bottleavailable (on arm64_linux, arm64_monterey, arm64_sequoia, arm64_sonoma, arm64_tahoe, arm64_ventura, monterey, sonoma, ventura, x86_64_linux)
Homebrew post-installnot defined
Servicenone declared

registry facts

Source database details

Source DatabaseHomebrew formula API
Taphomebrew/core
Full Namepeg
Aliases
  • leg
Version Scheme0
Revision0
Bottle Stable Root URLhttps://ghcr.io/v2/homebrew/core
Deprecatedno
Disabledno
Keg Onlyno
URL Keys
  • stable

source database matches

Other package-manager records

Matches are pulled from external package-manager indexes and kept separate from local Automic Vault package links.

Debian apt95%

peg 0.1.20+really0.1.18-1

recursive-descent parser generators for C

https://piumarta.com/software/peg/

sudo apt install peg
  • Section: devel
  • Architecture: amd64
  • 1 dependencies
  • normalized package name match
  • Matched by: Peg
Debian stable package indexes · deb.debian.org · Debian stable package indexes: peg from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz
Nix95%

peg

nix profile install nixpkgs#peg
  • normalized package name match
  • Matched by: Peg
nixpkgs package indexes · api.github.com · nixpkgs package indexes: pkgs/by-name/pe/peg/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
Ubuntu apt95%

peg 0.1.18-1build1

recursive-descent parser generators for C

http://piumarta.com/software/peg/

sudo apt install peg
  • Section: universe/devel
  • Architecture: amd64
  • 1 dependencies
  • normalized package name match
  • Matched by: Peg
Ubuntu 24.04 LTS package indexes · archive.ubuntu.com · Ubuntu 24.04 LTS package indexes: peg from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz
apk95%

peg 0.1.18-r1

Recursive-descent parser generators for C

https://www.piumarta.com/software/peg/

sudo apk add peg
  • License: MIT
  • Architecture: x86_64
  • Source Package: peg
  • 1 dependencies
  • 1 provides
  • normalized package name match
  • Matched by: Peg
Alpine Linux edge package indexes · dl-cdn.alpinelinux.org · Alpine Linux edge package indexes: peg from https://dl-cdn.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz
apk95%

peg-doc 0.1.18-r1

Recursive-descent parser generators for C (documentation)

https://www.piumarta.com/software/peg/

sudo apk add peg-doc
  • License: MIT
  • Architecture: x86_64
  • Source Package: peg
  • normalized package name match
  • Matched by: Peg
Alpine Linux edge package indexes · dl-cdn.alpinelinux.org · Alpine Linux edge package indexes: peg-doc from https://dl-cdn.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz
pacman95%

peg 0.1.19-1

recursive-descent parser generators for C

http://piumarta.com/software/peg/

sudo pacman -S peg
  • License: MIT
  • Architecture: x86_64
  • normalized package name match
  • Matched by: Peg
Arch Linux sync databases · geo.mirror.pkgbuild.com · Arch Linux sync databases: peg from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz
zypper95%

peg 0.1.20-1.7

Recursive-Descent parser generators for C

https://piumarta.com/software/peg/

sudo zypper install peg
  • License: MIT
  • Category: Development/Tools/Building
  • Architecture: x86_64
  • Source Package: peg
  • 1 dependencies
  • 1 provides
  • normalized package name match
  • Matched by: Peg
openSUSE Tumbleweed package metadata · download.opensuse.org · openSUSE Tumbleweed package metadata: peg from https://download.opensuse.org/tumbleweed/repo/oss/repodata/be8d3611d25469107f32075a1697e69ec57a2b850b42348a658cc671ad5ec2b50760d02c3e59524d50da9a11d5be799bdaffba2e166e8ca8858512e3c0bd665d-primary.xml.zst
MacPorts95%

peg

sudo port install peg
  • normalized package name match
  • Matched by: Peg
MacPorts ports tree · api.github.com · MacPorts ports tree: devel/peg/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1

source trail

Generated from repository data

This page is generated by av-web from the private package SQLite artifact built by scripts/generate-pkg-sqlite.py.

Used sources

  • Geiger risk classifier
  • Nucleus package database
  • av.db category and tag curation
  • cross-ecosystem install command graph
  • curated package history
  • external package-manager database matches
  • package relationship graph
  • package version freshness
  • package-page enrichment