Expand description
§RustyLR
LR(1) and LALR(1) code generator in Rust
For sample and examples, please refer to the GitHub repository
§Features
- pure Rust implementation
- compile-time DFA construction from CFGs ( with proc-macro )
- customizable reducing action
- resolving conflicts of ambiguous grammar
- tracing parser action with callback, also error handling
- readable error messages, both for grammar building and parsing
§Why proc-macro, not external executable?
- Decent built-in lexer, with consideration of unicode and comments.
- Can generate pretty error messages, by just passing
Spandata. - With modern IDE, can see errors in real-time with specific location.
Macros§
- build a lalr1 Deterministic Finite Automaton (DFA) parser at compile time
- build a lalr1 Deterministic Finite Automaton (DFA) parser at runtime
- build a lr1 Deterministic Finite Automaton (DFA) parser at compile time
- build a lr1 Deterministic Finite Automaton (DFA) parser at runtime
Structs§
- struct for parsing context
- default callback that does nothing
- A struct for Context Free Grammar and DFA construction
- set of lookahead rules
- struct for Deterministic Finite Automaton (DFA).
- Production rule.
- A struct for single shifted named production rule.
- state in DFA
Enums§
- Error type for grammar.build()
- Error type for feed()
- for resolving shift/reduce conflict
- Token represents a terminal or non-terminal symbol in the grammar.
Traits§
- callback trait for tracing parser actions