WebBS | minipratt | |
---|---|---|
1 | 2 | |
50 | 175 | |
- | - | |
10.0 | 10.0 | |
about 2 years ago | about 4 years ago | |
JavaScript | Rust | |
MIT License | - |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
WebBS
-
Pratt Parsers: Expression Parsing Made Easy
A few years back I had to implement a new parser for a custom expression language to replace an old parser that didn’t giving very good errors and was hard to extend. I never did the traditional CS track so parsers were kind of mysterious black magic so naturally first thing I did was search HN.
I stumbled on an older parsing thread [1] with a link to a toy Prayt implementation [2] made by an HNer… and shamelessly ripped it off to write my own Pratt parser implementation.
Great success! Writing a Pratt parser by hand is a lot easier than I thought and like the comment says, adding type information was trivial.
[1] https://news.ycombinator.com/item?id=24480504
[2] https://github.com/mx-scissortail/WebBS
minipratt
-
Pratt Parsers: Expression Parsing Made Easy
Some time ago I went down a fascinating rabbit hole on Pratt parsers while writing a math expression evaluator. In addition to the OP and above-linked article, I found the following helpful.
- How Desmos Uses Pratt Parsers (2018) - TypeScript - https://engineering.desmos.com/articles/pratt-parser/ - Source: https://github.com/desmosinc/pratt-parser-blog-code
- Simple But Powerful Pratt Parsing (2020) - Rust - https://matklad.github.io/2020/04/13/simple-but-powerful-pra... - Source: https://github.com/matklad/minipratt
- Building a tiny little broken calculator with parser combinators
What are some alternatives?
pratt-parser-blog-code - The code to illustrate the pratt parser blog post for the desmos engineering blog.
expr - Simple integer expression parser