typed-peg: Type-safe PEG parser combinators

[ bsd3, library, parsing ] [ Propose Tags ] [ Report a vulnerability ]

A library for building PEG (Parsing Expression Grammar) parsers with compile-time safety guarantees. Grammar non-terminals are indexed by their nullability and FIRST sets at the type level, making left-recursive grammars a type error. . A quasi-quoter (PEG.QQ) allows writing grammars in a concrete DSL syntax. Indentation-sensitive parsing is supported natively via PEG.Indent.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0
Change log CHANGELOG.md
Dependencies base (>=4.18 && <5), template-haskell (>=2.19 && <2.22) [details]
Tested with ghc ==9.6.7
License BSD-3-Clause
Author Rodrigo Ribeiro
Maintainer rodrigo.ribeiro@ufop.edu.br
Uploaded by rribeiro at 2026-09-01T18:29:21Z
Category Parsing
Home page https://github.com/rodrigogribeiro/typed-peg
Bug tracker https://github.com/rodrigogribeiro/typed-peg/issues
Source repo head: git clone https://github.com/rodrigogribeiro/typed-peg
Distributions
Downloads 3 total (3 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2026-09-01 [all 1 reports]

Readme for typed-peg-0.1.0.0

[back to package description]

typed-peg

Type-safe PEG (Parsing Expression Grammar) parser combinators for Haskell.

Grammar non-terminals are indexed at the type level by their nullability and FIRST sets, so left-recursive grammars are caught at compile time rather than looping at runtime.

Features

  • Type-level FIRST-set and nullability tracking
  • Compile-time left-recursion detection (type error)
  • Indentation-sensitive parsing (PEG.Indent)
  • Quasi-quoter for concrete grammar syntax (PEG.QQ)

Quick start

import PEG

-- Define a grammar using the quasi-quoter
-- See examples/Arith.hs for a complete arithmetic expression parser

Building

cabal build

Examples

cabal test typed-peg-examples

License

BSD-3-Clause. See LICENSE.