Learn · Volume 1
Section 1.4.2. Coroutines
7 exercises: 7 with a written solution, 0 stated in Lean, 0 proved in Lean.
1. Read first
The companion chapter builds on these. Read the ones you do not know yet.
- P1. Proof, induction and invariants
- C1, Section 1.3.1. Description of MIX draft
- C1, Section 1.3.2. The MIX assembly language draft
- C1, Section 1.4.1. Subroutines draft
2. Read the section
Read Section 1.4.2 in your copy of the book. Then read the companion chapter Coroutines (a draft): it explains each item in the words of the handbook, with examples and proofs. The items of the section and their status.
3. Work the exercises
Section 1.4.2
The exercises of Section 1.4.2 are about coroutines: routines that call each other as equals and resume where they left off. Exercise 1 asks why good small examples are rare. Exercises 2 and 3 look at details of the text program, the order of start and the use of the comparison indicator. Exercises 4 to 6 are about linkage: on other machines, with a register that must be kept, and for three coroutines. Exercise 7 asks for a program that reverses the translation of the text.
The programs in these solutions were written for this handbook and run on a MIX simulator. The linkage of exercises 5 and 6 and the program of exercise 7 were tested against independent models in Python. See also the C1 chapter on Section 1.4.2.
A good order is 1, 2, 5, 3, 4, 6, 7.
From the Solutions volume of the handbook. The source.
The list starts with the lowest rating. Try each exercise on paper first. Its page has the hints one at a time, the solution behind a click, and the Lean status.
| Exercise | Rating | Kind | Solution | Lean |
|---|---|---|---|---|
| 1.4.2-1 | 10 | informal | written | not stated yet |
| 1.4.2-5 | 15 | K6 | written | not stated yet |
| 1.4.2-2 | 20 | K3 | written | not stated yet |
| 1.4.2-3 | 20 | K2 | written | not stated yet |
| 1.4.2-4 | 20 | K6 | written | not stated yet |
| 1.4.2-6 | 22 | K6 | written | not stated yet |
| 1.4.2-7 | 30 | K6 | written | not stated yet |
Something is wrong? Report it.