CCMP 2

From LRDE

The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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%)

  1. The Tiger Project.
    1. Ressources (http://www.lrde.epita.fr/~akim/ccmp/).
      1. Assignments (http://www.lrde.epita.fr/~akim/ccmp/assignments.html).
      2. Appel's books.
      3. Tiger Compiler Reference Manual (http://www.lrde.epita.fr/~akim/ccmp/tiger.html).
      4. epita.cours.compile.
    2. Goals (C++, OO, DP, Management, Several Iterations, Testing, Documenting, Maintaining, Fixing, Understanding Computers, English).
    3. Non goals (Compiler Construction).
    4. Rules of the Game.
      1. No copy between groups.
      2. Tests are part of the project (test cases and frameworks should not be exchanged).
      3. Fixing mistakes earlier is better.
      4. Work between groups is encouraged as long as they don't cheat.
    5. Tests.
      1. Tests matter.
      2. Rules.
        1. A bug => a test.
        2. A suspicious behavior => one or several tests to isolate it.
        3. Don't throw away tests!
        4. Don't exchange tests! (bis repetita).
    6. C Compilation model (cpp, cc1, as, ld).
    7. Width of a compiler pipe (line, function, compilation unit).
    8. Compilers handling multiple input (sources languages) and multiple outputs (target assembly languages/processors).
      1. The case of GCC.
      2. Factoring the compiler components: intermediate representation(s).
      3. Front-end and back-ends.
    9. The Tiger Compiler pipe (annoted with tools and steps).
      1. TC-0: Scanner and non-building parser.
      2. (To be continued.)

Lecture 2: Thursday 2008-01-10 (4 hours): C++, part 1 (%roland%)

  1. From C to C++.
  2. A first glimpse at C++.
    1. A first class : circle
    2. Encapsulation.
    3. Information hiding.
  3. C++ references.
  4. C++ I/O streams.
    • Overlading operator<< to display circle.
  1. See the lecture notes from Thierry Géraud: cpp1.pdf.

Lecture 3: Friday 2008-01-11 (4 hours): C++, part 2 (%roland%)

  1. Rationale for inheritance
    1. Modularity strikes back
    2. C shape
  2. Inheritance in C++
    1. Abstract class and abstract method
    2. Definitions + playing with words
    3. Subclassing
  3. Playing with types
    1. Transtyping
    2. Accessibility
  4. Polymorphisms
    1. Coercion
    2. Inclusion
    3. Overloading (also called ad hoc polymorphism)
    4. Parametric polymorphism

Lecture 4: Thursday 2008-01-17 (4 hours): C++, part 3 (%roland%)

  1. Parametric polymorphism
    1. Definition
    2. Templated classes
    3. Duality OO / genericity
  2. A tour of std containers
    1. Introduction
    2. Concepts
    3. Containers

Lecture 5: Friday 2008-01-18 (4 hours): C++, part 4; Development Tools for the Tiger Project (%roland%)

  1. About constructors et al.
    1. C++ is like C
    2. C++ idioms
    3. C++ is just like C: dangerous!
  1. Development Tools (first half).

Lecture 6: Thursday 2008-01-24 (2 hours): The Tiger Project, Development Tools for the Tiger Project (cont.) (%roland%)

  1. Development Tools. See the lecture notes:

dev-tools.pdf and dev-tools-handout-4.pdf.

  1. The Tiger project (cont.)
    1. The Tiger Compiler pipe (annotated with tools and steps).
      1. Front-end: TC-0 - TC-5 (mandatory part).
      2. Back-end: TC-6 - TC-9 (optional part).

Lecture 7: Friday 2008-01-25 (2 hours): The Scanner and the Parser (%roland%)


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%)

Lecture 4: Thursday 2008-03-13 (2 hours): Names, identifiers and bindings (%roland%)

Lecture 5: Thursday 2008-03-20 (2 hours): Type-checking (%roland%)

  1. Types. See the lecture notes, type-checking.pdf

and type-checking-handout-4.pdf

  1. Sequent Calculus
    1. 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."

    1. 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
    1. Examples of type rules: addition of 2 integers, if-then-else, if-then, addition of 3 integers, comparison of two variables, etc.
    2. Type inference
      1. (a_ ? _b : _c_) > 0
      2. (a_ ? _b : f_ (_b)) > 0
      3. (a_ ? _b : f_ (_c)) > 0
  1. Some details on the implementation of types and type-checking within the Tiger Compiler.
    1. Hierarchy of types (src/type/)
      1. src/type/README.
    2. Insight of some visit methods from the TypeChecker.

Lecture 6: Thursday 2008-03-27 (2 hours): Intermediate languages, part 1 (%roland%)

Lecture 7: Thursday 2008-04-03 (2 hours): Intermediate languages, part 2 (%roland%)


-- %roland% - 03 Apr 2008