2015-09-19 15:28:41 +02:00
|
|
|
module Bosl
|
2015-09-19 17:56:18 +02:00
|
|
|
Compiler.class_eval do
|
2015-09-19 15:28:41 +02:00
|
|
|
# operator attr_reader :operator, :left, :right
|
2015-09-19 17:56:18 +02:00
|
|
|
def on_operator expression
|
2015-09-19 16:57:44 +02:00
|
|
|
operator , left , right = *expression
|
|
|
|
nil
|
2015-09-19 15:28:41 +02:00
|
|
|
end
|
|
|
|
|
2015-09-19 17:56:18 +02:00
|
|
|
def on_assign expression
|
2015-09-19 15:28:41 +02:00
|
|
|
puts "assign"
|
|
|
|
puts expression.inspect
|
|
|
|
name , value = *expression
|
|
|
|
name = name.to_a.first
|
2015-09-19 17:56:18 +02:00
|
|
|
v = process(value )
|
2015-09-19 15:28:41 +02:00
|
|
|
index = method.ensure_local( name )
|
|
|
|
method.source.add_code Virtual::Set.new(Virtual::FrameSlot.new(index ) , v )
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|