rework macro tests, or are they builtin

small fixes too
This commit is contained in:
2019-09-13 10:41:13 +03:00
parent 4bf23defc8
commit c9d7539479
21 changed files with 111 additions and 247 deletions

View File

@ -22,6 +22,10 @@ module Mom
def to_risc(compiler)
compiler.add_code Risc::Branch.new(self , return_label.risc_label(compiler))
end
def to_s
"ReturnJump: #{return_label}"
end
end

View File

@ -3,7 +3,7 @@ module Mom
def to_risc(compiler)
builder = compiler.builder(compiler.source)
builder.prepare_int_return # makes integer_tmp variable as return
Builtin.exit_sequence(builder)
Macro.exit_sequence(builder)
return compiler
end
end

View File

@ -1,6 +1,10 @@
module Mom
class Macro < Instruction
def to_s
self.class.name.split("::").last
end
# emit the syscall with given name
# there is a Syscall instruction, but the message has to be saved and restored
def self.emit_syscall( builder , name )

View File

@ -3,7 +3,7 @@ module Mom
def to_risc(compiler)
builder = compiler.builder(compiler.source)
builder.prepare_int_return # makes integer_tmp variable as return
Builtin.emit_syscall( builder , :exit )
Macro.emit_syscall( builder , :exit )
return compiler
end
end

View File

@ -7,7 +7,7 @@ module Mom
word! << message[:receiver]
integer! << word[Parfait::Word.get_length_index]
end
Mom::Builtin.emit_syscall( builder , :putstring )
Mom::Macro.emit_syscall( builder , :putstring )
compiler
end
end