Skip to main content

Module tree_height

Module tree_height 

Source
Expand description

Structural height limits for syntax and typed trees.

The parser’s recursion budget does not bound tree height: operator, postfix and statement-level chains are parsed iteratively, and inference lowers flat syntax such as template literals into nested operations. Every later compiler walk recurses over these trees, so their height is measured iteratively and rejected before a recursive phase can consume them.

Constants§

MAX_SYNTAX_HEIGHT
Height of parsed syntax, counting expressions, statements and type annotations.
MAX_TYPED_HEIGHT
Height of the typed tree after inference and lowering, which may add wrapper nodes and expand flat syntax such as template literal substitutions.

Functions§

check_syntax
Rejects parsed syntax whose recursive walks could exhaust the compiler stack.
check_typed
Rejects a typed tree whose recursive walks could exhaust the compiler stack.