Knife doesn’t require any external libraries or dependencies. All generation is done ahead-of-time. After generating the parsing classes you can just copy them into your project.
Also, as other good parser generation tools, knife uses itself to read the input grammar.
- No runtime dependencies, knife generates pure Java code that can easily be ported to other JVM-based languages.
- Parsing is done using push-down automata without recursion.
- Knife uses an explicit API for accepting the token stream. It allows you to easily use knife with any (including your own) lexer. You can pause and resume parsing at any point. Parsing multiple token streams simultaneously is also possible.
- No complete parse-trees are being built during parsing. Reduction of the tree is done on-the-fly for performance. Optimized AST’s can be built during parsing with minimal overhead.
- If your grammar is left-recursive without
A =>* Aderivations (aka without cycles), knife will generate an equivalent grammar without left recursion for you.
- Syntax error recovery using panic mode approach without any additional performance overhead.