Skip to main content
๐Ÿ“œ WAYPOINT LESSON

Checkpoint: The Unbreakable Evaluator

โญโญ intermediateโณ 30 min read๐Ÿ“ Lesson 140 of 225

Prove the discipline: an arithmetic evaluator that stays defined on every possible input.

The task

Implement eval_expr (see the challenge). Every graded case is a boundary: saturation at INT_MAX, a number that does not fit, a malformed grammar, NULL arguments. A "works on my machine" evaluator that computes 2147483647 + 1 in int arithmetic would be UB โ€” and UB cannot be trusted to fail the tests; that is precisely why the defined, saturating implementation is the only passing one.

Passing this proves the module's thesis in one component: you can write C that processes arbitrary input with a proof-shaped guarantee โ€” no input can push it off the defined side.

Next module: threads โ€” making multiple things happen at once, safely.