Programming Paradigms Session 10 · Mon 16 November 2026

← all sessions

Session 10

Static Type Systems

typing rules, type safety and a type checker, for a functional language and for an imperative one

Static typing is a program analysis that assigns a type to every expression before the program runs, and rejects a program in which an operation is applied to a value of the wrong type. The session defines typing by inference rules, states what type safety says about a well-typed program, and turns the rules into a checker.

Block 1, Typing of a functional language. We will see what static typing is: an analysis that rejects, before a program runs, the programs whose evaluation could go wrong. For the λ-calculus of session 4, we will define it precisely, with typing rules and the type safety theorem that relates them to evaluation. The rules then extend to mini-ML, where we will see them at work in a type checker written in OCaml.

Block 2, Typing of an imperative language. We will then turn to programs with effects. Our example is a small imperative language with assignments and loops: after recalling its big-step semantics, we will define the typing of its statements. In the lab, we will extend this language with break and continue, in its semantics and in its typing.

Lecture

1Typing of a functional languageWe will see what static typing is: an analysis that rejects, before a program runs, the programs whose evaluation could go wrong. For the λ-calculus of session 4, we will define it precisely, with typing rules and the type safety theorem that relates them to evaluation. The rules then extend to mini-ML, where we will see them at work in a type checker written in OCaml.PDFDemoSlides →
2Typing of an imperative languageWe will then turn to programs with effects. Our example is a small imperative language with assignments and loops: after recalling its big-step semantics, we will define the typing of its statements. In the lab, we will extend this language with break and continue, in its semantics and in its typing.PDFSlides →

Lab

Warm-upExercises on typing, taken from the slides, as one PDF.SolutionsPDF →
QuestThe imperative language of block 2, extended with break and continue.SolutionsPDF →