Course material 2010–11
Compiler Construction
Principal lecturer: Dr Timothy Griffin
Taken by: Part IB
Syllabus
Past exam questions
Information for supervisors (There is nothing here. ---tim)
Here are various items for the 2010/11 version of this course:
Exercises
- 2009 exercises : exercises_2009.txt.
- 2010 exercises are being added to exercises_2010.html as they are written.
Lecture-specific materials
- Lecture 1
- Assembler and object files
Input file : test1.c
Assembler code (generated with gcc -S test1.c): test1.s
Object file (generated with gcc -c test1.c): test1.o
Object file in ASCII (generated with readelf -a -t test1.o > test1.o.elf.txt): test1.o.elf.txt
Executable (generated with gcc -o test1 test1.c): test1
Executable in ASCII (generated with readelf -a -t test1 > test1.elf.txt): test1.elf.txt
- Assembler and object files
Supplemental Materials
- ALL HAIL GRACE HOPPER!
-
X86 Assembly.
The Art of Assembly (online Book containing more than most of us will ever know).
MIPS Assembly.
ARM Assembly.
-
What is a Linker?
Beginner's Guide to Linkers
The Linux ELF HOWTO, by Daniel Barlow
-
What is a Loader?
Linkers and Loaders by John Levine.
-
The JAVA Virtual Machine (JVM)
JVM bytecodes
BCPL was doing bytecodes long before they were cool.
- Prolog is typically implemented with a virtual machine.
The Warren Abstract Machine -
Parsing
Lex and Yacc
Yacc is not the only parser generator
Example calculator using Lex and Yacc:
- Makefile
- Lex specification and
- Yacc specification
- Instructions: Download these three files to an empty directory and say "make". If yacc is not installed on your machine, bison may be used instead. Run it by saying "calc". Input lines are things like "1+2*3" "(1+2)*3" etc.
-
Educational compilers.
MinCaml from Eijiro Sumii
Cool = Classroom Object Oriented Language, from Alexander Aiken
VSPL from Martin Richards
-
Selected open source compilers.
GCC, the GNU Compiler Collection
The LLVM Compiler Infrastructure (see the tutorial)
Jikes for Java
The Amsterdam Compiler Kit
Standard ML of New Jersey
whitespace
Moscow ML
OCaml
The Glasgow Haskell Compiler
-
Selected experimental compilers.
Cyclone --- a safe dialect of C.
Idris --- A systems programming language with dependent types.