class Savi::Compiler::Reparse
- Savi::Compiler::Reparse
- Savi::AST::CopyOnMutateVisitor
- Reference
- Object
Overview
The purpose of the Reparse pass is to clean up the work of the parser, such as rebalancing ASTs or converting them to more specific forms.
For example, this pass converts dot-relations into function calls, a more specific AST form that is useful to handle as a single unit later.
This pass also converts each dot-relation for a known nested type name into single identifier that represents the full type name, so that later passes do not need to deal with nested type names as if they were calls.
This pass uses copy-on-mutate patterns to "mutate" the Program topology. This pass uses copy-on-mutate patterns to "mutate" the AST. This pass may raise compilation errors. This pass keeps temporary state at the per-function level. This pass produces no output state.
Defined in:
savi/compiler/reparse.crConstructors
Class Method Summary
- .cached_or_run(ctx, l, t, f : Program::Function, deps, &) : Program::Function
- .run(ctx, package)
- .t_cached_or_run(ctx, l, t : Program::Type, deps, &) : Program::Type
- .ta_cached_or_run(ctx, l, t : Program::TypeAlias, deps, &) : Program::TypeAlias
Instance Method Summary
- #maybe_dot_relation_to_nested_type_ident(ctx, node : AST::Relate) : AST::Identifier | Nil
- #maybe_nested_ident_value(node : AST::Node) : String | Nil
- #run(ctx, f)
- #run_for_type_alias_target(ctx, t)
- #run_for_type_params(ctx, t)
- #visit(ctx, node : AST::Identifier)
- #visit(ctx, node : AST::Qualify)
- #visit(ctx, node : AST::Relate)
- #visit_local_or_param_defn(ctx, node)