%TOPIC%
From LRDE
This page contains the log of the topics of the Compiler Construction Course 1 (CMP1) for AppIng1 students of class EPITA 2013 (i.e., from December 2010 to February 2011). The topic was started with the Formal Languages Course (THL).
CMP 1
Lecture 1: 2010-12-09, 1.5 hours: Introduction to the Project (%roland%)
- The Tiger Project. See the lecture notes:
tiger-project-intro.pdf, tiger-project-intro-handout.pdf and tiger-project-intro-handout-4.pdf.
- 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).
- Tiger Compiler pipeline (front end only)
- Ressources (http://www.lrde.epita.fr/~akim/ccmp/).
Lecture 2: 2010-12-16, 1.5 hours: Introduction to the Project, Development Tools (%roland%)
- The Tiger Project (cont). See the lecture notes:
tiger-project-intro.pdf, tiger-project-intro-handout.pdf and tiger-project-intro-handout-4.pdf.
- 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.
- Other compilation strategies.
- The Tiger Compiler pipe (annotated with tools and steps).
- Front-end: TC-0 - TC-3 (mandatory part), TC-4 - TC-5 (optional part).
- Back-end: TC-6 - TC-9 (optional part).
- Misc: students should overcome Make, Makefiles and seperate compilation, etc.
- Compilers handling multiple input (sources languages) and multiple outputs (target assembly languages/processors).
- Development Tools, section 1 (tc Tasks). See the lecture notes:
dev-tools.pdf, dev-tools-handout.pdf and dev-tools-handout-4.pdf.
- tc architecture and tasks
Lecture 3 & 4: 2011-01-06, 3 hours: Development Tools (%roland%)
- Autoconf and Automake
- History: Unix, Unices, configuration systems (imake, configure), portability issues (broken tools, broken/missing functions, libraries, etc.).
- Generating configure with Autoconf
- The choice of (a subset of) the Bourne Shell for portability reasons.
- Generating to encapsulate tests, simplify, shorten and reuse shell script bits.
- Using the M4 macro language.
- Autotools Diagram: Autoconf.
- Generating Makefile (s) with Automake and configure.
- Generating to simplify and shorten portable Makefile bits.
- Substituting variables (@VAR@) in Makefile.in using configure (BTW: variables listed in configure --help).
- Completing the Autotools diagram: Automake.
- Developer side vs User side.
- A word on aclocal.
- Hands-on example.
- A simple program.
- Writing hello-world.cc.
- Adding Makefile.am.
- Running autoscan.
- Adjusting config.scan to create config.ac (initializing Automake, avoiding autoheader).
- Running alocal, automake -a -c (and installing helpers) and autoconf.
- Running ./configure.
- Running make.
- Running ./hello-world.
- Adding a (static) library.
- Writing the client (hello.cc) and the library (greet.hh and greet.cc).
- Adjusting Makefile.am (lib_LIBRARIES vs noinst_LIBRARIES), and configure.ac (AC_PROG_RANLIB).
- Updating by running make (and not the Autotools).
- Compiling the client (hello) by adjusting Makefile.am (in particular, link to libgreet.a using hello_LDADD).
- Running make again.
- Running ./hello.
- Adding tests.
- TESTS in Makefile.am and make check.
- Compiling test-only (not installed) programs: check_PROGRAMS.
- Distributing.
- make dist.
- make distcheck.
- Don't forget to adjust the arguments of AC_INIT in configure.ac.
- Installing.
- make install.
- configure --prefix, $prefix, $bindir, $libdir, etc. and bin_, lib_ prefixes of primaries (PROGRAMS, LIBRARIES, etc.).
- make uninstall (careful, very limited).
- A simple program.
- Misc.
- Changing variables (e.g. CXXFLAGS) at the configuration step (=./configure CXXFLAGS...=; global) or at the build step (=make CXXFLAGS...=; local).
- autoheader and config.h: getting rid of limitations of using -D options to pass options to the compiler.
- Pros and cons of using multiple Makefile s in a multi-directory project.
- srcdir vs builddir, running configure from a directory other than the source dir.
- Development Tools, section 2 and 3. See the lecture notes:
dev-tools.pdf, dev-tools-handout.pdf and dev-tools-handout-4.pdf.
Lecture 5 & 6: 2011-01-13, 3 hours: Abstract Syntax (%roland%)
- Abstract Syntax, up to section 4.1. See the lecture notes, ast.pdf, ast-handout.pdf and ast-handout-4.pdf.
Lecture 7 & 8: 2011-02-10, 3 hours: Abstract Syntax & Names, Identifiers and Bindings (%roland%)
- Abstract Syntax, up to the end (syntactic sugar & visitors in TC). See the lecture notes, ast.pdf, ast-handout.pdf and ast-handout-4.pdf.
- Names, Identifiers and Bindings (except some slides in section 3, Complications). See the lecture notes, names.pdf, names-handout.pdf and names-handout-4.pdf.
- Width of a compiler pipe (line, function, compilation unit).
-- %roland% - 10 Feb 2011