rubyx/lib/risc/instructions/operator_instruction.rb

22 lines
442 B
Ruby
Raw Normal View History

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
2018-03-22 17:38:19 +01:00
class_source "#{left} #{operator} #{right}"
2015-08-04 21:01:20 +02:00
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