|
File Lectures.html
Author McKeeman
Copyright © 2007
index
A Short Course in Compilers
These lectures are designed for a 10-session class.
It is assumed that the students know MATLAB and elementary mathematics.
The planned lecture format is an hour of lecture followed by an hour
of in-class lab work. The details follow.
If a project is going to be attempted,
it should be done simultaneously.
Lab 1
Lab 2
- Changing the xcom
Cfg object (10 min)
- Look at the Cfg tables (20 min)
- Look at intermediate Cfg output (20 min)
Lab 3
-
Try many examples like
>> xcom -lexDump x:=1
- Add a unit test to testLexer.m (30 min)
-
Add abs
to X (in X.cfg) (20 min)
- Challenge: write a faster lexer. Hint: use MATLAB profiler.
-
Changing the xcom top-down Parser (10 min)
-
Parsing a programming language (40 min)
Lab 4
-
Try many examples like
>> xcom -parseTrace x:=1
>> xcom -parseTrace -bottomUp x:=1
- Add a unit test to testParser.m (20 min)
-
Add abs
to X (in Parser.m) (30 min)
- Challenge: compare speeds of bottom up vs. top down parsing
Lab 5
-
Try many examples like
>> xcom -treeTrace x:=1
>> xcom -treeTrace -noAST x:=1
-
Try many examples like
>> xcom -symTrace x:=1
- Add a unit test to testTree.m (5 min)
- Add a unit test to testSymbols.m (15 min)
-
Adding abs
to X (in Symbols.m) (30 min)
-
Challenge: Rewrite Symbols.m so that it uses
hash lookup.
Lab 6
-
Try many examples like
>> xcom -asmTrace x:=1
>> xcom -asmTrace -exeTrace x:=1
-
Add abs
to X (in AsmX86.m) (15 min)
- Add a unit test to testAsmX86.m (20 min)
- Add a unit test to testEmulate.m (20 min)
- Challenge: Implement AsmA64.m
Lab 7
-
Try many examples like
>> xcom -asmTrace -emitTrace x:=1
- Add a unit test to testEmitX86.m (20 min)
-
Add abs
to X (in EmitX86.m) (30 min)
- Challenge: Implement EmitA64.m (Intel 64-bit)
Lab 8
-
Try many examples like
>> xcom -asmTrace -emitTrace -genTrace x:=1
- Add a unit test to testGenerator.m (20 min)
- Add abs to X (in Generator.m) (30 min)
-
Tradeoffs
between interpreters, JITs and production compilers (20 min)
-
Conventional
Optimization
Strategies (30 min)
Lab 9
- Implement Constant Folding for X as a peephole
Lecture 10
Final Exam
| |