cl-parser-kit¶
cl-parser-kit is a small, practical parser toolkit for Common Lisp. It
focuses on the pieces that recur in real text-language parsers: tokenization,
source spans, parser combinators, Pratt parsing, structured diagnostics, and
AST/CST helpers — deliberately compact rather than a compiler framework.
New to cl-parser-kit?
Load it into any ASDF-visible checkout and tokenize your first source string in a few lines:
(asdf:load-system :cl-parser-kit)
(cl-parser-kit:tokenize-string
"sum + 42"
(cl-parser-kit:make-tokenizer
:rules (list (cl-parser-kit:make-whitespace-rule :skip-p t)
(cl-parser-kit:make-literal-rule :plus "+")
(cl-parser-kit:make-number-rule)
(cl-parser-kit:make-identifier-rule))))
Continue with Getting Started → Core Concepts.
Explore the docs¶
-
:material-rocket-launch:{ .lg .middle } Getting Started
Every install path (ASDF, Quicklisp, Ultralisp, or a Nix checkout), and the verification commands that prove a checkout is release-ready.
-
:material-book-open-variant:{ .lg .middle } Writing Parsers
Tokens, spans, tokenizers, combinators, and Pratt parsing — the concepts behind the public surface, plus the recommended composition and upgrade patterns for real grammars.
:octicons-arrow-right-24: Core Concepts · Parsing Patterns · Examples
-
:material-file-tree-outline:{ .lg .middle } Reference
The full exported surface grouped by concern, the layer model and dependency direction, and the remaining public-facing roadmap.
:octicons-arrow-right-24: API Reference · Compatibility · Architecture
-
:material-shield-check-outline:{ .lg .middle } Project
The
nix flake checkgate and the raw-checkout entry points, the roadmap, and the release history.
Status¶
This repository is in active development, but the core API is already usable. The current codebase includes:
- a rule-based tokenizer with literal, keyword, identifier, number, string, predicate, char, whitespace, and line/block comment rules
- span, token, and diagnostic types with structured notes and fix-its
- parser combinators — sequencing, alternation, repetition, lookahead,
failure propagation, and practical
sep-by/preceded-by/betweenstyle helpers - a Pratt parser for prefix, infix, and postfix expression grammars
- AST/CST constructors and inspection helpers (
walk,find,map,collect,count,depth, stable*-node->sexpconversion) - exported resource-limit specials so hostile input fails gracefully instead of exhausting memory or the control stack
- a test system wired into
asdf:test-system, with parser-table invariants additionally checked as executablecl-prolog-kit/weavequeries - runnable examples under
examples/, regression-tested as user-facing workflows
The implementation is designed to stay small enough that the behavior is easy to audit from the tests. See Architecture for the layer model and Roadmap for the remaining public-facing work.
Guide Map¶
- Getting Started — ASDF, Quicklisp, Ultralisp, and Nix install paths, the verification commands for a release-ready checkout, and the first runnable tokenizer and parser.
- Recipes — parser combinators, Pratt parsing, seq helpers, lookahead, operator chains, and CST output in runnable snippets.
- Diagnostics — rendering a parse failure with source excerpts, and building a diagnostic by hand.
- Core Concepts — tokens, spans, tokenizers, the parser layer, the Pratt layer, diagnostics, and AST/CST helpers.
- Parsing Patterns — how to choose the smallest stable layer for a grammar, the committed-failure contract, and how to upgrade an existing hand-written parser.
- Examples — a map of every sample file under
examples/and the recommended reading order. - API Reference — the exported surface grouped by concern, with the common entry point for each layer.
- Architecture — the layer model and dependency direction.
- Roadmap — the near-term, mid-term, and explicit non-goals.
- Compatibility — what
v1.0.0froze and what it did not. - Development — the
nix flake checkgate and the raw-checkout entry points.
Design Non-Goals¶
This project is deliberately not trying to be a CLI framework, a terminal/TTY layer, a Prolog engine, an event system, a dataflow engine, a generic utility package, large compiler infrastructure, a full language workbench, or an editor integration layer.
Nix Workflow¶
The flake.nix
at the repository root packages cl-parser-kit as a Nix flake:
nix develop— a devShell with SBCL and Perl, withCL_PARSER_KIT_CL_WEAVE_ROOTandCL_PARSER_KIT_CL_PROLOG_KIT_ROOTpre-wired to the pinned test dependencies, andparedit-clifor structural S-expression lint checks.nix flake check— the full reproducible CI gate: the library package build, thecl-weave/cl-prolog-kittest suite, the 90%/80% coverage gate,paredit-lint, thenixfmtformatting gate, and the--strictdocs build, forx86_64-linux,aarch64-linux, andaarch64-darwin.nix build .#docs— builds this documentation site with MkDocs (Material) in--strictmode, so broken links fail the build.nix run .#test— the test suite alone, against the working tree.nix fmt— formats Nix sources withnixfmtvia treefmt.
Running direnv allow loads the devShell automatically.
Support¶
Use Support Policy for the canonical support boundary and release-readiness expectations.
Use private GitHub security advisories for vulnerability reporting — see Security Policy. Do not put exploit details in a public issue.
Project Operations¶
The contribution, conduct, governance and support policies are org-wide and published from the nerima-lisp/.github repository, so they are not duplicated here:
Repository-specific:
- Compatibility — what the public surface promises.
- Development — the gate, the entry points, releasing.
- Pull request queue: https://github.com/nerima-lisp/cl-parser-kit/pulls
- Issue tracker: https://github.com/nerima-lisp/cl-parser-kit/issues
- Release notes: https://github.com/nerima-lisp/cl-parser-kit/releases
- Security advisories: https://github.com/nerima-lisp/cl-parser-kit/security/advisories/new
License¶
MIT. See LICENSE.