zesterer / chumsky

Write expressive, high-performance parsers with ease.
https://crates.io/crates/chumsky
MIT License
3.63k stars 155 forks source link

Add a Pratt parsing combinator #51

Closed zesterer closed 1 year ago

kevinbarabash commented 2 years ago

Would this allow a person to embedded a Pratt parser for algebraic expressions within in a parent parser for a programming language?

zesterer commented 2 years ago

Yes, that would be the goal.

kevinbarabash commented 2 years ago

That sounds awesome. I'm curious if you had any thoughts on what the API might look like.

I wrote a Pratt parser factory in TypeScript a while ago. It's surprisingly short, but it also doesn't support post-fix operators and there's some hardcoded logic in it, e.g. checking for unmatched parens.

I'm still relatively new to rust, but would be interested in helping out with this issue.

zesterer commented 2 years ago

I've not really had too many thoughts about it yet, to be honest. Perhaps I'll try some experimenting next week.

zesterer commented 1 year ago

zero-copy is getting a pratt parser combinator. See #288.

Zij-IT commented 1 year ago

Closable with #464?