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
def set_type(type)
# 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
end

View File

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

View File

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

View File

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