DField SolutionsMérnöki stúdió · Budapest
Loading · Töltődik
Skip to content
Category: Virtual machines

Cogwork

Watch a program run, one instruction at a time.

What it is

Cogwork is a visual virtual machine that lets you watch a program execute one instruction at a time. A two-pass assembler resolves labels to indices, and a roughly 20-opcode stack machine runs the result, with execution modelled as a pure step(program, state) function so the debugger simply renders the resulting state. It is a from-scratch, dependency-light build - 8 tests run real programs like a factorial loop and a max-via-jumps routine - that you can download and run locally.

Two-pass assembler (labels → indices) + a ~20-opcode stack machine where execution is a pure step(program, state) - so the debugger just renders state. 8 tests run real programs (factorial loop, max via jumps).

What's inside

The full source, the tests, and CI. Open it, read it, change it. A zero-dependency core, free, in the MIT spirit.

Run it after unzip

pnpm install && pnpm dev