Our great sponsors
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
I found that nom's docs on GitHub were quite helpful like https://github.com/Geal/nom/blob/main/doc/choosing_a_combinator.md and it's examples
Maybe a parser combinator library is not what you want? One alternative might be writing an expression parser without a library at all: https://matklad.github.io/2020/04/13/simple-but-powerful-pratt-parsing.html (Depending on the grammar you are parsing a Pratt parser might actually be a good fit!) A PEG might also be more suitable for your use case, like pom.
And of course, there are always the parser generators if you want to go that route. But picking the right parsing library is dependent on the specific grammar you are dealing with. For instance, nom is great for parsing binary formats and simple grammars that Pratt parsers can handle (because the structure of the code will mimic the structure of the grammar), but it may not be ideal for complex grammars with 5 pages of EBNF! A declarative parser might be more appropriate for these grammars hence parser generators are also an option. lalrpop and pomelo fall under this category.
Related posts
- What is the state of the art for creating domain-specific languages (DSLs) with Rust?
- Letlang — Roadblocks and how to overcome them - My programming language targeting Rust
- Question about lexer and parser generators in Rust
- Contrext-free language parsing with procedural macros
- Show HN: IQ” – jq for images (using rust, LALRPOP)