glr
GLR parser in Rust.
Example
This example shows building a parser for the grammar
S → S S
S → a
S → ε
and using it to parse the input string a:
use ;
let grammar = Grammar ;
let table = new;
let = new
.parse
.ok_or?;
// The family of the root node is three alternative lists of children
let family: = root.family.collect;
// Either a single `a`;
assert_eq!;
// left-recursion; or
assert_eq!;
assert_eq!;
// right recursion.
assert_eq!;
assert_eq!;
# Ok::
Any one of the infinitely many derivation trees can be recovered by unwinding the cycles the right number of times.