Announcements

Programming Project 4 due Tonight
August 10, 2011

The final programming project is due tonight at 11:59PM. I will be holding extra office hours today from 1 - 4 instead of the usual 1 - 3, and Hrysoula will be holding office hours from 4 - 6. As always, feel free to email us or ask questions on Piazza.

Congratulations on completing the final project of the quarter! How does it feel to have a working compiler?

More on Dataflow Analysis
August 3, 2011

For those of you interested in learning more about data flow analysis and the history of the technique, you can read Kildall's original paper describing this framework here.

Enjoy!

Programming Assignment 3 Due, Programming Assignment 4 Out
July 27, 2011

Programming Assignment 4 (TAC generation) went out today. The assignment is the final piece of your compiler, and by the time you're finished you'll have written a complete compiler in just 8 weeks! It's due Wednesday, August 10 at 11:59PM. You may use up to four late days on this assignment.

Programming Assignment 3 is due tonight at 11:59PM.

Good luck!

Practice Midterm Available
July 16, 2011

A practice midterm has been posted to the handouts section of the course webpage. This is a (slightly longer) version of a midterm given a few years back. The questions on the actual midterm don't necessarily correspond directly to the topics covered in the practice midterm, but they will be on similar material and I strongly suggest taking the time to work through these problems.

As mentioned in class, there will be a midterm review session next Monday in class.

Programming Assignment 2 Due, Programming Assignment 3 Out
July 13, 2011

Programming Assignment 3 (semantic analysis) went out today. This assignment has two parts to it, a scoping component and a typing component, each with a separate deadline. Scoping is due Saturday, July 23 at 11:59PM, and the entire assignment is due on Wednesday, July 27 at 11:59PM. The scoping deadline is a hard deadline and no late days may be used, whereas the overall assignment is subject to the standard late day rules.

This assignment is substantially larger than both of the previous assignments combined, so be sure to start early. As always, if you have questions, please ask on Piazza, drop by office hours, or email the course staff list.

Programming Assignment 2 is due tonight at 11:59PM.

Good luck, and happy semantic analyzing!

Problem Set 2 Out, Due Monday, July 18
July 8, 2011

Problem Set 2 is out and is due Monday, July 18 at 5:00PM. This written assignment will give you a chance to explore the parsing techniques we've covered in the last few weeks in more detail, and hopefully will make you feel much more comfortable with LL and LR parsing.

Good luck!

Programming Assignment 1 Due, Programming Assignment 2 Out
July 1, 2011

Programming Assignment 2 is out and is due Wednesday, July 13 at 11:59PM. It should be a great way to learn how to use the bison tool and will give you a feel for harnessing the parsing techniques from class in the real world. I hope you have a lot of fun with this one - after all, once you've completed it, you'll know how to parse all sorts of languages!

Programming Assignment 1 is due tonight at 11:59PM. If you have any questions, be sure to let us know.

Good luck!

Submission Instructions
June 30, 2011

I've posted submission instructions for the first programming assignment. You can submit either using the Paperless submission site, or through the command-line using our provided tool. Please let us know if you have any trouble submitting, and best of luck on the assignment!

Office Hours and Piazzza
June 24, 2011

We have set up our office hours for the quarter. There are six two-hour slots each week:

  • Keith (Gates 160): Monday/Wednesday, 1:00PM - 3:00PM
  • Hrysoula (Gates 24A): Thursday 7:00PM - 9:00PM, Friday 1:00PM - 3:00PM
  • Riddhi (Gates 24A): Tuesday 7:00PM - 9:00PM, Sunday 12:00PM - 2:00PM

Additionally, we've set up CS143 on Piazzza, so feel free to ask questions there as well.

Problem Set 1 Out, Due July 6
June 23, 2011

Problem Set 1 is out and is due at 5:00PM on July 6. This will give you a chance to play around with the automata constructions we talked about in class, and with the limitations of the scanning algorithm we'll be using.

Good luck, and have fun!

Logging in Remotely
June 23, 2011

