The code is available on GitHub
There are various variants of EBNF, which uses somewhat different syntactic conventions. This library takes EBNF Evaluator's example code as standard, which has almost most syntactic conventions on Wikipedia's page.
The following example is taken from EBNF Evaluator:
ebnf
filter ::= ( first ' ' )? ( number '~ ' )? ( number '-' number ) ( ' ' number '~' )? ( ' hz' )? ( ' b' )? ( ' i' )? ( ' a' )?
first ::= #'[a-za-z][a-za-z0-9_+]*'
number ::= digits ( ( '.' | ',' ) digits? )?
digits ::= #'[0-9]+'
```rust extern crate ebnf;
fn main() { let source = r" filter ::= ( first ' ' )? ( number '~ ' )? ( number '-' number ) ( ' ' number '~' )? ( ' hz' )? ( ' b' )? ( ' i' )? ( ' a' )? first ::= #'[a-za-z][a-za-z0-9_+]*' number ::= digits ( ( '.' | ',' ) digits? )? digits ::= #'[0-9]+' ";
let result = ebnf::get_grammar(source);
} ```