NAND Gates to Tetris, wrap up.
Posted by kernelbob on June 25, 2008
That was a load of fun. I finished all the class projects in The Elements of Computing Systems. The projects got more involved as they got higher-level.
The compiler was the most complex, as you’d expect. Mine came to almost 1400 lines of fairly dense Python.
The math runtime libraries were tricky because the defined VM doesn’t have any real support for overflow detection. On the one hand, it was fun seeing how the authors ruthlessly eliminated complexity in their designs. On the other, it was frustrating working with over-minimalist tools.
For example, there are no operators for <=, >= or != in the high-level language. That simplifies the lexical analyzer because there are no multi-character symbols. But from then on, you’re writing “if (a >= b)” as “if (~(a < b))” which gets old.
Nonetheless, it was good fun.
I highly recommend this exercise to anyone who wants to be sure he really, completely understands software toolchains.
Now, on to the next project!