In this unit, our languages will be extended with basic imperative control structures, namely conditional if/else statements (or expressions), and loops.

We introduce the abstract syntax tree (AST) as capturing the semantics of a program, devoid of syntax. As our languages become more complex, using an automatic parser generator, and explicitly generating an AST, will be helpful in writing reliable and maintainable implementations of PLs.

In terms of compilation, control structures introduce some unique challenges in an SSA language like LLVM IR. We will learn about basic blocks and the control flow graph (CFG) as a useful way to talk about this, and phi nodes as one solution to the problem.

As we think about the semantics of memory management in our languages, we will see some examples from the programming language Rust as one interesting modern approach.

Classes

Homeworks

Labs