Hello! This is the course project repo for the "Write a Compiler" course. This project will serve as the central point of discussion, code sharing, debugging, and other matters related to the compiler project.
Although each person will work on their own compiler, it is requested that all participants work from this central project, but in a separate branch. You'll perform these setup steps:
bash % git clone https://github.com/dabeaz/compilers_2020_05
bash % cd compilers_2020_05
bash % git checkout -b yourname
bash % git push -u origin yourname
There are a couple of thought on this approach. First, it makes it easier for me to look at your code and answer questions (you can point me at your code, raise an issue, etc.). It also makes it easier for everyone else to look at your code and to get ideas. Writing a compiler is difficult. Everyone is going to have different ideas about the implementation, testing, and other matters. By having all of the code in one place and in different branches, it will be better.
I will also be using the repo to commit materials, solutions, and other things as the course nears and during the course.
Finally, the repo serves as a good historical record for everything that happened during the course after the fact.
Best, Dave
Everything in this repo is subject to change up until the course start date. Free feel to look around now, but you may want to check back from time to time to see what's new.
The course is conducted live from 09:30 to 17:30 US Central Time on Zoom. The meeting will be open about 30 minutes prior to the starttime. Meeting details are as follows:
Topic: Write a Compiler, May 4-8, 2020. Time: 09:00 - 18:00 US CDT (UTC-05:00).
Join Zoom Meeting https://us02web.zoom.us/j/82940491798?pwd=U05FZ1FIZHhTeWNWbitkWlNOOFk3Zz09
Meeting ID: 829 4049 1798. Password: 016509.
Here are some of the basic software requirements:
- Python 3.6 or newer.
- llvmlite
- Clang C/C++ compiler.
One easy way to get llvmlite is to install the Anaconda Python distribution. If you intend to write a compiler in a different language than Python, you will need to investigate the availability of tools for generating LLVM. There is probably some library similar to llvmlite.
If you're looking to get started, there are some warmup exercises posted on the wiki. Reposted here.
Short video lectures will introduce important parts of the project. They will be posted here about a day in advance (an email notification will also be sent).
- Course Introduction (20 min) PDF
- Part 0 - Preliminaries (7 min) PDF
- Part 1 - Structure of Programs (9 min) PDF
- Part 2 - Evaluation of Programs (11 min) PDF
- Part 3 - Lexing (PDF)
- Part 4 - Parsing (26 min) PDF
- Part 5 - Type Checking (13 min) PDF
- Part 6 - Code Generation (11 min) PDF
- Part 7 - Transformations (5 min) PDF
- Part 8 - Intermediate Code (11 min) PDF
- Part 9 - Functions (20 min) PDF
- Part 10 - Advanced Types (15 min) PDF
Video recordings of live sessions will be posted here.
Day 1
- Course Start, Project Demo (36 min)
- Wabbit Language, Project 1 (45 min)
- Project 1, Model Building (33 min)
- Project 1, Day End (47 min)
Day 2
- Project 2, Interpreter (29 min)
- Project 2, Interpreter - Continued (33 min)
- Project 2 End, Project 3 Start (50 min)
- Project 3, Tokenizing, Checkin (11 min)
- Project 4, Parsing Introduction (95 min)
Day 3
- Project 4, Parsing in Practice (67 min)
- Project 4, Parsing, errors, precedence (38 min)
- Project 5, Type Checking (32 min)
- Error Handling (45 min)
Day 4
- Project 6, Code Generation (44 min)
- Code generation (7 min)
- Stacks and code generation (13 min)
- WebAssembly discussion (56 min)