PLAIN – Reviewed VM

My original VM used a 32 bit instruction set that result in a bit of wasted memory, so I am reducing this to 16 bit. This leaves the shortest instruction 16 bit and the longest 16 x 16 bit. I also want to reduce the number of instructions and only keep the high level ones to reduce the size of the VM. The list below is the minimal basic instructions on category 0.

NOP No Operation.
Move Move
Goto Goto/Unconditional jump.
For FOR Loop
Assign Assign operation
While WHILE Loop
Loop Generic Loop
Exit  Terminate a process
Raise Raise an event. The same as calling a function without creating a stack Return entry.
Call Call a function and create a stack Return entry. A function can be PLAIN or C/C++ function.
If If statement
ElsIf Else If Statement
Else Else
Switch Switch

Some of the specialized instructions needed by the parse tree on expressions and math is removed. I plan to implement this differently, but we might need to add some basic instructions back.

Leave a Reply