This is a really simple stack-based virtual machine written in Ruby.
It exists mainly because I wanted to learn more about Ruby.
I'm also thinking it might be a useful way to demonstrate programming language concepts, such as how to translate an expression into a sequence of instructions to evaluate the expression.
Assemble and execute (this is the most useful mode):
./MiniVM.rb -x t/hello.mvm
Assemble and execute interactively (also very useful, see operand stack and output as program executes):
./MiniVM.rb -x -i t/hello.mvm
To assemble a MiniVM assembly language program into an executable:
./MiniVM.rb -a t/hello.mvm hello.mve
To execute an executable file generated by the assembler:
./MiniVM.rb -x hello.mve
To execute an executable file interactively:
./MiniVM.rb -x -i hello.mve
Note that you can run the makeOneFile.rb program to produce a single-file
version of MiniVM.rb and all of the classes it requires. This is useful
if you want to deploy MiniVM.rb.
Documentation.md contains a technical description of MiniVM.
InstructionSet.md documents the instructions supported by MiniVM.
Details of the assembly language can be learned by looking at the
programs in the t directory.
There are probably some bugs.
The diagnostics when error conditions are encountered are inadequate.
More error checking is needed.
MIT license (see LICENSE.txt).