Expand description
AST visitor and walker traits.
This module provides the Visitor trait for traversing AST nodes, and
the walk module with default traversal implementations.
§Design
- The
Visitortrait has avisit_*method for each AST node type. - Each
visit_*method has a default implementation that calls the correspondingwalk_*function, which recurses into children. - Override individual
visit_*methods to intercept specific node types without reimplementing the full traversal.
§Extension
As the AST grows (PARSE-004 through PARSE-011), new visit_* / walk_*
pairs will be added. The existing visit_source_file entry point
dispatches to all child nodes.
Modules§
- walk
- Default traversal implementations.
Traits§
- Visitor
- Trait for visiting AST nodes.
Functions§
- visit_
source_ file - Walk the entire AST with the given visitor.