Expand description
§rusty_lr
A Bison-like, parser generator for Rust supporting IELR(1), LALR(1) parser tables, with deterministic LR and non-deterministic LR (GLR) parsing strategies.
RustyLR is a parser generator that converts context-free grammars into IELR(1)/LALR(1) tables with deterministic LR and non-deterministic GLR parsing strategies. It supports custom reduce action in Rust, with beautiful diagnostics. Highly inspired by tools like bison, it uses a similar syntax while integrating seamlessly with Rust’s ecosystem. It constructs optimized state machine, ensuring efficient and reliable parsing.
§Features
- Custom Reduce Actions: Define custom actions in Rust, allowing you to build into custom data structures easily.
- Automatic Optimization:: Reduces parser table size and improves performance by grouping terminals with identical behavior across parser states.
- Multiple Parsing Strategies: Supports minimal-LR(1), LALR(1) parser table, and GLR parsing strategy.
- Detailed Diagnostics: Detect grammar conflicts, verbose conflicts resolving stages, and optimization stages.
- Location Tracking: Track the location of every tokens in the parse tree, useful for error reporting and debugging.
Modules§
- builder
- module for build parser tables from CFG
- hash
- FxHash for fast and non-cryptographic hashing
- nonterminal
- module for auto-generated types of non-terminals representation
- parser
- module for core parser functionality
- rule
- module for production rules representation
- stackvec
- stack allocated vector for small data
Macros§
- lr1
- Build a parser table from a grammar definition.
Structs§
- Backtrace
- Backtracing information for parsing context. What current parser was trying to parse, and what rules were applied.
- Default
Location - Default location type that does nothing.
- Default
Reduce Action Error - Default error type for reduce action
Enums§
- Terminal
Symbol - A type for terminal symbols in the grammar.
just because we have to take care of the
error
token specially, and future support for other special tokens. - Token
- Token represents a terminal or non-terminal symbol in the grammar.
Traits§
- Location
- trait for token location in the input stream