Generate LR(1) parser at compilation time.
use bnf_rules;
// Grammer
bnf_rules!;
/// Custom tokenizer for numeric literal
Usage
= { = "https://github.com/bea4dev/bnf_rules" }
Extended BNF
| Form | Semantic |
|---|---|
| source | An entire input source. |
| ident | A non-terminal symbol named "ident". |
| "something" | A terminal symbol for text. |
| fn (function_name) | A custom tokenizer with user function.[^1] |
| { pattern } | Zero or more repetitions of "pattern". |
| [ pattern ] | "pattern" or null. |
| pattern1 | pattern2 | "pattern1" or "pattern2". |
| ( patterns ) | A group of patterns. |
[^1]: Generic parameters are also available.
Example: https://github.com/bea4dev/bnf_rules/blob/master/src/lib.rs