Rust
Rust is hyperlark’s native engine — the same core the Python, WASM, and C
bindings wrap. The hyperlark crate builds grammar tables at runtime (no code
generation) and returns a self-describing parse result.
Install
Section titled “Install”cargo add hyperlarkYour first parser
Section titled “Your first parser”use hyperlark::Lark;
fn main() -> Result<(), Box<dyn std::error::Error>> { let lark = Lark::new( "start: \"hello\" NAME\nNAME: /\\w+/\n%ignore \" \"", )?; let result = lark.parse("hello world")?; println!("{}", result.pretty()); Ok(())}Lark::new builds an LALR parser under all-defaults; Lark::lalr / Lark::earley
name the engine, and any other option is a field-init LarkOptions passed to
Lark::from_lark_source.
Walking the tree
Section titled “Walking the tree”parse returns a ParseResult — an owned tree plus the table its ids index. Walk
it with a Cursor, or query by name:
let result = lark.parse("hello world")?;for tok in result.find_token("NAME") { println!("NAME = {}", tok.value);}Next steps
Section titled “Next steps”- Grammar reference — the
.larkgrammar language. - Feature matrix — what each target supports.
- Alternatives — hyperlark vs nom, pest, lalrpop, tree-sitter.
- API reference — docs.rs/hyperlark (once published).