change operators to symbols
This commit is contained in:
@ -1,9 +1,17 @@
|
||||
module Risc
|
||||
|
||||
# Destructive operator instructions on the two registers given
|
||||
#
|
||||
# left = left OP right
|
||||
#
|
||||
# With OP being the normal logical and mathematical operations provided by
|
||||
# cpus. Ie "+" , "-", ">>", "<<", "*", "&", "|"
|
||||
#
|
||||
class OperatorInstruction < Instruction
|
||||
def initialize source , operator , left , right
|
||||
def initialize( source , operator , left , right )
|
||||
super(source)
|
||||
@operator = operator
|
||||
raise "unsuported operator :#{operator}:" unless [:+, :-, :>>, :<<, :*, :&, :|, :==].include?(operator)
|
||||
@left = left
|
||||
@right = right
|
||||
end
|
||||
@ -14,8 +22,8 @@ module Risc
|
||||
end
|
||||
|
||||
end
|
||||
def self.op source , operator , left , right
|
||||
OperatorInstruction.new source , operator , left , right
|
||||
def self.op( source , operator , left , right )
|
||||
OperatorInstruction.new( source , operator , left , right )
|
||||
end
|
||||
|
||||
end
|
||||
|
Reference in New Issue
Block a user