move compiler to typed

starting to get rid of soml, bit by bit
This commit is contained in:
Torsten Ruger
2016-12-08 15:25:20 +02:00
parent c3a28d2abc
commit da553f996f
30 changed files with 36 additions and 35 deletions

View File

@ -6,18 +6,18 @@ module Register
include AST::Sexp
def mod4 context
compiler = Soml::Compiler.new.create_method(:Integer,:mod4 ).init_method
compiler = Typed::Compiler.new.create_method(:Integer,:mod4 ).init_method
return compiler.method
end
def putint context
compiler = Soml::Compiler.new.create_method(:Integer,:putint ).init_method
compiler = Typed::Compiler.new.create_method(:Integer,:putint ).init_method
return compiler.method
end
def div10 context
s = "div_10"
compiler = Soml::Compiler.new.create_method(:Integer,:div10 ).init_method
compiler = Typed::Compiler.new.create_method(:Integer,:div10 ).init_method
me = compiler.process( Soml::NameExpression.new( :self) )
tmp = compiler.process( Soml::NameExpression.new( :self) )
q = compiler.process( Soml::NameExpression.new( :self) )

View File

@ -7,7 +7,7 @@ module Register
# so it is responsible for initial setup
def __init__ context
source = "__init__"
compiler = Soml::Compiler.new.create_method(:Kernel,:__init__ )
compiler = Typed::Compiler.new.create_method(:Kernel,:__init__ )
# no method enter or return (automatically added), remove
new_start = Label.new(source , source )
compiler.method.instructions = new_start
@ -34,7 +34,7 @@ module Register
end
def exit context
compiler = Soml::Compiler.new.create_method(:Kernel,:exit ).init_method
compiler = Typed::Compiler.new.create_method(:Kernel,:exit ).init_method
emit_syscall( compiler , :exit )
return compiler.method
end

View File

@ -10,7 +10,7 @@ module Register
# return is stored in return_value
# (this method returns a new method off course, like all builtin)
def get_internal_word context
compiler = Soml::Compiler.new.create_method(:Object , :get_internal_word , {:index => :Integer}).init_method
compiler = Typed::Compiler.new.create_method(:Object , :get_internal_word , {:index => :Integer}).init_method
source = "get_internal_word"
#Load self by "calling" on_name
me = compiler.process( Soml::NameExpression.new( :self) )
@ -27,7 +27,7 @@ module Register
# self[index] = val basically. Index is the first arg , value the second
# no return
def set_internal_word context
compiler = Soml::Compiler.new.create_method(:Object , :set_internal_word ,
compiler = Typed::Compiler.new.create_method(:Object , :set_internal_word ,
{:index => :Integer, :value => :Object} ).init_method
source = "set_internal_word"
#Load self by "calling" on_name

View File

@ -9,7 +9,7 @@ module Register
# main entry point, ie __init__ calls this
# defined here as empty, to be redefined
def main context
compiler = Soml::Compiler.new.create_method(:Space , :main ).init_method
compiler = Typed::Compiler.new.create_method(:Space , :main ).init_method
return compiler.method
end

View File

@ -5,7 +5,7 @@ module Register
include AST::Sexp
def putstring context
compiler = Soml::Compiler.new.create_method(:Word , :putstring ).init_method
compiler = Typed::Compiler.new.create_method(:Word , :putstring ).init_method
compiler.add_code Register.get_slot( "putstring" , :message , :receiver , :new_message )
index = Parfait::Word.get_length_index
reg = RegisterValue.new(:r2 , :Integer)
@ -17,7 +17,7 @@ module Register
# self[index] basically. Index is the first arg > 0
# return (and word sized int) is stored in return_value
def get_internal_byte context
compiler = Soml::Compiler.new.create_method(:Word , :get_internal_byte , {:index => :Integer }).init_method
compiler = Typed::Compiler.new.create_method(:Word , :get_internal_byte , {:index => :Integer }).init_method
source = "get_internal_word"
#Load self by "calling" on_name
me = compiler.process( Soml::NameExpression.new( :self) )
@ -35,7 +35,7 @@ module Register
# value the second
# no return
def set_internal_byte context
compiler = Soml::Compiler.new.create_method(:Word , :set_internal_byte ,
compiler = Typed::Compiler.new.create_method(:Word , :set_internal_byte ,
{:index => :Integer, :value => :Integer } ).init_method
source = "set_internal_word"
#Load self by "calling" on_name