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