Skip to main content

Module stack

Module stack 

Source
Expand description

Stack-growth helper for recursive walkers over user expressions.

The compiler pipeline (desugar, HIR lowering, dependency collection, dimension inference), the evaluators, the formatter, and the LSP symbol walker all recurse once per expression-tree level. Structural nesting is bounded by the parser (crate::syntax::parser::MAX_NESTING_DEPTH), but left-nested operator chains (1.0 + 1.0 + …) are parsed iteratively and produce trees whose depth equals the chain length — a few hundred terms is realistic in engineering files and used to overflow the stack in debug builds.

Every recursive walker calls with_stack_growth once per recursion level so the stack grows on demand instead of aborting the process.

Functions§

with_stack_growth
Run f, growing the stack on demand when the remaining stack is low.