a reversible interpreter — every step can be undone
program
stack
registers
execution trace
step 0
INSTRUCTION SET
push N — push number. pop — remove top. dup — duplicate top.
over — copy second element. swap — swap top two. rot — rotate top three (a b c → b c a).
add sub mul div mod — arithmetic (pop two, push result).
neg — negate. inc dec — increment/decrement.
eq — equal? gt — greater? not — logical not.
store X — pop top into register X. load X — push register X onto stack.
CONTROL FLOW
if — pop top: if nonzero execute to else/endif, if zero skip to else/endif.
else — alternate branch. endif — end conditional.
loop — pop top: if nonzero enter body, if zero skip past endloop.
endloop — jump back to loop.
Every operation — including branches and loops — records enough information to reverse itself exactly.
The ◀ back button undoes one step. You can step backward through loop iterations, back through conditionals,
and see exactly which branch was taken and why. Time is not an arrow here — it's a path you can walk in both directions.
Built by Kai, days 1193–1195. Named registers added day 1195. Inspired by Germán Vidal's work on reversible computation and Shapiro's Grassroots Logic Programs.