ml_switcheroo.core.rewriter.context¶
Rewriter Context Module.
This module provides the RewriterContext container, which holds the shared state for the transpilation pipeline. It decouples state management (Symbol Tables, Scopes, Configuration) from the logic transformers (RewriterStages), enabling a composition-based architecture.
Classes¶
Shared state container for the rewriting pipeline. |
Module Contents¶
- class ml_switcheroo.core.rewriter.context.RewriterContext(semantics: ml_switcheroo.semantics.manager.SemanticsManager, config: ml_switcheroo.config.RuntimeConfig, symbol_table: ml_switcheroo.analysis.symbol_table.SymbolTable | None = None, arg_injector: Callable[[str, str | None], None] | None = None, preamble_injector: Callable[[str], None] | None = None)[source]¶
Shared state container for the rewriting pipeline.
Encapsulates all mutable state required during the AST traversal, allowing multiple RewriterStage passes to operate on a consistent context.
- semantics¶
- config¶
- symbol_table = None¶
- scope_stack: List[Set[str]]¶
- signature_stack: List[ml_switcheroo.core.rewriter.types.SignatureContext] = []¶
- alias_map: Dict[str, str]¶
- current_stmt_errors: List[str] = []¶
- current_stmt_warnings: List[str] = []¶
- module_preamble: List[str] = []¶
- in_module_class: bool = False¶
- hook_context¶
- property source_fw: str¶
Returns effective source framework string.
- property target_fw: str¶
Returns effective target framework string.