// the find
munificent/bantam
A simple demo app for Pratt parsing
A minimal Java implementation of a Pratt parser, written by Bob Nystrom as a companion to his 2011 blog post on expression parsing. It's a teaching artifact, not a library — the point is to read the source alongside the post and understand how precedence climbing actually works.
The parselet abstraction is genuinely well-designed: prefix and infix parselets are separate objects registered by token type, so adding a new operator is a one-file change with no switch statement sprawl. The precedence table is explicit and readable, not buried in a recursive descent tangle. The code is small enough (~400 lines total) that you can read the whole thing in 20 minutes. The community ports to 9 languages mean you can cross-reference the same logic in whatever language you actually work in.
This is a demo from 2011 that hasn't been touched in years — there's no build system (raw .classpath/.project Eclipse files), no tests, and no error recovery. You cannot use this as a dependency; you have to copy and adapt it. The Java is verbose in the way 2011 Java was verbose, which makes the signal-to-noise ratio worse than the Kotlin or Go ports. If you're building something real, you'd learn more from the blog post than from the code.