Homework and the Project

Reading Assignments

There is one traditional textbook, which you are expected to read cover to cover:

LMB John R. Levine, Tony Mason, and Doug Brown
Lex & Yacc
O'Reilly & Associates, 1992.
ISBN: 1565920007

A good idea is to first sit down for a set period of time (e.g., 60 minutes) and read the book like a comic book. Do not really read anything, but look at every single page (in order): skim a little, look a little. Your mind will subconsciously remember things later when you have to read the books in detail.

The table below lists what you are required to read by what date:

Read by Book What Comments
8/31/2004 LMB All Skim the whole book
9/2/2004 LMB Chs.1 and 2 Learn Lex
9/9/2004 LMB Ch. 6 Lex reference
9/30/2004 LMB Ch. 3 Learn Yacc
10/7/2004 LMB Chs. 7 and 8 Yacc reference and oddities
10/14/2004 LMB Ch. 4 Lex/Yacc Menu Example
10/21/2004 LMB Ch. 5 Lex/Yacc SQL Example

Homework Assignments

Due Date Link Solution
9/9/2004 hw1.html hw1-soln.c
9/23/2004 hw2.html
10/1/2004 hw3.html
10/15/2004 hw4.html
11/8/2004 hw5.html Class examples
11/23/2004 hw6.html Solutions: Class or Mine

Resources of Interest

Lex, flex, yacc, byacc, and bison can easily be found on Linux, FreeBSD, and Mac OS X systems. Searching on the web will find them for other operating systems, too (e.g., Cygwin for Windows). These are tools aimed at C and C++ programmers. There are similar tools for other languages available on the Internet (e.g., jyacc for Java).

Class Project

During this semester, each student will will write a complete compiler for the class language in C or C++ (see the Language link at the top of any class web page). If you do not know either of these languages, learn one right away or drop the class immediately. This is going to be a heavy programming course. Swapping codes with others is expressly forbidden unless authorized by me in advance. If in doubt, contact me first. Otherwise you might find yourself in deep, deep trouble legally.

Due dates will be on this page in this section as the semester progresses. You are under no obligation to turn your project in at the last minute. If you can finish it in November, you might discover that you are done with the course.

Warning: The due dates are currently approximate. Watch this page for the exact dates.

Due Date Percentage Link Solutions What is Due
10/11/2004 20 project1.html Lexers The lexer
11/3/2004 30 project2.html BNFs The parser
12/9/2004 50 project3.html The code generator

Once a part is due and graded, I might post a solution. You will have the option of using your own part(s) or the posted one(s). I strongly urge you to evaluate the posted solutions and see if you can do better by modifying your own work. If so, I might post yours instead.

Note that the code generator takes a good bit of time to do. It is much trickier than you think it is. You had better get right on it once your parser is done or you will never finish it by the due date. If you wait until December to start, you are really sunk. I do not plan on giving any Incompletes.