prpr: a simple and fast parser generator for Rust
Developer tanakh released prpr (PackRat Parser in Rust), a new parser generator for Rust based on Parsing Expression Grammar[1] (PEG); it is published on crates.io, with the source on GitHub and documentation available online. prpr applies packrat parsing[2], which parses input in time linear in its size, giving worst-case complexity guarantees without backtrack-control operators such as cut or try. By default the library skips whitespace and requires delimiters between elements, rules can be typed with actions written as Rust expressions, and parse errors are reported in rustc style, with optional rendering via ariadne or miette. Memoization[3] is disabled by default for performance and switched on per rule with the #[memo] attribute, while a #![lint] analysis reports rules that may be parsed repeatedly at the same position. In JSON benchmarks on a Ryzen 9950X under WSL2, prpr was faster than rust-peg, pest, nom and winnow on all three test files but slower than serde_json; the library also parses its own grammar and can generate both standalone parsers and procedural macros[4].
Sources
-
JPZenn JA
prpr: Rust 向けのシンプルで高速な Parser generator


