Elements of Computing Systems Chapter 8

Joel Chippindale edited this page May 7, 2015 · 3 revisions
Clone this wiki locally


Murray and Paul kindly brought refreshments and snacks (I think we have a kitty now) to keep everyone energised.

There was some talk of looking at some of the side projects that people have been putting together between meetings, for example Chris's javascript HDL, but most people were keen to get on with implementing the exercises because we'd have a complete VM translator if we could implement label, goto, if-goto, function, return and call.

The specs that Tom wrote for the VM translator depend on Ruby 2.2 so there was a slight delay while Leo installed Ruby 2.2.2 locally (and was introduced to ruby-install and chruby along the way).


We began by looking at label, goto, and if-goto because these seemed much simpler than functions and we could use BasicLoop and FibonacciSeries as an acceptance tests.

We implemented

There was some discussion about us prefixing '$' to labels when translating which was recommended by the book seemed ugly and unnecessary to some. This is looking forward to handling multiple files where we will need a way to identify labels from different files.

We tried to steer clear of too much refactoring during the meeting, to try to focus on more immediate progress, with the suggestion that if anyone wants to do this outside the meeting (and share the results) then that would be appreciated.

We then moved onto function, call and return which are a little more involved in that between the three of them they take responsibility for recording the current frame on the stack and moving to a new one, and then back again at the end of the function. We spent sometime making sure we all understood exactly how the stack changed in these operations and found page 165's pseudo code for these helpful and also Tom's step by step guide to the calling convention.

We found implementing these more challenging, and still find ourselves both regularly being caught about by whether we have correctly dereferenced values or not and also running before we could walk but we got these working in this series of commits.

This didn't complete the project for chapter 8 because we still needed to handle multiple files but it seemed like a reasonable place to stop and we thought we might start the following meeting by completing this.

Thanks to Leo for his infinite patience channeling the group via vim.