Class: CompilerContext

Inherits:
Object
  • Object
show all
Defined in:
lib/falluto/compiler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCompilerContext

Returns a new instance of CompilerContext.



18
19
20
# File 'lib/falluto/compiler.rb', line 18

def initialize
  @modules = SymbolTable.new
end

Instance Attribute Details

#current_moduleObject (readonly)

Returns the value of attribute current_module.



15
16
17
# File 'lib/falluto/compiler.rb', line 15

def current_module
  @current_module
end

#modulesObject (readonly)

Returns the value of attribute modules.



15
16
17
# File 'lib/falluto/compiler.rb', line 15

def modules
  @modules
end

#variableObject

Returns the value of attribute variable.



16
17
18
# File 'lib/falluto/compiler.rb', line 16

def variable
  @variable
end

Instance Method Details

#<<(m) ⇒ Object



22
23
24
25
# File 'lib/falluto/compiler.rb', line 22

def <<(m)
  @modules << m
  @current_module = m
end

#[](type) ⇒ Object



27
28
29
# File 'lib/falluto/compiler.rb', line 27

def [](type)
  @modules[type]
end

#main_moduleObject



31
32
33
# File 'lib/falluto/compiler.rb', line 31

def main_module
  @modules['main']
end