Recommended parsing library?

what’s the current parsing library that people use for lexical analysis of simple text input languages? something clean, easily used in a recursive descent parser is good.


You may want to check out:

1 Like

I have made recently the gramatica crate:

If you need help or some specific feature, you are free to ask.

In the examples you may find a calculator, a parser of JSON and of simple XML. It compiles itself, so it has a decent amount of features, although it is still missing others.

1 Like

I’m using pest and I’m quiet happy with it …


Are you referring to my gramatica crate?

The parser of my library has signature

pub fn parse(source:&str, initial:Option<usize>) -> Result<T,ParsingError>

For the examples, I just show a main function that panics on errors. Should I elaborate more the examples to be able to recover themselves?

thanks — larlrpop looks like more than what i needed, but seems relatively clean so will give it a shot.

I’m using pest crate, too. Very happy with it. I like it for a couple of reasons:

  1. I find that grammar written in a DSL tuned for grammar has better information density (I have not used parser combinators other than trying a few simple examples, though).
  2. It has a decent error reporting by default.
  3. It does not require a separate lexer, but still allows for decent whitespace management.
  4. Reasonably fast (didn’t really benchmark it on complex input). I ran fuzzer against my grammar which revealed case where parser had exponential time complexity instead of linear, but it was quickly fixed by the author.
  5. Simple API.

It’s documentation could use some attention, however. It’s OK, but not great.