macro_rules! grammar {
() => { ... };
(<$lhs:ident> ::= $($rest:tt)*) => { ... };
(@collect_prods [[$($curr_terms:expr),*] [$($curr_exprs:tt)*] [$curr_lhs:ident] $($prev_prods:tt)*] ; <$next_lhs:ident> ::= $($rest:tt)*) => { ... };
(@collect_prods [[$($curr_terms:expr),*] [$($curr_exprs:tt)*] [$curr_lhs:ident] $($prev_prods:tt)*] ;) => { ... };
(@collect_prods [[$($curr_terms:expr),*] [$($curr_exprs:tt)*] [$lhs:ident] $($prev_prods:tt)*] | $($rest:tt)*) => { ... };
(@collect_prods [[$($curr_terms:expr),*] $($state:tt)*] $t:literal $($rest:tt)*) => { ... };
(@collect_prods [[$($curr_terms:expr),*] $($state:tt)*] <$nt:ident> $($rest:tt)*) => { ... };
(@collect_prods [[$($last_terms:expr),*] [$($last_exprs:tt)*] [$last_lhs:ident] $([$($prod_exprs:tt)*] [$prod_lhs:ident])*]) => { ... };
(@build_exprs $exprs:ident $([$($terms:expr),*])*) => { ... };
}Expand description
Construct a Grammar from a series of semicolon separated productions.
bnf::grammar! {
<dna> ::= <base> | <base> <dna>;
<base> ::= 'A' | 'C' | 'G' | 'T';
};