Compilers
Table of Contents
General Infromation
Courese Number: 337883
Instructor: Jyun-Ao Lin
Location: 第三教學大樓 506(e)
Time: 13:10 – 15:00, Tuesday; 15:10 – 16:00, Friday
Credit
A large part of the course is designed based on Prof. Jean-Christophe Filliâtre's compiler course at ENS.
Overviews
This course is an introduction to the compilation. We will explain the techniques and tools used in different phases of a compiler, up to the production of optimized assembly code. A compiler for a fragment of the Python language to the x86-64 assembly will be made during the course.
Course objectives
- understand the mechanisms behind compilation
- understand the various aspects of programming languages via their compilations
Recommended Prerequisites
Some basic discrete mathematics, computer programming, algorithms, theory of computation.
Communication
When you need help from the course staff, please use office hours or hang around after lecture. For issues requiring privacy, please feel free to email the course instructor.
Office Hours
tue 15:10 – 17:10 & fri 13:00 – 15:00
Topics and Class Schedule
Topics
- x86-64 Assembly Language
- Syntax, Semantics and Interpreter in OCaml
- Lexical Analysis
- Parsing: Syntax Analysis
- Static Typing
- Parameter Passing
- Compiler of Functional Language
- Compiler of Object-Oriented Language
- Optimizing Compiler
- Memory Allocation
Class Schedule
The current schedule is tentative and subject to change.
Date | # | Lecture | Support | related materials |
---|---|---|---|---|
09/10 – 09/13 | 1 | Introduction | handout | |
09/17 – 09/20 | 2 | tue: Holiday/ x86-64 Assembly | handout | [CSA] Chap. 3 & resources of assembly listed below |
09/23 – 09/27 | 3 | x86-64 Assembly (cont.) | same | same as above |
10/01 – 10/04 | 4 | abstract syntax, semantics | handout | [pierce] Chap. 3,4,5 |
10/08 – 10/11 | 5 | interpreter, fri: Holiday | same | same |
10/15 – 10/18 | 6 | lexical analysis | handout | [dragon] Chap. 3 |
10/22 – 10/25 | 7 | the tool lex | same | same |
10/29 – 11/01 | 8 | parsing | handout | [dragon] Chap. 4 |
11/05 – 11/08 | 9 | parsing | same | same |
11/12 – 11/15 | 10 | static typing | handout | [pierce] Chap. 8–10, 12 |
11/19 – 11/22 | 11 | |||
11/26 – 11/29 | 12 | |||
12/03 – 12/06 | 13 | |||
12/10 – 12/13 | 14 | |||
12/17 – 12/20 | 15 | |||
12/24 – 12/27 | 16 | |||
12/31 – 01/03 | 17 | |||
01/06 – 01/10 | 18 |
Useful References
- [dragon] Alfred V. Aho, Monica S. Lam, Ravi Sethi et Jeffrey D. Ullman, Modern Compilers: Principles, Techniques, and Tools.
- [pierce] Benjamin C. Pierce, Types and Programming Languages.
- [CSA] Randal E. Bryant et David R. O'Hallaron, Computer Systems: A Programmer's Perspective.
- Andrew W. Appel, Modern Compiler Implementation in ML
Evalution
Asseignments (50 %)
Final Project (50 %)
Some Useful Resources
OCaml
- Besides OCaml compiler, you will also need
ocamllex
andmenhir
- OCaml.org very rich
- OCaml's Documentation
- OCaml's Standard Library
- Real World OCaml: a book about OCaml from the beginning.
Assembly x86-64
- The webpage of Andrew Tolmach, in particular these notes.
- x86-64 Machine-Level Programming of Randal E. Bryant and David R. O’Hallaron
gdb
the debugger- The site godbolt.org allows you to compare assembly codes produced by different compilers
Acknowledgement and Credits
The course is designed based on Prof. Jean-Christophe Filliâtre's course.