Features:- Parse, validate, and serialize, with a round-trip invariant
(parse -> to_sdp -> re-parse yields the same document) - Errors are values, never raised. Every finding carries a stable check ID, a severity, and a verbatim citation of the SHALL / SHALL-NOT clause it enforces
- Per-check severity policy (warn / error / off) so consumers can relax or tighten individual rules without forking
- JSON round-trip via dkjson
- A small CLI shipped as parse_sdp: validate / diagnose / to_json / to_sdp / checks (registry inspection)
The grammar is composed from three LPeg modules (base, st2110, ipmx)
where each tier overlays per-rule overrides onto the previous one via a small base.extend() mechanism, so the RFC 8866 grammar stays the single source of truth and tier-specific narrowings live next to the clauses that are their source.
Strictness is the main goal, but there are options: a check exists only when the
referenced spec contains explicit normative text (a "shall", "shall
not", or a defined value set for an optional field). Anything out of scope from the spec should pass. Each check's source comment quotes the clause, so the reasoning is auditable.
Install:
luarocks install parse_sdp
Source, guide, and runnable examples:
https://github.com/andrewstarks/parse_sdpFeedback, bug reports, and citations of clauses I have misread are all
welcome.
I made this because I work in the IPMX and ST 2110 standards world and after learning about SDP files, I've had it on my list to try to make an LPeg parser for SDP files. I actually had a lot of fun re-learning LPeg through Claude and going a lot further with it than I ever did back in the day.
AI note: I used Claude Code while developing this. I worked hard to make something that's maintainable and high quality and intend to make fixes to it over time. But if AI assisted / vibe coding is a hang up, you might want to take a pass on this.
- Andy