Several of you have asked how to log in to the Stanford machines remotely. To do so, you will need an SSH client. On Linux or Mac computers, you can do this from the command-line with ssh. On Windows, you will need to download a SSH client such as PuTTY or SecureCRT (available with your SUNetID here). From there, you will want to connect to either myth.stanford.edu or corn.stanford.edu. You will probably get a warning about a RSA key not matching, which is perfectly fine; these above hostnames will forward you to a free machine on the cluster. From there, you should be good to go!

If you're having trouble logging in, or if you have any other questions, as always feel free to contact us.

Hope this helps!

Programming Assignment 1 Out
June 22, 2011

Assignment 1: Lexical Analysis is out and is due Friday, July 1 at 11:59 PM. This will be a great way to show off your scanning skills and is the first step toward getting a full Decaf compiler up and running.

You will probably want to read over the first section of the Decaf specification before starting this assignment. You'll also certainly want to read our introduction to flex to learn more about the tool you'll be using. As always, feel free to email us if you have any questions!

Good luck!

Office Hours Preferences
June 20, 2011

Our excellent TA Riddhi put together a Doodle form where you can submit times that do not work for you for office hours. Feel free to fill out this form over the next few days so that we can try to find good times for office hours. We're hoping to ensure that there are always office hours you can attend, so if you have some hard conflicts please let us know via the form.

The Doodle can be found here

Welcome to CS143!
June 17, 2011

Welcome to CS143, Stanford's course in the practical and theoretical aspects of compiler construction. We have an exciting quarter ahead of us loaded with that wonderful combination of concepts and coding that makes compilers so cool. Class meets Monday/Wednesday/Friday in Gates B01 from 11:00AM - 12:15PM, and I hope that you're able to join.

In the meantime, feel free to check out the course information handout to learn more about what this class is all about, the prerequisites, and the course policies. If you have any questions in the meantime, feel free to email me at htiek@cs.stanford.edu.

Handouts

00: Course Information
01: CS143 Course Overview
02: Decaf Specification
03: Lexical Analysis
04: flex in a Nutshell
05: Programming Assignment 1
06: Upcoming Readings
07: Problem Set 1 (solutions)
08: Formal Grammars
09: Top-Down Parsing
10: Bottom-Up Parsing
11: LR and SLR Parsing
12: Introduction to bison
13: Programming Assignment 2
14: LALR Parsing
15: Miscellaneous Parsing
16: Syntax-Directed Translation
17: Problem Set 2 (solutions)
18: Semantic Analysis
19: Programming Assignment 3
20: Practice Midterm
21: CS143 Midterm (solution)
22: Runtime Environments
23: Intermediate Representation
24: TAC Examples
25: Programming Assignment 4
26: Code Optimization

Assignments

Programming Assignment 1
Problem Set 1 (solutions)
Programming Assignment 2
Problem Set 2 (solutions)
Programming Assignment 3
Programming Assignment 4

Resources

Submission Instructions
 
Regular Expressions
Flex Online Manual
Bison Online Manual
SPIM Simulator Documentation
 
Unix Reference Documentation
xemacs Command Reference
vi Command Reference
gdb Command Reference
cplusplus.com C++ Reference
CS106L Course Reader (C++ Reference)
 
Fall 2010 CS143 Page

Lectures

00: Introduction to Compilers
    fibonacci.decaf oop.decaf
01: Lexical Analysis
02: Introduction to flex, Syntax Analysis
    simple.l hq9l+.l
03: Top-Down Parsing
04: Top-Down Parsing II, Bottom-Up Parsing
05: Bottom-Up Parsing II
06: Bottom-Up Parsing III
07: Advanced Parsing Techniques
08: Semantic Analysis
09: Type-Checking
10: Type-Checking II
11: Runtime Environments
12: Runtime Environments II
13: TAC
14: IR Optimization
15: Global Optimization
16: Global Optimization II
17: Register Allocation
18: Garbage Collection
19: Code Optimization