# SICP Solutions

### Chapter 5, Computing with Register Machines

#### Exercise 5.19

Here is my approach:

• The main idea is to store the lineno in instructions data-structure.
• When installing a breakpoint, compute the lineno of the intruction where breakpoint needs to be installed and then store this lineno in a breakpoint table.
• While executing, stop the execution if the current lineno being executed is inside the breakpoint table.
• For the case when we proceed from a breakpoint, maintain a flag resume-from-breakpoint?. If this value is set then don’t stop at the breakpoint as well as unset it so that we can stop again at the breakpoint.
• To compute lineno from the offset n given by user, we need lables table. Thus, inside make-machine, now i also installed labels in the machine.

Well, thats it!

I shall first present the main changes and then at the bottom(after example output), will put the complete code.

So, here are the main changes:

#### Complete code:

This code include changes for exercises 5.14 to 5.19: