shraddhaag/toyvm

A toy VM created for learning for the LC3 computer.

Go

6

54 commits

updated Oct 3, 2026

See the code

See what people are saying

SourceMessageScoreDate

Built a LC3 VM in Golang! (r/SideProject)

I recently build a VM for the Little Computer 3 in Golang. Did it purely as a learning exercise to better understand how VMs work and are implemented internally. I ended up learning not jsut about VMs, but also disassemblers (had to write a disassembler first to see what instructions compose an…

2

Oct 3, 2026

README

Toy VM

VM for the Little Computer 3. This is created for the purpose of learning about VMs, disassemblers and property based testing. Inspired by Justin Meiners and Ryan Pendleton's Write Your Own VM.

LC3 Rogue on toyvm

To test out the LC3 instruction implementation, I am using 2 kind of tests:

  1. Property based tests which makes use of Hegel's library for Golang, hegel-go, found in instructions_property_test.go.
  2. Traditional example based tests, found in instructions_test.go Inspired by Justin Meiners and Ryan Pendleton's Write Your Own VM.

Emulator

Before implementing the VM itself, I wanted to understand:

  1. What is the disassembled output for an LC3 compatible object file.
  2. What does the changing registers and memory look like?

Initially I implemented a disassembler. Later, I converted it into a full blown emulator! You can try it out here: lc3.shraddhaag.dev.

Usage of LLMs

The VM is written entirely by hand.

The tests (both table based tests and property based tests) and the emulator are written with the aid of LLMs.

shraddhaag/toyvm

A toy VM created for learning for the LC3 computer.

Go

6

54 commits

updated Oct 3, 2026

See the code

See what people are saying

SourceMessageScoreDate

Built a LC3 VM in Golang! (r/SideProject)

I recently build a VM for the Little Computer 3 in Golang. Did it purely as a learning exercise to better understand how VMs work and are implemented internally. I ended up learning not jsut about VMs, but also disassemblers (had to write a disassembler first to see what instructions compose an…

2

Oct 3, 2026

README

Toy VM

VM for the Little Computer 3. This is created for the purpose of learning about VMs, disassemblers and property based testing. Inspired by Justin Meiners and Ryan Pendleton's Write Your Own VM.

LC3 Rogue on toyvm

To test out the LC3 instruction implementation, I am using 2 kind of tests:

  1. Property based tests which makes use of Hegel's library for Golang, hegel-go, found in instructions_property_test.go.
  2. Traditional example based tests, found in instructions_test.go Inspired by Justin Meiners and Ryan Pendleton's Write Your Own VM.

Emulator

Before implementing the VM itself, I wanted to understand:

  1. What is the disassembled output for an LC3 compatible object file.
  2. What does the changing registers and memory look like?

Initially I implemented a disassembler. Later, I converted it into a full blown emulator! You can try it out here: lc3.shraddhaag.dev.

Usage of LLMs

The VM is written entirely by hand.

The tests (both table based tests and property based tests) and the emulator are written with the aid of LLMs.

Languages

Go

60.8%

HTML

39.2%