explaingit

veykril/nom

Analysis updated 2026-07-30 · repo last pushed 2021-11-03

Audience · developerComplexity · 3/5DormantLicenseSetup · moderate

TLDR

nom is a Rust library for building parsers by combining small, reusable functions. It helps you read and break apart structured data like text files, binary formats, or network messages.

Mindmap

mindmap
  root((repo))
    What it does
      Builds parsers in Rust
      Combines small functions
      Handles streaming data
    Tech stack
      Rust
      Zero-copy parsing
    Use cases
      Binary formats
      Text formats
      Language prototyping
    Strengths
      Memory safe
      Fast performance
      Large ecosystem
    Audience
      Rust developers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Build a parser for a custom binary file format like a video or image container.

USE CASE 2

Parse text-based data formats such as JSON, CSV, or configuration files.

USE CASE 3

Prototype a new programming language by writing a parser for its syntax.

USE CASE 4

Process streaming network data that arrives in chunks rather than all at once.

What is it built with?

Rust

How does it compare?

veykril/nom00kaku/gallery-slider-block04amanrajj/netwatch
Stars0
LanguageJavaScriptRust
Last pushed2021-11-032021-05-19
MaintenanceDormantDormant
Setup difficultymoderateeasymoderate
Complexity3/52/53/5
Audiencedevelopergeneralops devops

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Requires familiarity with Rust and adding the nom crate as a dependency via Cargo.

You can use this library freely for any purpose, including commercial projects, as long as you keep the copyright notice.

In plain English

nom is a Rust library that helps developers build parsers, code that reads structured data (like a file, a network message, or a line of text) and breaks it into meaningful pieces. Instead of hand-writing tedious and error-prone parsing logic, you assemble small, reusable functions that each handle one tiny task, and combine them to process complex formats. The approach is called "parser combinators." Rather than writing a grammar in a separate file and generating code from it, you write code that directly describes what you're looking for. You might say "take a #, then two hex digits, then two more, then two more", and that assembles into a parser for CSS color values. Because the building blocks are small and focused, they're easy to test and reuse across projects. The code ends up looking a lot like a description of the format itself. This library shines for binary formats (like video files or network packets), text formats (like JSON or CSV), and even programming language prototyping. Real projects using it include parsers for GIF, TLS, HTTP, Kerberos, SQL, Lua, and many others. It also handles streaming data, when data arrives in chunks rather than all at once, the parser can recognize that it needs more input rather than guessing and returning wrong results. Two things stand out. First, it's designed around Rust's safety guarantees, which means parsers built with it avoid common bugs like buffer overflows. Second, it's fast, benchmarks suggest it often outperforms comparable libraries and even some handwritten C parsers. It also supports zero-copy parsing, meaning it can reference parts of the input directly rather than copying data around. For anyone working in Rust who needs to read and understand a structured data format, this is a battle-tested starting point with a large ecosystem of existing parsers to learn from.

Copy-paste prompts

Prompt 1
Help me write a nom parser in Rust that reads a simple CSV file and splits each line into comma-separated fields, returning them as a vector of strings.
Prompt 2
Show me how to use nom to parse a binary format where the first 4 bytes are a magic number and the next 2 bytes are a big-endian unsigned integer length field.
Prompt 3
Write a nom parser combinator in Rust that recognizes a CSS hex color value: a # followed by exactly 6 hexadecimal digits.
Prompt 4
How do I use nom to handle streaming input where data arrives in chunks and the parser needs to recognize it is incomplete and request more input?
Prompt 5
Show me an example of a nom parser for a simple key=value config file format with one entry per line and # comments.

Frequently asked questions

What is nom?

nom is a Rust library for building parsers by combining small, reusable functions. It helps you read and break apart structured data like text files, binary formats, or network messages.

Is nom actively maintained?

Dormant — no commits in 2+ years (last push 2021-11-03).

What license does nom use?

You can use this library freely for any purpose, including commercial projects, as long as you keep the copyright notice.

How hard is nom to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is nom for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.