2015-07-17 12:21:57 +02:00
|
|
|
module Virtual
|
2014-10-06 18:57:44 +02:00
|
|
|
|
2015-07-17 12:21:57 +02:00
|
|
|
# This starts the Virtual machine machine at the given function.
|
2015-06-10 10:43:50 +02:00
|
|
|
|
2014-10-06 18:57:44 +02:00
|
|
|
# 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)
|
|
|
|
|
2015-07-17 12:21:57 +02:00
|
|
|
class VirtualMain < Instruction
|
2015-06-10 10:43:50 +02:00
|
|
|
include Positioned
|
|
|
|
|
2014-10-06 18:57:44 +02:00
|
|
|
def initialize method
|
|
|
|
@method = method
|
|
|
|
end
|
|
|
|
attr_reader :method
|
2015-06-10 10:43:50 +02:00
|
|
|
def word_length
|
|
|
|
4
|
|
|
|
end
|
2015-07-18 10:21:49 +02:00
|
|
|
|
|
|
|
def to_s
|
|
|
|
"#{self.class.name}( method: #{method.name})"
|
|
|
|
end
|
2014-10-06 18:57:44 +02:00
|
|
|
end
|
2015-06-10 10:43:50 +02:00
|
|
|
end
|