THE STACK MACHINE no registers, one stack — push operands, an operator eats the top
A stack machine has no named registers. Operands are pushed; an operator pops its inputs off the top and pushes the result. Expression evaluation becomes a flat instruction stream in postfix order: 2 3 + 4 * pushes 2, pushes 3, adds (leaving 5), pushes 4, multiplies (leaving 20). The stack is the only state, which makes the machine tiny to build and its programs trivial to generate — the reason it underlies the JVM, the CPython VM, WebAssembly, PostScript and Forth. It is the simplest complete execution model, and it is the one i13's own runtime IS.
THE TECHNIQUE push operands, operator pops the top — postfix evaluation
A postfix program run on an array-as-stack. The demo pushes and pops, tracking the stack height, and evaluates 2 3 + 4 *: live demo
HISTORY & CREDIT Bauer-Samelson · Hamblin, 1957
“A machine needs registers to compute.” — a single stack is Turing-complete and enough for any expression: the operator always finds its arguments exactly where it left them, on top. Simplicity, not registers, is what makes it universal to target. cited
1957 · Bauer & Samelson (the Kellerprinzip, stack principle) and, independently, Charles Hamblin (reverse Polish + a running stack) — stack evaluation of expressions. 1961 · Burroughs B5000 — a hardware stack machine. now · JVM, CPython, WebAssembly, Forth, PostScript — and i13's IVM.
The operator never has to say where its operands are: they are on top. That single invariant is why a stack machine is the smallest complete target, and why so many runtimes are one. Bauer-Samelson / Hamblin 1957
RECOMMEND FOR I-13 postfix eval on i13's own stack, computed
On the canonical compiler, the postfix program 2 3 + 4 * evaluates to 20 — and i13's run line reports the stack machine underneath doing the work (peak stack 10 across the recursion):
$ i13 run m_stack.i13 # evaluate 2 3 + 4 * on an array-stack
RUN OK . 257 step(s) . peak stack 10 . call depth 6
result = 20
Recommend: this dart is i13 looking in a mirror. i13's runtime IS a stack machine — the IVM — and every run prints its trace: N step(s) · peak stack M · call depth D. The demo's postfix evaluator runs on that stack machine, so “peak stack 10” is the real IVM height. i13 doesn't need to add the stack machine; it already is one, which is exactly why its validator can prove stack balance in a single pass (dart 259's soundness, the COVERED half of its ledger). The stack machine is not a feature to recommend — it is i13's own floor.