Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Rust
  3. combine

combine

MITRust

A Rust parser combinator library inspired by Haskell's Parsec, enabling modular LL(1) parsing with arbitrary lookahead.

Visit WebsiteGitHubGitHub
1.4k stars98 forks0 contributors

What is combine?

Combine is a parser combinator library for Rust that enables developers to build parsers by combining smaller, reusable parsing functions. It solves the problem of writing complex parsers by providing high-level abstractions that reduce boilerplate and improve maintainability. Inspired by Haskell's Parsec, it supports LL(1) parsing with optional lookahead and handles various input streams efficiently.

Target Audience

Rust developers working on parsing tasks such as implementing domain-specific languages, parsing file formats, or building compilers and interpreters. It's particularly useful for those who prefer a modular, functional approach to parsing.

Value Proposition

Developers choose Combine for its modular design, zero-copy parsing capabilities, and support for partial parsing, which makes it efficient and flexible. Its compatibility with arbitrary streams and inspiration from established libraries like Parsec provide a robust foundation for parsing in Rust.

Overview

A parser combinator library for Rust

Use Cases

Best For

  • Building parsers for custom file formats or data serialization
  • Implementing domain-specific languages (DSLs) in Rust
  • Creating lexers and parsers for programming languages
  • Parsing streaming data from network sockets or I/O devices
  • Developing compiler frontends or interpreter components
  • Writing efficient, zero-copy parsers for in-memory data structures

Not Ideal For

  • Projects requiring extensive context-free or LR parsing, as Combine's default LL(1) approach may need cumbersome workarounds for complex grammars.
  • Teams prioritizing immediate, out-of-the-box parsers for common formats like JSON or XML, where specialized libraries offer more convenience and less setup.
  • Developers unfamiliar with functional programming concepts, as the combinator-based design can be less intuitive than imperative parsing methods.

Pros & Cons

Pros

Versatile Stream Support

Can parse from various sources including bytes, strings, iterators, and custom streams, as highlighted in the features section, making it adaptable to different data inputs without modification.

Efficient Zero-Copy Parsing

Specialized parsers in the range module allow parsing in-memory data without copying, optimizing performance for large datasets and reducing memory overhead.

Partial Parsing Capability

Parsers can be stopped and resumed, ideal for handling streaming data from I/O devices like network sockets, as demonstrated in the async example and partial parsing documentation.

Modular Combinator Design

High-level combinators like many and sep_by enable building complex parsers from simple ones, reducing boilerplate and improving code reuse, inspired by Haskell's Parsec.

Cons

Opaque Error Messages

Error positions are based on pointer comparisons, leading to inscrutable debug info unless extra steps like using the State wrapper or translate_position are taken, as admitted in the FAQ.

Steep Learning Curve

The functional, combinator-based approach requires understanding of parser combinators, which can be challenging for developers accustomed to imperative or regex-based parsing techniques.

LL(1) Limitation

Default LL(1) parsing may not efficiently handle grammars that require more lookahead, necessitating the use of attempt combinators which can impact performance and add complexity.

Frequently Asked Questions

Quick Stats

Stars1,355
Forks98
Contributors0
Open Issues30
Last commit3 months ago
CreatedSince 2015

Tags

#parsing#stream-parsing#compiler-tools#zero-copy#rust-library#grammar#parser-combinators#rust#language-parsing#parser

Built With

R
Rust

Links & Resources

Website

Included in

Rust56.6k
Auto-fetched 1 day ago

Related Projects

tree-sittertree-sitter

An incremental parsing system for programming tools

Stars25,617
Forks2,676
Last commit1 day ago
nomnom

Rust parser combinator framework

Stars10,406
Forks847
Last commit9 months ago
pestpest

The Elegant Parser

Stars5,347
Forks291
Last commit1 month ago
lalrpoplalrpop

LR(1) parser generator for Rust

Stars3,480
Forks308
Last commit3 days ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub