Move the Main instruction from register to virtual

also needs a branch in register.
This way the register level is self sufficient
(noticed while writing debugger)
This commit is contained in:
Torsten Ruger
2015-07-17 13:21:57 +03:00
parent 60d09ab057
commit 50da6a40f2
11 changed files with 55 additions and 24 deletions

View File

@ -0,0 +1,12 @@
module Register
# a branch must branch to a block.
class Branch < Instruction
def initialize to
raise "No block" unless to
@block = to
end
attr_reader :block
end
end

View File

@ -1,19 +0,0 @@
module Register
# This starts the register machine machine at the given function.
# The implementation is most likely a jump/branch , but since we have the extra layer
# we make good use of it, ie give things descriptive names (what they do, not how)
class RegisterMain < Instruction
include Positioned
def initialize method
@method = method
end
attr_reader :method
def word_length
4
end
end
end