Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

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

TermsPrivacyAboutGitHubRSS
  1. Home
  2. JVM
  3. jparsec

jparsec

Apache-2.0Javajparsec-root-3.1

A pure Java library for building recursive-descent parser combinators, inspired by Haskell Parsec.

GitHubGitHub
356 stars58 forks0 contributors

What is jparsec?

jparsec is a parser combinator library for Java that allows developers to build recursive-descent parsers using a functional, compositional approach. It solves the problem of parsing complex grammars by providing a declarative API that resembles BNF, along with accurate error location and operator precedence support.

Target Audience

Java developers who need to implement custom parsers for domain-specific languages, configuration files, or data formats without relying on external parser generators.

Value Proposition

Developers choose jparsec for its pure Java implementation, rich set of combinators, and the ability to define parsers declaratively, which reduces boilerplate and improves readability compared to traditional parsing approaches.

Overview

Build parsers in Java

Use Cases

Best For

  • Implementing parsers for domain-specific languages in Java
  • Parsing configuration files with custom syntax
  • Building expression evaluators with operator precedence
  • Creating data format parsers without external tools
  • Educational projects to learn parser combinator concepts
  • Prototyping grammars with quick iteration

Not Ideal For

  • Projects targeting Java 21+ that prioritize modern features like Stream integration and smaller library footprints
  • Applications requiring built-in lazy or streaming parsing out-of-the-box without custom implementation
  • Teams seeking pre-built parsers for common formats like CSV or regex, as jparsec requires building from scratch

Pros & Cons

Pros

Operator Precedence Grammar

Built-in support for defining operator precedence and associativity rules, enabling straightforward parsing of expressions without manual handling.

Accurate Error Location

Pinpoints parsing errors with precise line and column information, as highlighted in the README, which aids in debugging complex grammars.

Declarative BNF-like API

Allows grammar specification in a style resembling Backus-Naur Form, promoting readability and maintainability, as stated in the key features.

Rich Combinator Functions

Includes a comprehensive set of reusable parser combinators for common tasks, reducing boilerplate code, as noted in the documentation.

Cons

Risk of Infinite Loops

The API can lead to infinite loops or accidental left recursions with zero-consumption parsers, a known issue that's painful to debug, as admitted in the README's comparison to Google Mug Dot Parse.

No Native Streaming Support

Lacks built-in lazy or streaming parsing capabilities, requiring custom workarounds for large inputs, unlike modern alternatives mentioned in the news section.

Outdated for Modern Java

Does not fully embrace modern Java features like Stream or pattern matching, and has a larger footprint compared to newer libraries, as highlighted in the 2025 update.

Frequently Asked Questions

Quick Stats

Stars356
Forks58
Contributors0
Open Issues3
Last commit4 months ago
CreatedSince 2013

Tags

#bnf#java#error-reporting#grammar#recursive-descent#parsing-library#parser-combinator

Built With

J
Java

Included in

JVM2.2k
Auto-fetched 22 hours ago

Related Projects

TruffleTruffle

GraalVM compiles applications into native executables that start instantly, scale fast, and use fewer compute resources 🚀

Stars21,727
Forks1,827
Last commit1 day ago
JavaPoetJavaPoet

A Java API for generating .java source files.

Stars10,840
Forks1,396
Last commit2 years ago
autoauto

A collection of source code generators for Java.

Stars10,562
Forks1,226
Last commit4 days ago
error-proneerror-prone

Catch common Java mistakes as compile-time errors

Stars7,245
Forks827
Last commit1 day 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