Summary
A
stack_machine evaluates programs using a
stack. Data follows
last_in_first_out order. Instructions use
push to place values and
pop to remove them. Most operations read the
top_of_stack, combine values, then push results. There are few or no general registers. Control moves via an
instruction_pointer. Programs are sequences of simple
opcodes. Arithmetic, comparison, and call_frames use the same
operand_stack. This model is common in
bytecode virtual_machine designs. Remember: stack effects determine how many values each opcode consumes and produces.