💾 Archived View for dcreager.net › swanson › towers-of-stacks.gmi captured on 2024-06-16 at 12:18:34. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-11-04)

-=-=-=-=-=-=-

Towers of stacks

2023-11-02

Counterpoint to

Staged stacks are just values

Like [Amin2017], we might have a tower of stacks in Swanson. Each basic instruction includes a “delta” indicating which stack it operates on. Stack 0 is the “current” stack, the primary stack that the program operates on. Stacks 1+ are “staged” stacks using their terminology. In some sense, they're not really any different than stack 0. But typically you'd use them to interpret a program in another language. Stack 0 would hold the current runtime state of the interpreter, and stack 1 would hold the current runtime state of the interpreted program. The interpreter somehow translates the other language into a sequence of S₀ instructions, and applies those instructions to stack 1.

[Amin2017] Collapsing towers of interpreters

When invoking a quotation (which must be at the top of one of the stacks), all of the instructions in the quotation's body execute as if its stack is stack 0. (This is why instructions have _deltas_ — from the point of view of any given instruction, stack 0 is the stack containing the quotation containing the instruction.)

..