remove the code_builder

this is core of #11
rename compiler_builder to just builder
and change all builder uses to use that
some test change as code is not returned anymore
This commit is contained in:
Torsten Ruger
2018-08-19 13:16:07 +03:00
parent b294208025
commit 57dc6c45bb
10 changed files with 44 additions and 93 deletions

View File

@ -13,7 +13,7 @@ module Risc
# return new int with result
def div4(context)
compiler = compiler_for(:Integer,:div4 ,{})
compiler.compiler_builder(compiler.source).build do
compiler.builder(compiler.source).build do
integer! << message[:receiver]
integer.reduce_int
integer_reg! << 2
@ -50,7 +50,7 @@ module Risc
# - return
def comparison( operator )
compiler = compiler_for(:Integer, operator ,{other: :Integer})
builder = compiler.compiler_builder(compiler.source)
builder = compiler.builder(compiler.source)
builder.build do
integer! << message[:receiver]
integer_reg! << message[:arguments]
@ -87,7 +87,7 @@ module Risc
# - returns the new int
def operator_method( op_sym )
compiler = compiler_for(:Integer, op_sym ,{other: :Integer})
builder = compiler.compiler_builder(compiler.source)
builder = compiler.builder(compiler.source)
builder.build do
integer! << message[:receiver]
integer_reg! << message[:arguments]
@ -113,7 +113,7 @@ module Risc
def div10( context )
s = "div_10 "
compiler = compiler_for(:Integer,:div10 ,{})
builder = compiler.compiler_builder(compiler.source)
builder = compiler.builder(compiler.source)
builder.build do
integer_self! << message[:receiver]
integer_self.reduce_int

View File

@ -8,7 +8,7 @@ module Risc
# return is stored in return_value
def get_internal_word( context )
compiler = compiler_for(:Object , :get_internal_word ,{at: :Integer})
compiler.compiler_builder(compiler.source).build do
compiler.builder(compiler.source).build do
object! << message[:receiver]
integer! << message[:arguments]
integer << integer[1]
@ -24,7 +24,7 @@ module Risc
# return the value passed in
def set_internal_word( context )
compiler = compiler_for(:Object , :set_internal_word , {at: :Integer, :value => :Object} )
compiler.compiler_builder(compiler.source).build do
compiler.builder(compiler.source).build do
object! << message[:receiver]
integer! << message[:arguments]
object_reg! << integer[ 2]
@ -41,7 +41,7 @@ module Risc
# Even if it's just this one, sys_exit (later raise)
def _method_missing( context )
compiler = compiler_for(:Object,:method_missing ,{})
emit_syscall( compiler.compiler_builder(compiler.source) , :exit )
emit_syscall( compiler.builder(compiler.source) , :exit )
return compiler
end
@ -54,7 +54,7 @@ module Risc
def __init__( context )
compiler = MethodCompiler.compiler_for_class(:Object,:__init__ ,
Parfait::NamedList.type_for({}) , Parfait::NamedList.type_for({}))
builder = compiler.compiler_builder(compiler.source)
builder = compiler.builder(compiler.source)
builder.build do
space! << Parfait.object_space
message << space[:next_message]
@ -98,7 +98,7 @@ module Risc
# mainly calls exit_sequence
def exit( context )
compiler = compiler_for(:Object,:exit ,{})
builder = compiler.compiler_builder(compiler.source)
builder = compiler.builder(compiler.source)
exit_sequence(builder)
return compiler
end

View File

@ -12,7 +12,7 @@ module Risc
# - emit_syscall (which does the return of an integer, see there)
def putstring( context)
compiler = compiler_for(:Word , :putstring ,{})
builder = compiler.compiler_builder(compiler.source)
builder = compiler.builder(compiler.source)
builder.build do
word! << message[:receiver]
integer! << word[Parfait::Word.get_length_index]
@ -26,7 +26,7 @@ module Risc
# return a word sized new int, in return_value
def get_internal_byte( context)
compiler = compiler_for(:Word , :get_internal_byte , {at: :Integer})
compiler.compiler_builder(compiler.source).build do
compiler.builder(compiler.source).build do
object! << message[:receiver]
integer! << message[:arguments]
integer << integer[1]
@ -44,7 +44,7 @@ module Risc
# return value
def set_internal_byte( context )
compiler = compiler_for(:Word, :set_internal_byte , {at: :Integer , :value => :Integer} )
compiler.compiler_builder(compiler.source).build do
compiler.builder(compiler.source).build do
word! << message[:receiver]
integer! << message[:arguments]
integer << integer[1]