let boot_functions return the compilers

methods are still added, but this is a good step to removing the risc/cpu level from the methods
This commit is contained in:
Torsten Ruger
2018-06-30 23:16:17 +03:00
parent 208b98d709
commit 91a99b1239
6 changed files with 62 additions and 27 deletions

View File

@ -17,7 +17,7 @@ module Risc
builder.add_new_int(source,me , two)
builder.add_reg_to_slot( source , two , :message , :return_value)
compiler.add_mom( Mom::ReturnSequence.new)
return compiler.method
return compiler
end
def >( context )
comparison( :> )
@ -54,12 +54,12 @@ module Risc
builder.add_code merge_label
builder.add_reg_to_slot( "#{operator} save ret" , other , :message , :return_value)
compiler.add_mom( Mom::ReturnSequence.new)
return compiler.method
return compiler
end
def putint(context)
compiler = compiler_for(:Integer,:putint ,{})
compiler.add_mom( Mom::ReturnSequence.new)
return compiler.method
return compiler
end
def operator_method( op_sym )
compiler = compiler_for(:Integer, op_sym ,{other: :Integer})
@ -71,7 +71,7 @@ module Risc
builder.add_new_int(op_sym.to_s + " new int", me , other)
builder.add_reg_to_slot( op_sym.to_s + "save ret" , other , :message , :return_value)
compiler.add_mom( Mom::ReturnSequence.new)
return compiler.method
return compiler
end
def div10( context )
s = "div_10 "
@ -134,7 +134,7 @@ module Risc
builder.add_reg_to_slot( s , tmp , :message , :return_value)
compiler.add_mom( Mom::ReturnSequence.new)
return compiler.method
return compiler
end
end
extend ClassMethods