Top 4 Rust Parse Projects
Rust parser combinator frameworkProject mention: Chumsky, a Rust parser-combinator library with error recovery | news.ycombinator.com | 2022-07-08
Caveats: I've used nom in anger, chumsky hardly at all, and tree-sitter only for prototyping. I'm using it for parsing a DSL, essentially a small programming language.
The essential difference between nom/chomsky and tree-sitter is that the former are libraries for constructing parsers out of smaller parsers, whereas tree-sitter takes a grammar specification and produces a parser. This may seem small at first, but is a massive difference in practice.
As far as ergonomics go, that's a rather subjective question. On the surface, the parser combinator libraries seem easier to use. They integrate well with the the host language, so you can stay in the same environment. But this comes with a caveat: parser combinators are a functional programming pattern, and Rust is only kind of a functional language, if you treat it juuuuust right. This will make itself known when your program isn't quite right; I've seen type errors that take up an entire terminal window or more. It's also very difficult to decompose a parser into functions. In the best case, you need to write your functions to be generic over type constraints that are subtle and hard to write. (again, if you get this wrong, the errors are overwhelming) I often give up and just copy the code. I have at times believed that some of these types are impossible to write down in a program (and can only exist in the type inferencer), but I don't know if that's actually true.
It might sound like I'm shitting on nom here, but that's not the goal. It's a fantastic piece of work, and I've gotten a lot of value from it. But it's not for parsing programming languages. Reach for nom when you want to parse a binary file or protocol.
As for chumsky: the fact that it's a parser combinator library in Rust means that it's going to be subject to a lot of the same issues as nom, fundamentally. That's why I'm targeting tree-sitter next.
There's no reason tree-sitter grammars couldn't be written in an internal DSL, perhaps in parser-combinator style (https://github.com/engelberg/instaparse does this). That could smooth over a lot of the rough edges.
Declarative binary reading and writing: bit-level, symmetric, serialization/deserializationProject mention: Macro for structured byte to struct parsing | reddit.com/r/rust | 2022-03-27
Static code analysis for 29 languages.. Your projects are multi-language. So is SonarQube analysis. Find Bugs, Vulnerabilities, Security Hotspots, and Code Smells so you can release quality code every time. Get started analyzing your projects today for free.
A push parser for the HTTP 1.x protocol in Rust.
NTP parser written in rust with nom
Rust Parse related posts
[Question] nom can't infer error type?
1 project | reddit.com/r/rust | 5 Jul 2022
How to read binary files from the end in Rust?
3 projects | reddit.com/r/rust | 4 Jul 2022
Compiler in Rust
3 projects | reddit.com/r/rust | 29 May 2022
Nom - Rust parser combinator framework
1 project | reddit.com/r/github_trends | 12 May 2022
Question about a rust rule
2 projects | reddit.com/r/rust | 2 May 2022
Writing Parsers like TextFSM and TTP
2 projects | reddit.com/r/rust | 9 Apr 2022
A parser written entirely on the type level
2 projects | reddit.com/r/badcode | 8 Apr 2022
What are some of the best open-source Parse projects in Rust? This list will help you:
Are you hiring? Post a new remote job listing for free.