Class: Hoozuki::VM::Compiler

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCompiler

Returns a new instance of Compiler.



8
9
10
11
# File 'lib/hoozuki/vm/compiler.rb', line 8

def initialize
  @pc = 0
  @instructions = []
end

Instance Attribute Details

#instructionsObject (readonly)

Returns the value of attribute instructions.



6
7
8
# File 'lib/hoozuki/vm/compiler.rb', line 6

def instructions
  @instructions
end

Instance Method Details

#compile(ast) ⇒ Object



13
14
15
16
# File 'lib/hoozuki/vm/compiler.rb', line 13

def compile(ast)
  compile_node(ast)
  emit_match
end