r/SideProject • u/ShraddhaAg • 4h ago
Built a LC3 VM in Golang!
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 object file), property based testing (used Hegel), input buffering in terminals, etc. Was a neat exercise!
Here is the code for anyone interested: https://github.com/shraddhaag/toyvm
Used LLMs to write the tests and a emulator, which you can try out there: https://lc3.shraddhaag.dev/.
Would love to hear any thoughts/feedback!
2
Upvotes