2017-01-19 09:02:29 +02:00
|
|
|
module Risc
|
2015-08-04 22:01:20 +03:00
|
|
|
|
|
|
|
class OperatorInstruction < Instruction
|
|
|
|
def initialize source , operator , left , right
|
|
|
|
super(source)
|
|
|
|
@operator = operator
|
|
|
|
@left = left
|
|
|
|
@right = right
|
|
|
|
end
|
2015-08-07 16:46:55 +03:00
|
|
|
attr_reader :operator, :left , :right
|
2015-08-04 22:01:20 +03:00
|
|
|
|
|
|
|
def to_s
|
|
|
|
"OperatorInstruction: #{left} #{operator} #{right}"
|
|
|
|
end
|
|
|
|
|
2015-11-21 14:17:54 +02:00
|
|
|
end
|
|
|
|
def self.op source , operator , left , right
|
|
|
|
OperatorInstruction.new source , operator , left , right
|
2015-08-04 22:01:20 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|