GitHub repository: ma1kawi/simple-stack-machine
Primary language: Java
Created: 2022-02-03T18:30:15Z
Description: The Simple Stack Machine is a stack-based abstract machine, similar in style to (but much simpler than) the Java Virtual Machine. An SSM program is a sequence of 32-bit integers in memory starting at address 0. The SSM starts with an empty operand stack and an empty call-stack. When the call instruction is executed, a new frame is pushed on the call-stack, and a new empty operand stack is created and becomes active. When the ret or retv instruction is executed, the topmost frame of the call-stack is popped, the associated operand stack is discarded, and the previously active operand stack becomes active again. All machine instructions have a 32-bit opcode and take their operands from the currently active operand stack (except for the push instruction, whose operand is the following integer in the code sequence). There are three programmable registers.