Weeks 6–8 · Oct 12 – Nov 1, 2026 · Arrays, functions, scope — and the activation record that makes calls possible.
Start here
Lecture notes →
Where a name lives at run time — in the data area, in a stack frame, or behind a pointer — and the calling conventions that make functions and recursion possible at all.
The full theory for this topic, with diagrams, worked examples and Dragon Book references. This page you are on is only an index.
Your starter code
The compiler you are extending this topic, with every TODO spelled out.student/topic-3-arrays-and-functions/
Assignment: Project 3 · Complex Variables and Functions
Full requirements and submission checklist. Due Nov 1, 2026.
Stuck on the tools rather than the theory? The toolchain tutorials cover make, Git and GitHub, flex and bison.
Class activities
One per class meeting. Ungraded — they exist so that the assignment is not the first time you meet the idea.
Activity 1 — Precedence and Associativity Lab
Six expressions, six trees, then break the precedence table and explain each change by the shape of the tree.
Activity 2 — Arrays Are Address Arithmetic
base + i×w by hand, the two-dimensional generalization, then three different answers to where the base comes from.
Activity 3 — Draw the Activation Record
Predict the frame, compare it with Dragon's general form, check it against the generated assembly, then sabotage the epilogue.
Activity 4 — Trace a Call, Including a Nested One
Caller versus callee, $a0–$a3, $v0, $ra — and why f(1, g(2)) works at all.
Activity 5 — Scope and Shadowing
Predict the output, draw the scope stack, break exitScope, then work out what dynamic scoping would have printed.
Activity 6 — Technical Interview Rehearsal
Eight questions, ten minutes each way, at a whiteboard, out loud.