Class: Kumi::Core::Analyzer::Passes::NASTDimensionalAnalyzerPass

Inherits:
PassBase
  • Object
show all
Defined in:
lib/kumi/core/analyzer/passes/nast_dimensional_analyzer_pass.rb

Overview

Extracts dimensional and type metadata from NAST tree Uses minimal function specs to resolve Call nodes and propagate types

Input: state, state (chain-free; must include :axes and :dtype per path) Output: state, state

Instance Method Summary collapse

Methods inherited from PassBase

#debug, #debug_enabled?, #initialize

Methods included from ErrorReporting

#inferred_location, #raise_localized_error, #raise_syntax_error, #raise_type_error, #report_enhanced_error, #report_error, #report_semantic_error, #report_syntax_error, #report_type_error

Constructor Details

This class inherits a constructor from Kumi::Core::Analyzer::Passes::PassBase

Instance Method Details

#run(errors) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/kumi/core/analyzer/passes/nast_dimensional_analyzer_pass.rb', line 13

def run(errors)
  nast_module  = get_state(:nast_module, required: true)
  @input_table = get_state(:input_table, required: true)
  @registry = get_state(:registry, required: true)

  @function_specs    = Functions::Loader.load_minimal_functions

      = {}
  @declaration_table = {}

  debug "Analyzing NAST module with #{nast_module.decls.size} declarations"
  debug "Function specs loaded: #{@function_specs.keys.join(', ')}"

  nast_module.decls.each { |name, decl| analyze_declaration(name, decl, errors) }

  debug "Generated metadata_table with #{@metadata_table.size} entries"
  debug "Generated declaration_table with #{@declaration_table.size} entries"

  state.with(:metadata_table, .freeze)
       .with(:declaration_table, @declaration_table.freeze)
end