This course introduces the fundamental concepts on programming languages, and explain how programs are executed on computers and how a compiler works. In order to deepen understanding of concepts and theory, students do programing assignments on compilers by using the programming language Scala.
By the end of this course, students will be able to:
1. Explain how programs are executed on computers.
2. Explain, for each component of a compiler, what it is for, how it works, and what algorithms it uses.
3. Implement an interpreter and a compiler for simple programming languages.
interpreter, compiler, parsing, code generation, register allocation, garbage collection
|Intercultural skills||Communication skills||✔ Specialist skills||Critical thinking skills||Practical and/or problem-solving skills|
Students learn theories and techniques through lectures and obtain programming skills through programming exercises.
|Course schedule||Required learning|
|Class 1||Overview: how is a program executed||interpreter, compiler, bytecode compiler|
|Class 2||Aunatomata and exical analysis||token, regular expression, NFA, DFA|
|Class 3||Review on context-free grammars||derivation, parse tree, CYK algorithm|
|Class 4||Parsing(1): predictive parsing||Recursive descent parsing, LL(1)|
|Class 5||Parsing(2): basic LR parsing||LR(0)|
|Class 6||Parsing(3): extensions of LR parsing||SLR, LR(1)|
|Class 7||Type systems and type checking||Type systems, polymorphism, subtyping, type checking|
|Class 8||Test level of understanding with exercise problems and overview of the second part of the course||Test level of understanding|
|Class 9||Semantics of programming languages and interpreter||evaluation strategy, operational semantics, interpreter|
|Class 10||Code generation(1): overview, assembly language||assembly language, X86-64, calling convention|
|Class 11||Code generation(2): intermediate language, translation to intermediate language and assembly language||3 address code, translation to intermediate language and assembly language|
|Class 12||Liveness analysis and register allocation||data flow analysis, live variables, interference graph, graph coloring|
|Class 13||Register allocation and code generation||Precolored nodes, coalesce|
|Class 14||Garbage collection||mark and swap collection, copying collection|
|Class 15||Programming: code generation||Implement a code generator|
Course materials are provided during class.
The following is reference books related to this course.
Modern Compiler Implementation in Java， Andrew W. Appel．
Compilers: Principles, Techniques, and Tools, Alfred V. Aho, Monica S. Lam, Ravi Sethi, Jeffrey D. Ullman
Assessment is based on the score of the midterm exam and reports on programming.
Students require the knowledge of automata， context-free grammars, and assembly languages.
Students require to be able to write programs in Scala.