Skip to main content

MAX_NESTING_DEPTH

Constant MAX_NESTING_DEPTH 

Source
pub const MAX_NESTING_DEPTH: usize = 256;
Expand description

Maximum recursion depth permitted in the recursive-descent parser.

Mimir’s grammar has no legitimate use case beyond a few nesting levels (a form might contain a list value containing a list value), so 256 is generous by orders of magnitude. A flat ~8 MiB main-thread stack on Linux blows around 5–10k of these frames; capping at 256 keeps the worst-case stack consumption well under 1 MiB.