Executable lexical-contract lab
Implementation and evidence: 9–14 hours, inside the 20–30-hour extension. Download the starter, checks, reference and contract. Python 3.10+ with no external dependencies is sufficient.
Read README.md first. The syntax is trusted tagged tuple ASTs; no parser is required. This original evaluator is a deliberately smaller language than Scheme and the existing interpreter-construction clinic. It specifies nonrecursive let, one-argument closures, exact integer arithmetic, boolean conditionals and shared expression fuel.
- Spend 1–2 hours drawing frames and predicting errors without code.
- Run
python3 -B check.py starter; the incomplete starter should fail. Spend 4–6 hours implementing the API and recording intermediate failures. - Spend 2–3 hours adding independent tests and diagnosing a caller-environment mutant. Include two simultaneous adder closures, nested shadowing, eager argument failure and both conditional branches.
- Spend 2–3 hours comparing the reference, explaining type and budget limits, and assembling your evidence. Do not silently replace your implementation with the reference.
Run python3 -B check.py reference only after your attempt. Supplied checks include 121 pairs of captured values plus targeted scope, order, error, type and fuel boundaries. They do not prove all language behavior. Show one additional distinguishing test of your own.
Submit source, command output, frame diagrams, a fault demonstration, scope limitations and assistance disclosure. Passing checks alone does not pass LI1–LI6. Continue existing abstraction, mutation, stream and staging exercises after this bounded lab.