VM – Updated Instructions

Assign Assign an expression to a variable. Execute a pre-parsed expression tree and store the resulting value in a variable. Expression can either be written as an algebraic math expression or a list of simple operations separated with ;
Call Call a function. Call creates a return entry on the stack and will continue with next instruction as End of the function is reached. Call can in contrary to raise also capture event’s raised by Raise.
Decode Unpack a bit field
Encode Pack a bit field
End End a conditional block of code by jumping to a pre-calculated ix on the stack. For (as an example) will insert it’s own ix on the stack, End will jump to that ix and remove it from the stack.
Exit Exit the VM. Will terminate the current module.
For For Loop. Will create a stack return entry causing the next End instruction to jump back to the loop start.
If If statement to allow high Level if..elsif..else with Expressions.
Nop No Operation. Basically not needed except usefully for testing basic performance.
Raise Call an event with parameters without creating a return entry. As the vent reach “End” it will return to the previous “Call” return point.
Switch TBD
While Loop while an expression is true.

The VM consist of only 12 very high level instructions that each equals a high Level Language control statement. The actual Assembly language will use more keywords, but this is the actual binary instructions.. This design will secure that applications are small and execute with high performance. I will add more intructions if I need more for optimization reasons, but 12 instructions are also good for keeping a low footprint.

Leave a Reply