pub fn parse_recursive(
g: &Grammar,
root_rule_name: &str,
tokens: &[Token],
guards: Rc<HashMap<String, Guard, FxBuildHasher>>,
hooks: Rc<HashMap<String, Hook, FxBuildHasher>>,
) -> Result<ASTNode, Box<PrdError>>Expand description
Recursive implementation: Parse the given token stream (produced by bnf::tokenize) into an AST, using the given bnf::Grammar, and taking the given root rule name as the starting point.
Guards and hooks are for advanced usage (e.g. parsing C).
This implementation is vulnerable to deep recursion issues. Depending on compiler settings, the recursion depth limit may vary from 300 to 3000, with very little control. For this reason, there’s a hard depth limit of about 1500 in release mode and 300 in debug mode.
However, this version is about 4% faster than parse.