grammar

Macro grammar 

Source
macro_rules! grammar {
    ($start:ident $($rest:tt)*) => { ... };
}
Expand description

Generate a grammar using the following syntax:

let _g = grammar!{
    S => A B C;
    A => "a", "A";
    B => "b";
    C => ""
};

As shown above, each rule is either a sequence of non-terminals, or a disjuction of terminals (should be literals, comma-separated).

Note: If your grammar is large, you may need to change the recursion limit for macro expansion in your crate with: #![recursion_limit = "256"] (but change 256 to whatever works for your grammar), because this macro heavily uses recursion.