This is an implementation of the IELR algorithm, described in a paper by Joel E.Denny and Brian A.Malloy: The IELR(1) algorithm for generating minimal LR(1) parser tables for non-LR(1) grammars with conflict resolution.
```rust use ielr::{input, compute_table, Algorithm};
const STARTNODE: input::Node = input::Node(0); let grammar = input::Grammar::new(); // ... // add grammar productions // ... let table = match computetable( Algorithm::Lalr(std::num::NonZeroU8::new(1).unwrap()), &grammar, [STARTNODE], ) { Ok((table, _statistics)) => table, Err() => unimplemented!("handle error"), }; ```
For more complete examples, see the examples directory.
This crate is meant to be used by a parser generator. It builds the LR(1) table for a grammar, using an efficient and minimal algorithm.
Note that this crate does not include:
grammar.add_rule(left, right);
)At the moment, two algorithms are provided: LALR(1) and LR(1).
In the future, I would like to implement the following features: