CCMP 2
From LRDE
This page contains the log of the topics of the Compiler Construction Course 1 and Compiler Construction Course 2 for AppIng1 students of class EPITA 2010 (i.e., from November 2007 to July 2008). The topic was started with the Formal Languages Lecture; see the ThlLog2010.
Lecture 1: Thursday 2007-12-13 (2 hours): Introduction to the Project, Development Tools (%roland%)
- The Tiger Project.
- Ressources (http://www.lrde.epita.fr/~akim/ccmp/).
- Assignments (http://www.lrde.epita.fr/~akim/ccmp/assignments.html).
- Appel's books.
- Tiger Compiler Reference Manual (http://www.lrde.epita.fr/~akim/ccmp/tiger.html).
- epita.cours.compile.
- Goals (C++, OO, DP, Management, Several Iterations, Testing, Documenting, Maintaining, Fixing, Understanding Computers, English).
- Non goals (Compiler Construction).
- Rules of the Game.
- No copy between groups.
- Tests are part of the project (test cases and frameworks should not be exchanged).
- Fixing mistakes earlier is better.
- Work between groups is encouraged as long as they don't cheat.
- Tests.
- Tests matter.
- Rules.
- A bug => a test.
- A suspicious behavior => one or several tests to isolate it.
- Don't throw away tests!
- Don't exchange tests! (bis repetita).
- C Compilation model (cpp, cc1, as, ld).
- Width of a compiler pipe (line, function, compilation unit).
- Compilers handling multiple input (sources languages) and multiple outputs (target assembly languages/processors).
- The case of GCC.
- Factoring the compiler components: intermediate representation(s).
- Front-end and back-ends.
- The Tiger Compiler pipe (annoted with tools and steps).
- TC-0: Scanner and non-building parser.
- (To be continued.)
- Ressources (http://www.lrde.epita.fr/~akim/ccmp/).
Lecture 2: Thursday 2008-01-10 (4 hours): C++, part 1 (%roland%)
- From C to C++.
- A first glimpse at C++.
- A first class : circle
- Encapsulation.
- Information hiding.
- C++ references.
- C++ I/O streams.
- Overlading operator<< to display circle.
- See the lecture notes from Thierry Géraud: cpp1.pdf.
Lecture 3: Friday 2008-01-11 (4 hours): C++, part 2 (%roland%)
- Rationale for inheritance
- Modularity strikes back
- C shape
- Inheritance in C++
- Abstract class and abstract method
- Definitions + playing with words
- Subclassing
- Playing with types
- Transtyping
- Accessibility
- Polymorphisms
- Coercion
- Inclusion
- Overloading (also called ad hoc polymorphism)
- Parametric polymorphism
- See the lecture notes from Thierry Géraud: cpp2.pdf and cpp3.pdf (section 1).
Lecture 4: Thursday 2008-01-17 (4 hours): C++, part 3 (%roland%)
- Parametric polymorphism
- Definition
- Templated classes
- Duality OO / genericity
- A tour of std containers
- Introduction
- Concepts
- Containers
- See the lecture notes from Thierry Géraud: cpp3.pdf (sections 2 and 3).
Lecture 5: Friday 2008-01-18 (4 hours): C++, part 4; Development Tools for the Tiger Project (%roland%)
- About constructors et al.
- C++ is like C
- C++ idioms
- C++ is just like C: dangerous!
- See the lecture notes from Thierry Géraud: cpp4.pdf (section 2).
- Development Tools (first half).
- See the lecture notes: dev-tools.pdf and dev-tools-handout-4.pdf.
Lecture 6: Thursday 2008-01-24 (2 hours): The Tiger Project, Development Tools for the Tiger Project (cont.) (%roland%)
- Development Tools. See the lecture notes:
dev-tools.pdf and dev-tools-handout-4.pdf.
- The Tiger project (cont.)
- The Tiger Compiler pipe (annotated with tools and steps).
- Front-end: TC-0 - TC-5 (mandatory part).
- Back-end: TC-6 - TC-9 (optional part).
- The Tiger Compiler pipe (annotated with tools and steps).
Lecture 7: Friday 2008-01-25 (2 hours): The Scanner and the Parser (%roland%)
- The Scanner and the Parser. See the lecture notes, scanner.pdf and scanner-handout-4.pdf.
Warning: Display title "CCMP 2" overrides earlier display title "CCMP 1".
Lecture 1: Thursday 2008-02-07 (2 hours): Abstract Syntax (%roland%)
- Abstract Syntax. See the lecture notes, ast.pdf and ast-handout-4.pdf (section 1, Structured Data for Input/Output: Trees).
Lecture 2: Thursday 2008-02-14 (2 hours): Abstract Syntax, cont. (%roland%)
- Abstract Syntax. See the lecture notes, ast.pdf and ast-handout-4.pdf (section 2, Algorithms on trees: Traversals, except the last subsection).
Lecture 3: Thursday 2008-02-21 (2 hours): Abstract Syntax, cont. (%roland%)
- Abstract Syntax. See the lecture notes, ast.pdf and ast-handout-4.pdf (remaining sections).
Lecture 4: Thursday 2008-03-13 (2 hours): Names, identifiers and bindings (%roland%)
- Symbols, Identifiers and Bindings. See the lecture notes, names.pdf and names-handout-4.pdf.
Lecture 5: Thursday 2008-03-20 (2 hours): Type-checking (%roland%)
- Types. See the lecture notes, type-checking.pdf
and type-checking-handout-4.pdf
- Sequent Calculus
- In English: "If alpha is of type Int in the context Gamma and beta is of type Int in the context Gamma,
then alpha + beta is of type Int in the context Gamma."
- Using symbols (where ||- ("tee" or "turnstile") is the symbol meaning "yields" or "proves"):
%TABLE{tableborder="0" tablerules="rows" cellpadding="3" cellspacing="3" databg="none"}%
Γ |- α : Int Γ |- α : Int |
Γ |- α + β : Int |
- Examples of type rules: addition of 2 integers, if-then-else, if-then, addition of 3 integers, comparison of two variables, etc.
- Type inference
- (a_ ? _b : _c_) > 0
- (a_ ? _b : f_ (_b)) > 0
- (a_ ? _b : f_ (_c)) > 0
- Some details on the implementation of types and type-checking within the Tiger Compiler.
- Hierarchy of types (src/type/)
- src/type/README.
- Insight of some visit methods from the TypeChecker.
- Hierarchy of types (src/type/)
Lecture 6: Thursday 2008-03-27 (2 hours): Intermediate languages, part 1 (%roland%)
- Intermediate languages. See the lecture notes, intermediate.pdf and intermediate-handout-4.pdf (pages 1 to 57, Flexible Automatic Memory)
Lecture 7: Thursday 2008-04-03 (2 hours): Intermediate languages, part 2 (%roland%)
- Intermediate languages. See the lecture notes, intermediate.pdf and intermediate-handout-4.pdf (pages 58 to 90, Actors: The translate Module )
-- %roland% - 03 Apr 2008