|Compilers and Computer Architecture (G5035)|
Introduction. Compilers are programs that translate programs from a source language to a target language. Typically, the target language is low level, for example x86 or MIPS machine code, and directly executable on a processor or a virtual machine. In contrast, the source language is usually high-level (e.g. Java, Haskell, Rust, Swift, Scala, or C), not directly executable on machines, and designed to be usable by humans. In other words, compilers bridge the abstraction gap between high-level languages that are convenient for us to use, and low-level languages that can be executed efficiently by machines. Compilers are arguably the most important tool for programmers, and consequently much effort has been expended since the dawn of the age of computing to produce high-quality compilers. Modern compilers are marvels of technology and typically thousands of person-years are invested in the production of a state-of-the-art compiler.
This course will explain how compilers work. The benefits of understanding how compilers work are multifarious.
This is a one-term level 3 course, taught in the autumn term. There are two lectures per week together with exercise classes and programming work for the practical exercises. I have a weekly office hours after the lectures – feel free to come along to ask questions about this course. If you want to meet met at other times, best to send me an email first. Also, feel free to email me if you want to ask questions. The course is assessed by coursework (50%) and by unseen examination (50%). The coursework consists of two parts. The first is a programming exercise to write part of a compiler and the second is another programming exercise (an extension of the first, to complete the compiler project). Due dates TBC.
Topics covered: This course will discuss the key ideas in implementation of compilers for modern programming languages such as Java, including lexical analysis, parsing, semantic analysis based on types and type checking, syntax-directed translation using abstract syntax trees, intermediate languages, and code generation. We will also discuss run-time issues such as garbage collection. Along the way we will look at key ideas in processor architecture such as stack machines and register machines, RISC vs CISC processors and processor caching.
Module learning outcomes. After taking the course students will be able to understand how modern programming languages are translated to machine code, and will be able to write their own compilers.
Times and locations. The lectures take place on Tuesdays 17:00-18:00 in FULTON B and Thursdays 09:00-10:00 in FULTON B.
Pre-requisites: A solid grasp of Java programming is important for this course. This course is not teaching you how to program.
Important links for the course.
Online Material and Books: The course does not follow a set textbook. Instead, suitable lecture notes will be provided. Below is a small selection of supplementary reading material. Most go well beyond what we will cover in the course.