get plus (+) working
alas, new integer is not created yet
This commit is contained in:
@ -19,6 +19,11 @@ module Parfait
|
||||
def self.integer_index
|
||||
3 # 1 type, 2 next_i
|
||||
end
|
||||
|
||||
def get_internal_word( index )
|
||||
return super(index) unless index == Integer.integer_index
|
||||
return @value
|
||||
end
|
||||
# :integer?, :odd?, :even?, :upto, :downto, :times, :succ, :next, :pred, :chr, :ord, :to_i, :to_int, :floor,
|
||||
# :ceil, :truncate, :round, :gcd, :lcm, :gcdlcm, :numerator, :denominator, :to_r, :rationalize,
|
||||
# :singleton_method_added, :coerce, :i, :+@, :-@, :fdiv, :div, :divmod, :%, :modulo, :remainder, :abs, :magnitude,
|
||||
|
@ -20,8 +20,8 @@ module Risc
|
||||
compiler = compiler_for(:Integer,:+ ,{other: :Integer})
|
||||
me , other = self_and_int_arg(compiler,source + "1")
|
||||
# reduce me and other to integers
|
||||
compiler.add_slot_to_reg( source + "2" , me , 2 , me)
|
||||
compiler.add_slot_to_reg( source + "3", other , 2 , other)
|
||||
compiler.add_slot_to_reg( source + "2" , me , Parfait::Integer.integer_index , me)
|
||||
compiler.add_slot_to_reg( source + "3", other , Parfait::Integer.integer_index , other)
|
||||
compiler.add_code Risc.op( source + "4", :+ , me , other)
|
||||
#TODO must get an Integer and put the value there then return the integer (object not value)
|
||||
# and put it back into the return value
|
||||
|
Reference in New Issue
Block a user