Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Appendix E — Milestone Index


Under Construction


From Part II onward, each part of this book closes with a milestone: a chapter that specifies the piece of the interpreter the part’s concepts call for, with worked examples and tests to check it against. This appendix lists them, with the part each one closes, what you write, and what is provided.

The exception is M0, which builds none of the language. It is a warm-up for readers new to Rust, and it sits with Appendix A instead of closing Part I.

MilestoneClosesYou writeNewly provided
M0: Rust warm-up — (with Appendix A) a coin purse: the fields of Purse and the bodies of its methods the method signatures and the tests
M1: expressions Part II eval_expr arms for literals, unary and binary operators, tuples, lists, and projection the starter interpreter: the AST, the parser, Value and type_of, RuntimeError and Control
M2: binding Part III arms for variables and blocks (let and sequencing) the environment, Env, with lookup and extend
M3: control and state Part IV arms for if, while, for, :=, and return; ref and deref as new cases of the unary arm the store, Store, with alloc, read, and write
M4: functions Part V arms for lambdas and calls closures (Closure), the call-depth counter, the prelude's native primitives, and the driver that runs a whole program from a file
M5: types Part VI arms of check_expr for the forms of M1–M4, and unify the checker's driver, the typing context Ctx, inference variables, and a helper module printed in the milestone chapter

One interpreter, grown

From M1 on, the milestones extend a single interpreter. The starter repository has an arm in eval_expr for every form of the language from the start, and each arm a milestone fills is a hole tagged with that milestone (todo_m1!, todo_m2!, and so on), so the crate compiles at every stage. One command lists a milestone’s holes:

grep -rn 'todo_m3!' src

The tests follow the same plan. cargo mN runs the tests for milestone N together with those of every earlier milestone, so an arm written for M1 is still checked at M4, and a later change that breaks it shows up as a failing earlier test.

Rust itself is introduced at the point of use across the chapters; Appendix A gathers it in one place.