# yhirose/cpp-peglib

A single file C++ header-only PEG (Parsing Expression Grammars) library

Repository: https://github.com/yhirose/cpp-peglib
Canonical: https://ross.abutalabs.com/products/cpp-peglib
Homepage: https://yhirose.github.io/cpp-peglib/
Language: C++
License: MIT
License Family: permissive
Topics: cpp, peg, parsing-expression-grammars, parsing, c-plus-plus, header-only, parser-generator, cpp17
Last push: 2026-08-18T03:57:09+00:00

## Health v2 (maintenance only)
Score: 98/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 98, release rhythm 98, longevity 100
- inputs: {"age_days": 4225, "days_push": 15, "days_rel": 15, "gap_med": 14, "n_releases_24m": 14}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1057, forks 128 (observed 2026-08-28T04:03:24.827327+00:00)

## What it is
A single-file, header-only C++17 library for Parsing Expression Grammars (PEG) with packrat parsing, left recursion support, and AST generation. It includes an online PEG Playground for trying grammars in the browser.

## Use cases
- parse a custom DSL in C++
- build a small programming language parser
- write a config file parser with a grammar
- parse structured text like logs or ini files
- generate an AST from a grammar
- prototype parser grammars online

## When to choose
- you need a lightweight, dependency-free parser in a C++17 project
- you want packrat parsing or left-recursive grammar support
- you prefer defining grammars as strings rather than code

## When to avoid
- you need a full lexer/parser generator with separate code generation steps
- you're not on a C++17-capable compiler
- you need extremely high throughput where hand-written parsers win

## Facets
- artifact type: library
- maturity: active
- function: parser, compiler
- domain: parsers, programming-languages, developer-tools
- platform: cpp, cross-platform, cli
- tags: header-only, peg, packrat-parsing, left-recursion, ast-generation, parser-combinator, cpp17

## Member repositories
- yhirose/cpp-peglib (main) score 98

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:03:24.827327+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T06:58:02.475891+00:00, confidence not recorded.
  - readme: https://github.com/yhirose/cpp-peglib (fetched 2026-08-28T04:03:24.827327+00:00, sha 262fe47588ce)
  - homepage: https://yhirose.github.io/cpp-peglib/ (fetched 2026-08-29T12:59:40.024307+00:00, sha 642112fd5910)
- Data as of 2026-08-30T08:39:29.467469+00:00.
