Class: Whitespace::ISA::Swap
- Inherits:
-
Instruction
- Object
- Instruction
- Whitespace::ISA::Swap
- Defined in:
- lib/whitespace/instructions/stack_manipulation/swap.rb
Instance Attribute Summary
Attributes inherited from Instruction
Instance Method Summary collapse
Methods inherited from Instruction
Constructor Details
This class inherits a constructor from Whitespace::ISA::Instruction
Instance Method Details
#execute ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/whitespace/instructions/stack_manipulation/swap.rb', line 3 def execute a = vm.vstack.pop b = vm.vstack.pop vm.vstack.push a vm.vstack.push b end |