# peg を Homebrew, apk, apt, MacPorts, Nix, pacman, zypper でインストール

peg のインストール経路、実行ファイル、メタデータ、AI エージェント向けセキュリティノートを確認します。

## インストール

```sh
sudo av install brew:peg
```

追加のインストールコマンド:

### macOS

- Homebrew (100%):

```sh
brew install peg
```

  証拠: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install peg
```

  証拠: MacPorts ports tree: devel/peg/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1

### Linux

- apk (92%):

```sh
sudo apk add peg
```

  証拠: Alpine Linux edge package indexes: peg from https://dl-cdn.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz

- Debian apt (92%):

```sh
sudo apt install peg
```

  証拠: Debian stable package indexes: peg from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz

- Nix (92%):

```sh
nix profile install nixpkgs#peg
```

  証拠: nixpkgs package indexes: pkgs/by-name/pe/peg/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1

- pacman (92%):

```sh
sudo pacman -S peg
```

  証拠: Arch Linux sync databases: peg from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz

- zypper (92%):

```sh
sudo zypper install peg
```

  証拠: openSUSE Tumbleweed package metadata: peg from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst

## パッケージ情報

- **パッケージキー:** brew:peg
- **パッケージマネージャ:** Homebrew
- **バージョン:** 0.1.19
- **ソース概要:** Program to perform pattern matching on text
- **ホームページ:** <https://www.piumarta.com/software/peg/>
- **最終更新:** 2026-06-14T14:47:59+02:00
- **生成日時:** 2026-08-03T19:37:03+00:00

## 実行可能ファイル

- leg (エイリアス)
- peg (エイリアス)

## インストール挙動

- Bottle: 利用不可

## バージョンと鮮度

- ページ生成日: 2026-08-03
- マネージャ版: 0.1.19
## プロジェクトの歴史と使われ方

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.

### タイムライン

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

### ソース

- <https://www.piumarta.com/software/peg>
- <https://www.piumarta.com/software/peg/peg.1.html>
- source_facts.package-manager


## セキュリティノート

narrow executable package without higher-risk signals.

- **Geiger リスク:** グリーン / 低
- narrow executable package without higher-risk signals

## 他のパッケージマネージャ記録

- Debian apt - peg - 0.1.20+really0.1.18-1: normalized package name match | Debian stable package indexes: peg from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | recursive-descent parser generators for C | https://piumarta.com/software/peg/
- Nix - peg: normalized package name match | nixpkgs package indexes: pkgs/by-name/pe/peg/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- Ubuntu apt - peg - 0.1.18-1build1: normalized package name match | Ubuntu 24.04 LTS package indexes: peg from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | recursive-descent parser generators for C | http://piumarta.com/software/peg/
- apk - peg - 0.1.18-r1: normalized package name match | Alpine Linux edge package indexes: peg from https://dl-cdn.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz | Recursive-descent parser generators for C | https://www.piumarta.com/software/peg/
- apk - peg-doc - 0.1.18-r1: normalized package name match | Alpine Linux edge package indexes: peg-doc from https://dl-cdn.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz | Recursive-descent parser generators for C (documentation) | https://www.piumarta.com/software/peg/
- pacman - peg - 0.1.19-1: normalized package name match | Arch Linux sync databases: peg from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz | recursive-descent parser generators for C | http://piumarta.com/software/peg/
- zypper - peg - 0.1.20-1.9: normalized package name match | openSUSE Tumbleweed package metadata: peg from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | Recursive-Descent parser generators for C | https://piumarta.com/software/peg/
- MacPorts - peg: normalized package name match | MacPorts ports tree: devel/peg/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1


## Combined YAML source

View the package source record on GitHub. [combined/peg.yml](https://github.com/mxcl/pkgdb/blob/main/combined/peg.yml)


## ソース

- pkg.so package database
- Geiger risk classifier
- curated package history
- pkgdb category and tag curation
- external package-manager database matches
- cross-ecosystem install command graph
