An easy to use parser for external DSLs in Rust?


Instaparser is an easy to use parser in Clojure I have been using to create simple external DSLs. Grammars can be defined using standard EBNF or ABNF notation for context-free grammars:

S = AB*
AB = A B
A = 'a'+
B = 'b'+

My grammars are simple, so my priority is easy of use. Are there a parser similar to instaparser for Rust?


Try pest or nom. I believe these are the parsers in Rust. And I’m not sure how similar they are to instaparser.

Hope this will help!


To expand a little on @withkittens’s answer, here’s a few more options - this isn’t an exaustive list, just the ones that I’ve tried and had positive experiences with :slight_smile:

LALRPOP is probably the most EBNF-ish of those, if you’re looking to stick with that kind of syntax, but they’re all really robust libraries - I’d encourage you to have a look at all of them and see which ones suit you :slight_smile: