This book explores control structures in programming languages, covering topics such as sequencing, conditionals, loops, recursion, exceptions, continuations, and concurrency from a formal semantics perspective.
Background
- This is a book-in-progress by Xavier Leroy, a leading French computer scientist and one of the principal developers of the OCaml programming language (a member of the ML family, used heavily in academia, finance, and formal verification).
- Control structures are the constructs (loops, conditionals, function calls, exceptions, etc.) that determine the flow of execution in a program — essentially the "skeleton" of how code runs, beyond just computing values.
- Leroy's treatment is distinguished by its rigorous, mathematical approach: he systematically covers both classic structures (if/else, while, for) and more advanced ones (exceptions, continuations, coroutines), often linking them to formal semantics, compiler implementation, and type theory.
- This matters because understanding control structures deeply is central to mastering programming language design, compiler construction, and formal reasoning about programs — topics Leroy has shaped through his work on OCaml and the CompCert verified C compiler.