formualizer-parse
High-performance Excel and OpenFormula tokenizer, parser, and pretty-printer.
formualizer-parse turns raw formula strings into a structured AST that downstream crates use for evaluation, analysis, and transformation. It handles both Excel and OpenFormula dialects with source location tracking.
When to use this crate
Use formualizer-parse when you need formula analysis without evaluation:
- Formula linting and validation
- Static analysis of cell dependencies
- AST transformation and rewriting
- Pretty-printing formulas to canonical form
- Building custom formula tooling
If you also need evaluation, use formualizer-workbook or formualizer-eval instead.
Quick start
use ;
use Parser;
// Tokenize and parse
let tokenizer = new_with_dialect?;
let mut parser = new;
let ast = parser.parse?;
// Canonical form
assert_eq!;
Features
- Tokenization — streaming tokenizer with dialect-aware classification, source location tracking, and operator metadata.
- Pratt parser — precedence-climbing parser producing a stable AST with reference normalization.
- Dialects — Excel (default) and OpenFormula syntax support through a single API.
- Pretty-printing — canonicalize formulas or render diagnostic trees for debugging.
- Source spans — every token and AST node carries byte positions for precise error reporting.
- Fingerprinting — 64-bit structural hashes for formula identity comparison.
License
Dual-licensed under MIT or Apache-2.0, at your option.