fix interpreter test harness and start testing

interpreter on debug for now
This commit is contained in:
Torsten Ruger 2018-03-22 18:54:40 +02:00
parent e505856af7
commit 34903829ca
4 changed files with 11 additions and 10 deletions

View File

@ -65,7 +65,7 @@ module Parfait
# private # private
def set_type(type) def set_type(type)
# puts "Type was set for #{self.class}" # puts "Type was set for #{self.class}"
raise "not type #{type.class}" unless type.is_a?(Type) raise "not type #{type.class} in #{self}" unless type.is_a?(Type)
@type = type @type = type
end end

View File

@ -17,7 +17,7 @@ module Risc
# fire events for changed pc and register contents # fire events for changed pc and register contents
include Eventable include Eventable
include Logging include Logging
log_level :info log_level :debug
attr_reader :instruction # current instruction or pc attr_reader :instruction # current instruction or pc
attr_reader :clock # current instruction or pc attr_reader :clock # current instruction or pc

View File

@ -9,7 +9,7 @@ module Risc
def setup def setup
Risc.machine.boot Risc.machine.boot
do_clean_compile do_clean_compile
#FIXME Vm.compile_ast( @input ) Vool::VoolCompiler.ruby_to_vool( @string_input )
Collector.collect_space Collector.collect_space
@interpreter = Interpreter.new @interpreter = Interpreter.new
@interpreter.start Risc.machine.init @interpreter.start Risc.machine.init

View File

@ -7,22 +7,23 @@ module Risc
def setup def setup
@string_input = <<HERE @string_input = <<HERE
class Space class Space
int main() def main(arg)
return 5 + 7 return 5.mod4
end end
end end
HERE HERE
@input = s(:statements, s(:return, s(:operator_value, :+, s(:int, 5), s(:int, 7))))
super super
end end
def pest_chain def test_chain
#show_ticks # get output of what is #show_ticks # get output of what is
check_chain [Branch, Label, LoadConstant, SlotToReg, RegToSlot, check_chain [Branch, Label, LoadConstant, SlotToReg, RegToSlot,
LoadConstant, RegToSlot, FunctionCall, Label, LoadConstant, LoadConstant, RegToSlot, FunctionCall, Label, LoadConstant,
LoadConstant, OperatorInstruction, RegToSlot, LoadConstant, SlotToReg, SlotToReg, RegToSlot, LoadConstant, SlotToReg, SlotToReg,
RegToSlot, Label, FunctionReturn, Transfer, Syscall, SlotToReg, RegToSlot, LoadConstant, SlotToReg, SlotToReg,
NilClass] SlotToReg, RegToSlot, LoadConstant, SlotToReg, RegToSlot,
LoadConstant, SlotToReg, RegToSlot, SlotToReg, LoadConstant,
FunctionCall, Label, Label, NilClass]
end end
def pest_get def pest_get