Skip to main content

Module visit

Module visit 

Source
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 Visitor trait has a visit_* method for each AST node type.
  • Each visit_* method has a default implementation that calls the corresponding walk_* 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.