rubyx/lib/virtual/instructions/virtual_main.rb

24 lines
517 B
Ruby
Raw Normal View History

module Virtual
2014-10-06 18:57:44 +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)
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