DFIELDSOLUTIONS

Free software

LabCogwork: Watch a program run, one instruction at a time

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).

Free software1 sections · 2 min readBy Dezső Mező.mdFree softwareCogwork

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.

01About the app

Virtual machines

What to take away

  • 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).
  • Download: Cogwork (ZIP)
We build this for clientsFull-stack

Read the full write-up

More from the lab

Browse all entries

Want this looked at on your own system?Start a conversation

5.0
“New shop, more orders in the first week.”Müller Márk · GeekCornerManaging Director · Hungary