Version0.9.2Verifiednot yet verifiedLicenseBSD-3-Clause
Readme
sigil-peg
PEG (Parsing Expression Grammar) library for Sigil. Represent patterns as S-expressions with a capture stack for structured output. Inspired by Janet's PEG module.
Usage
(import (sigil peg))
;; Match a literal string
(peg/match '(seq "hello" " " "world") "hello world")
; => #<peg-match 0..11 ()>
;; Capture matched text
(peg-match-captures (peg/match '(<- (* (char-set char-alphabetic?))) "hello"))
; => ("hello")
;; Define a grammar with named rules
(define-grammar csv
(main (* (seq 'field (? (seq "," 'field)) 'newline))
(field (<- (+ (! ",") (! "\n") any-char)))
(newline (/ "\n" (input-end))))Pattern Language
- Atomic:
"literal",#\char,'rule-ref,any-char,(char-range #\a #\z),(char-set char-alphabetic?) - Combinators:
(seq p ...),(/ p ...),(* p),(+ p),(? p),(! p),(& p),(to p),(thru p),(between min max p) - Captures:
(<- p),(<- p tag),(group p),(position),(constant val),(cmt p fn),(drop p),(backref tag),(replace p val) - Anchors:
(line-start),(line-end),(input-start),(input-end)
Dependencies
- sigil-stdlib
Build
sigil build
sigil testLicense
BSD-3-Clause
Clone
$ git clone https://codeberg.org/sigil/sigil-peg
Releases
v0.9.2 — latest by version, released 19 Jul 2026
All releases — 2 tags in this repository.
Source
One page per file, and every line has a permalink.
Recent commitsAtom
19 Julcommit
1 Aprcommit
1 Aprcommit
31 Marcommit
fbf504db
31 Marcommit
9a1bad07
1 Marcommit
6c62878b
25 Febcommit
22 Febcommit
43c8fefc
20 Febcommit
The last 20 commits keep a page here. Everything older lives in the clone.