Which rust parser library has best error reporting?

Suppose:

  1. you have some file you want to parse
  2. you do not have an official EBNF / CFG definition
  3. you are hand rolling some adhoc parser to just parse the data into AST so you can move on

Which Rust parser is best for this task? The most important feature I'm looking for is something that

  1. does NOT just die with "error, invaild syntax"

but instead,

  1. shows the current partial parse, what the remaining input is, where it got stuck, and what it was expecting

(this is because I'm writing the grammar in an 'error driven manner', by writing a partial grammar, looking at the error, then adding more to the grammar).

Thanks!

All have their error reporting mechanism.

2 Likes

(not a direct answer to the question)

I believe there's a conspicuous hole in the parsing tooling in a shape of a nice UX for developing parsers. I've written a bit about that in this post. Here's a short video demo of what should be possible.

4 Likes

@matklad : Thanks for sharing. Agreed, we need better UX for writing parsers.

This is one of the few areas Rust's compile time frustrates me. With most code, linking time is not a big deal, because "if it compiles, it probably works". With parsers however, there's this need for a tight iteration loop of writing some rules, testing it, seeing where it fails -- and Rust's linking time really slows this process down.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.