fix the if syntax and branches

This commit is contained in:
Torsten Ruger
2015-10-19 16:22:24 +03:00
parent 1fd937927c
commit 99cff3aa32
5 changed files with 44 additions and 53 deletions

View File

@ -29,7 +29,7 @@ class Integer < Object
div = self / 10
int rest
rest = self - div
if_nonzero( rest )
if_notzero( rest )
rest = self.digit( rest )
str = str + rest
else
@ -58,7 +58,7 @@ HERE
# Phisol::Compiler.compile( statements , Virtual.machine.space.get_main )
@interpreter = Interpreter::Interpreter.new
@interpreter.start Virtual.machine.init
#show_ticks # get output of what is
# show_ticks # get output of what is
["Branch","LoadConstant","GetSlot","SetSlot","RegisterTransfer",
"FunctionCall","SaveReturn","GetSlot","LoadConstant","SetSlot",
"LoadConstant","SetSlot","RegisterTransfer","FunctionCall","SaveReturn",
@ -67,23 +67,14 @@ HERE
"SetSlot","RegisterTransfer","FunctionCall","SaveReturn","GetSlot",
"LoadConstant","OperatorInstruction","GetSlot","SetSlot","GetSlot",
"GetSlot","GetSlot","OperatorInstruction","GetSlot","SetSlot",
"GetSlot","GetSlot","IsZero","GetSlot","GetSlot",
"GetSlot","SetSlot","LoadConstant","SetSlot","GetSlot",
"GetSlot","GetSlot","IsNotzero","GetSlot","GetSlot",
"SetSlot","LoadConstant","SetSlot","GetSlot","GetSlot",
"SetSlot","RegisterTransfer","FunctionCall","SaveReturn","GetSlot",
"LoadConstant","OperatorInstruction","GetSlot","SetSlot","GetSlot",
"GetSlot","GetSlot","OperatorInstruction","GetSlot","SetSlot",
"GetSlot","GetSlot","IsZero","GetSlot","GetSlot",
"GetSlot","SetSlot","LoadConstant","SetSlot","GetSlot",
"SetSlot","RegisterTransfer","FunctionCall","SaveReturn","GetSlot",
"LoadConstant","OperatorInstruction","GetSlot","SetSlot","GetSlot",
"GetSlot","GetSlot","OperatorInstruction","GetSlot","SetSlot",
"GetSlot","GetSlot","IsZero","GetSlot","GetSlot",
"GetSlot","SetSlot","LoadConstant","SetSlot","GetSlot",
"SetSlot","RegisterTransfer","FunctionCall","SaveReturn","GetSlot",
"LoadConstant","OperatorInstruction","GetSlot","SetSlot","GetSlot",
"GetSlot","GetSlot","OperatorInstruction","GetSlot","SetSlot",
"GetSlot","GetSlot","IsZero","GetSlot","GetSlot",
"GetSlot"].each_with_index do |name , index|
"LoadConstant","OperatorInstruction","IsZero","LoadConstant","GetSlot",
"LoadConstant","OperatorInstruction","IsZero","LoadConstant","GetSlot",
"LoadConstant","OperatorInstruction","IsZero","LoadConstant","GetSlot",
"LoadConstant","OperatorInstruction","IsZero","LoadConstant","GetSlot",
"LoadConstant","OperatorInstruction","IsZero","LoadConstant","NilClass"].each_with_index do |name , index|
got = ticks(1)
assert got.class.name.index(name) , "Wrong class for #{index+1}, expect #{name} , got #{got}"
end