nom
A byte-oriented, zero-copy parser combinators library for Rust
Repository Health
Technical Analysis
nom is a parser combinators library for Rust: instead of writing a grammar in a separate file and generating parser code from it (as with lex/yacc-style tools), you compose small, specific parsing functions — “take 5 bytes”, “recognize the word HTTP” — into larger parsers that mirror the shape of the grammar you’re implementing. It works over byte slices, bit streams, and UTF-8 strings with the same combinator style, and returns zero-copy slices of the input wherever possible rather than allocating new buffers.
nom was designed from the start to handle both binary and text formats correctly under streaming/partial-data conditions: when there isn’t enough input to decide an outcome, it reports that more data is needed instead of silently producing a wrong result. It ships descriptive, pattern-matchable error types (with support for custom error types), and has been used in production to write parsers for formats ranging from TLV binary protocols and HTTP to full toy programming languages.
What You Get
- A library of composable parser combinators (
bytes,character,number,sequence,branch,multi,combinatormodules) for building larger parsers from small functions - Byte-, bit-, and string-oriented parsing using the same combinator API, with zero-copy slice returns
- Streaming support: parsers correctly report “need more data” instead of guessing when input is incomplete
- Descriptive, pattern-matchable error types with support for custom error types
no_stdcompatibility via optionalalloc/stdfeature flags for embedded or allocation-constrained targets
Common Use Cases
- Writing a binary format parser (TLV structures, bit-level protocol fields, custom file formats)
- Building a text format parser for line-based or nested formats like CSV, INI, or JSON
- Prototyping a small programming-language parser (lexing, tokenizing, and building an AST in one pass)
- Writing a streaming network protocol parser that must handle partial reads correctly (e.g. an HTTP proxy)
- Replacing a hand-written or regex-heavy parser with a safer, memory-safe combinator-based one
Under The Hood
Architecture - The crate is organized by parsing domain: src/bytes (byte-slice combinators), src/bits (bit-level parsing), src/character and src/str.rs (string/UTF-8 parsing), src/number (numeric parsing), plus cross-cutting src/combinator, src/branch, src/sequence, and src/multi modules for composing and sequencing parsers. src/internal.rs defines the core IResult/error machinery all combinators share, and a companion nom-language crate in the same repo builds higher-level language-parsing helpers on top of the core crate.
Tech Stack - 100% Rust, MSRV 1.65+, with an alloc/std feature-flag split so the crate can run in no_std environments when only alloc is available. No required external dependencies for the core combinator engine.
Code Quality - The tests/ directory contains format-specific integration tests (ini.rs, css.rs, arithmetic.rs, json via arithmetic_ast.rs-style AST tests, float.rs, escaped.rs) exercising real parsing scenarios end-to-end, and a proptest-regressions/ directory shows the project uses property-based testing/fuzzing to catch parser edge cases — the README states fuzzing has only ever found flaws in code outside nom itself.
API Design - The combinator style (small functions like tag, take_while_m_n, map_res composed via .parse()) keeps individual parsers both reusable and independently testable, and the resulting code reads close to the grammar being implemented — the README’s hex-color parser example demonstrates this directly. The tradeoff is a learning curve: combinator composition and the IResult/Parser trait machinery take longer to internalize than a hand-written recursive-descent parser would.
Used by 7 apps in this directory
agentgateway
AI Development · Developer Tools
An open source AI-native proxy that secures, observes, and governs agent-to-LLM, agent-to-tool, and agent-to-agent communication through MCP, A2A, and unified LLM routing.
Anarlog
Note Taking · AI Assistants · Productivity
Anarlog is an open-source, local-first AI meeting notetaker that records, transcribes, and summarizes meetings entirely on your device — no cloud lock-in, no mandatory account, and every note saved as a plain markdown file you own forever.
Cap
Team Chat · Video Conferencing
Open source Loom alternative with GPU-accelerated recording, instant share links, AI summaries, and full self-hosting via Docker Compose.
fabro
Developer Tools · Devops
Define AI agent workflows as code graphs, route tasks across any LLM, and intervene only where it matters.
InfluxDB
Databases · Analytics
Open-source time-series database built for real-time ingest, fast SQL queries, and embedded Python automation — powered by Apache Arrow and Parquet.
Meilisearch
Search
Lightning-fast hybrid search engine with AI-powered semantic and full-text retrieval for modern applications.
Qdrant
Databases · AI Development · Search
Open-source vector database and search engine built in Rust for production-grade AI applications — from semantic search to RAG pipelines and recommendation systems.