$ show zesterer/chumsky
Chumsky is a Rust parser-combinator library rather than a standalone application. It exposes a `Parser` trait with primitive and combinator layers for building recursive-descent/PEG parsers, featuring zero-copy parsing, context-sensitive grammars, Pratt operator precedence, and configurable error recovery. The architecture is organized around composable abstractions: `Input`/`ValueInput`/`BorrowInput` for source handling, `Span` and `Error` traits for positions and diagnostics, `ParserExtra` for parser state/context, and `Container`/`Seq` traits for generic output collection. The main entry points are the public API in `src/lib.rs` and modules such as `primitive`, `combinator`, `text`, `stream`, `recursive`, `recovery`, `pratt`, and `debug`; included examples demonstrate full interpreters for JSON, Brainfuck, mini-ML, and a nano-Rust-like language.
The LLM identified 5 files worth highlighting for reuse:
Implements composable error recovery strategies (`skip_then_retry_until`, `skip_until`, `via_parser`, `nested_delimiters`) behind a `Strategy` trait. This is a non-obvious pattern because recovery must avoid infinite loops, respect nested delimiters, and restore parser state precisely; the module isolates each strategy so it can be adapted to other parser frameworks.
Provides a declarative Pratt parser builder with `infix`, `prefix`, and `postfix` operators, explicit associativity, and binding power, integrated into the `Parser` trait. Separating operator tables from atom parsing makes this a reusable blueprint for any expression-oriented parser or compiler front-end.
Renders parser graphs at runtime as EBNF and railroad diagrams (SVG), walking the combinator tree to give language designers a visual grammar without maintaining a separate grammar specification. This is a rare, highly reusable debugging aid for parser libraries and DSL tooling.
Defines `Container` and `ContainerExactly` traits that abstract collection construction for repeated parsers, supporting `Vec`, `String`, `HashMap`, `HashSet`, `LinkedList`, `Box`, and arrays. This lets one combinator produce many collection types without per-type specialization, demonstrating clean generic programming technique.
Defines a lightweight `Span` trait with implementations for `Range<T>`, tuple ranges, `SimpleSpan`, and `WrappingSpan`/`SpanWrap`, enabling composition of spans across AST transformations. The wrapping-span composition pattern is directly reusable in any compiler or language tooling that needs precise source mappings.