adjust program tests to new syntax, hello world works there too -)

This commit is contained in:
Torsten Ruger
2014-05-08 14:14:15 +03:00
parent c7d203f523
commit f7f0eee31a
5 changed files with 31 additions and 19 deletions

View File

@ -30,7 +30,7 @@ module Arm
@operand = op_with_rot
@i = 1
else
raise "cannot fit numeric literal argument in operand #{arg}"
raise "cannot fit numeric literal argument in operand #{arg.inspect}"
end
elsif (arg.is_a?(Symbol))
@operand = arg

View File

@ -65,6 +65,16 @@ module Vm
@next = block
end
# sugar to create instructions easily. Any method with one arg is sent to the machine and the result
# (hopefully an instruction) added as code
def method_missing(meth, *args, &block)
if args.length == 1
add_code Machine.instance.send(meth , *args)
else
super
end
end
end
end

View File

@ -30,7 +30,7 @@ module Vm
@functions = []
@entry = Core::Kernel::main_start
#main gets executed between entry and exit
@main = nil
@main = Block.new("main")
@exit = Core::Kernel::main_exit
end
attr_reader :context , :main , :functions