# rust-bakery/nom

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/rust-bakery-nom).**

10,426 stars · 848 forks · Rust · MIT

## Links

- GitHub: https://github.com/rust-bakery/nom
- awesome-repositories: https://awesome-repositories.com/repository/rust-bakery-nom.md

## Topics

`byte-array` `grammar` `nom` `parse` `parser` `parser-combinators` `rust`

## Description

nom is a parser combinator framework for Rust used to build complex parsers by combining small, reusable parsing functions. It functions as a zero-copy parsing tool that minimizes memory overhead by returning slices of the original input instead of allocating new memory.

The framework is designed for diverse data formats, serving as a binary data parser with configurable endianness and a bitstream processing library capable of extracting values of arbitrary bit length. It also functions as a streaming data parser that can process data arriving in chunks and signal when additional input is required to complete a result.

Its capabilities cover a wide range of parsing domains, including the construction of abstract syntax trees for programming languages, the processing of structured text and escaped characters, and the extraction of length-prefixed or delimited binary data. The system includes higher-order primitives for sequencing, branching, and repeating parsing logic, as well as tools for operator precedence handling and input pattern validation.

The library provides descriptive error generation to pinpoint the exact location of parsing failures through error codes and input pointers.

## Tags

### Programming Languages & Runtimes

- [Parser Combinator Frameworks](https://awesome-repositories.com/f/programming-languages-runtimes/parser-combinator-frameworks.md) — Provides a comprehensive framework for building complex parsers by combining small, reusable parsing functions in Rust.
- [Parser Combinators](https://awesome-repositories.com/f/programming-languages-runtimes/parser-combinators.md) — Implements a functional architectural pattern where complex grammars are built by combining small, reusable parsing functions.
- [Binary Integer Extraction](https://awesome-repositories.com/f/programming-languages-runtimes/binary-parsing/binary-integer-extraction.md) — Extracts signed and unsigned integers of various bit-widths using configurable big or little endianness. ([source](https://github.com/rust-bakery/nom/blob/main/doc/choosing_a_combinator.md))
- [Parser Behavior Modification](https://awesome-repositories.com/f/programming-languages-runtimes/parser-combinator-frameworks/parser-behavior-modification.md) — Transforms output via mapping, adds conditional execution, or peeks at input without consuming it. ([source](https://github.com/rust-bakery/nom/blob/main/doc/choosing_a_combinator.md))
- [Basic Element Matching](https://awesome-repositories.com/f/programming-languages-runtimes/basic-element-matching.md) — Recognizes low-level tokens such as specific characters, bytes, or case-insensitive strings based on set criteria. ([source](https://github.com/rust-bakery/nom/blob/main/doc/choosing_a_combinator.md))
- [Escaped Text Parsing](https://awesome-repositories.com/f/programming-languages-runtimes/escaped-text-parsing.md) — Matches byte strings containing escaped characters and transforms them into a cleaned representation. ([source](https://github.com/rust-bakery/nom/blob/main/doc/choosing_a_combinator.md))
- [Parser Output Transformation](https://awesome-repositories.com/f/programming-languages-runtimes/parser-combinators/parser-output-transformation.md) — Maps a parser result through a function to convert it into a different type or result. ([source](https://github.com/rust-bakery/nom/blob/main/CHANGELOG.md))
- [Source Code Abstract Syntax Trees](https://awesome-repositories.com/f/programming-languages-runtimes/programming-utilities/data-structure-type-helpers/data-structures/hierarchical-tree-structures/source-code-abstract-syntax-trees.md) — Builds abstract syntax trees from source code by defining grammar rules and handling operator precedence.

### Part of an Awesome List

- [Combinator-Based Composition](https://awesome-repositories.com/f/awesome-lists/devtools/parsing-and-grammars/combinator-based-composition.md) — Chains multiple parsers together to match sequences while discarding delimiters or assembling results into tuples. ([source](https://github.com/rust-bakery/nom/blob/main/doc/choosing_a_combinator.md))
- [Text Processing and Parsing](https://awesome-repositories.com/f/awesome-lists/devtools/text-processing-and-parsing.md) — Handles UTF-8 strings, case-insensitive comparisons, and escaped characters for structured text formats. ([source](https://github.com/rust-bakery/nom#readme))
- [Custom Text Format Parsing](https://awesome-repositories.com/f/awesome-lists/devtools/text-processing-and-parsing/custom-text-format-parsing.md) — Defines rules to recognize and transform structured text, escaped characters, and specific character patterns.

### Data & Databases

- [Streaming Data Processing](https://awesome-repositories.com/f/data-databases/data-engineering/distributed-compute-frameworks/streaming-data-processing.md) — Processes data arriving in chunks and signals when more input is required for a result. ([source](https://github.com/rust-bakery/nom#readme))
- [Zero-Copy Array Slicing](https://awesome-repositories.com/f/data-databases/immutable-array-updates/zero-copy-array-slicing.md) — Efficiently extracts sub-sections of input without duplicating the underlying data to minimize memory overhead.
- [Zero-Copy Data Access](https://awesome-repositories.com/f/data-databases/zero-copy-data-access.md) — Parses large inputs by returning slices of the original data to avoid memory allocation.
- [Zero-Copy Parsing](https://awesome-repositories.com/f/data-databases/zero-copy-data-access-libraries/zero-copy-deserialization/zero-copy-parsing.md) — Minimizes memory overhead by returning slices of the original input instead of allocating new memory during parsing.
- [Length-Delimited Encodings](https://awesome-repositories.com/f/data-databases/data-serialization-formats/binary-serialization-protocols/length-delimited-encodings.md) — Provides binary encoding schemes that prefix data segments with length headers to facilitate efficient parsing. ([source](https://github.com/rust-bakery/nom/blob/main/doc/choosing_a_combinator.md))
- [Recursive Descent Parsers](https://awesome-repositories.com/f/data-databases/data-transformation-functions/recursive-processors/recursive-logic-implementations/recursive-descent-parsers.md) — Implements top-down parsing by chaining functions that match patterns and backtrack upon failure.
- [Delimited Data Parsers](https://awesome-repositories.com/f/data-databases/delimited-data-parsers.md) — Parses sequences of elements separated by a specific delimiter or enclosed within tags. ([source](https://github.com/rust-bakery/nom/blob/main/CHANGELOG.md))

### Operating Systems & Systems Programming

- [Bit-Level Binary Parsers](https://awesome-repositories.com/f/operating-systems-systems-programming/bit-level-binary-parsers.md) — Provides tools for extracting data from binary streams using bit-level logic and pattern recognition.
- [Bitstream Processing Libraries](https://awesome-repositories.com/f/operating-systems-systems-programming/bitstream-processing-libraries.md) — Treats byte slices as bit streams to extract values of arbitrary bit length.
- [Streaming Input Parsers](https://awesome-repositories.com/f/operating-systems-systems-programming/streaming-input-parsers.md) — Capable of processing partial data chunks and requesting more input when the buffer is exhausted.

### Software Engineering & Architecture

- [Binary Data Parsers](https://awesome-repositories.com/f/software-engineering-architecture/binary-data-parsers.md) — Tool for extracting typed integers and floating-point numbers from byte slices with configurable endianness.
- [Input Type Abstractions](https://awesome-repositories.com/f/software-engineering-architecture/abstract-data-types/generic-data-abstractions/stream-type-abstractions/input-type-abstractions.md) — Uses traits to allow the same parsing logic to operate over different input types like byte slices or character streams.
- [Abstract Syntax Tree Parsing](https://awesome-repositories.com/f/software-engineering-architecture/abstract-syntax-tree-parsing.md) — Constructs abstract syntax trees from source code using whitespace handling and error location tracking. ([source](https://github.com/rust-bakery/nom#readme))
- [Parse Error Reporters](https://awesome-repositories.com/f/software-engineering-architecture/error-handling/parse-error-reporters.md) — Aggregates error codes and input pointers to pinpoint the exact location of parsing failures. ([source](https://github.com/rust-bakery/nom#readme))
- [Operator Precedence Management](https://awesome-repositories.com/f/software-engineering-architecture/operator-precedence-management.md) — Parses complex expressions based on a defined set of operator precedence rules. ([source](https://github.com/rust-bakery/nom/blob/main/doc/choosing_a_combinator.md))
- [Parser State Tracking](https://awesome-repositories.com/f/software-engineering-architecture/parser-state-tracking.md) — Maintains internal state of the parser to track the remaining input slice and current position.

### Security & Cryptography

- [Character Classifications](https://awesome-repositories.com/f/security-cryptography/character-escaping/character-by-character-data-extraction/character-classifications.md) — Identifies character sequences based on properties such as alphanumeric, numeric, hexadecimal, or whitespace. ([source](https://github.com/rust-bakery/nom/blob/main/doc/choosing_a_combinator.md))

### Testing & Quality Assurance

- [Input Validation](https://awesome-repositories.com/f/testing-quality-assurance/validation-verification/input-validation.md) — Checks input against regular expressions or custom predicates to ensure it matches specific criteria. ([source](https://github.com/rust-bakery/nom/blob/main/CHANGELOG.md))
