Let’s build a CPU with Ruby!
Ruby is a deliciously high-level language. It allows you to focus on what you want to do, and not care about how to do it. All of this is made possible by object orientation, garbage collection, dynamic typing, metaprogramming, closures, etc.
A CPU has no knowledge about these high-level concepts, however. It knows about registers, stacks, frame pointers, labels, conditional jumps, etc—far from what we’re used to in Ruby!
In this talk, I’ll design a CPU from the ground up, and write a simulator for it in Ruby. It’s not a particularly useful thing to do, but it will give you some insight in how a computer works under the hood, and it’s fun!