rubyx/test/compiler/compiler_helper.rb
Torsten Ruger f506f95cbf fixing basic and field access to return register
as that is the new way, drop a layer, code to registers
2015-10-13 16:42:53 +03:00

28 lines
733 B
Ruby

require_relative '../helper'
require 'parslet/convenience'
module CompilerHelper
Phisol::Compiler.class_eval do
def set_main
@clazz = Virtual.machine.space.get_class_by_name :Object
@method = Virtual.machine.space.get_main
end
end
def check
machine = Virtual.machine
machine.boot unless machine.booted
parser = Parser::Salama.new
parser = parser.send @root
syntax = parser.parse_with_debug(@string_input)
parts = Parser::Transform.new.apply(syntax)
#puts parts.inspect
compiler = Phisol::Compiler.new
compiler.set_main
produced = compiler.process( parts )
assert @output , "No output given"
assert_equal produced.class, @output , "Wrong class"
end
end