Homework and the Project

Reading Assignments

There are two textbooks, which you are expected to read cover to cover:

WB David A. Watt and Deryck F. Brown
Programming Language Processors in Java: Compilers and Interpreters
Prentice Hall, 2000
ISBN: 0130257869
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 (60-120 minutes) and read the books like comic books. 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
9/3/2002 LMB Chs.1 and 2 Learn Lex
9/10/2002 LMB Ch. 6 Lex reference
9/17/2002 WB Chs. 1 and 2 Compiler organization
10/1/2002 LMB Chs. 3 and 7 Yacc
10/31/2002 WB Ch. 5 Symbol tables
11/14/2002 WB Ch. 6 Code Generation
11/21/2002 WB Ch. 7 Code Generation
12/4/2002 WB Ch. 8 Code Generation

Resources of Interest

    Lex, yacc, bison, and flex can easily be found on Linux systems. Searching on the web will find them for other operating systems, too. These are tools aimed at C programmers. Java programmers need to find jlex and byacc/java. Byacc/java's page has binaries for installation at the end of the very long web page (which has sample inputs that you should study and save to disk locally).

Class Project

During this semester, the class will be broken up into a number of small groups. Each group will write a complete compiler in both C and Java for a small language. Part of the reason to do this is that you will see advantages and disadvantages in each approach. Using a C to Java or Java to C translator (both are easily found on the Internet) is expressly forbidden and would defeat the purpose of the assignment.

Each group will be competing against each other. By this, the grader is going to time your codes on examples and the faster compilers will score higher in case of ties on quality (and I expect lots of ties). Swapping codes with other groups is expressly forbidden unless authorized by me in advance. If in doubt, contact me first. Otherwise you might find yourself in deep trouble legally.

    In any group, there is usually someone really motivated and someone just working the system. I want the name of who writes each function included in the source code. I will also entertain requests for group re-organizations after each of the first two parts are completed. Warning: Deadbeats will be grouped together and may well fail the course.

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 (except for the pesky quizzes). Warning: The due dates are currently approximate. Watch this page for the exact dates.

Due Date Percentage Link Solutions What is Due
10/3/2002 20 hw1.html Lexers The lexer
11/7/2002 30 hw2.html BNFs The parser
12/12/2002 50 hw3.html The code generator

Once a part is due and graded, I will post a solution on this page. One or more groups will recognize it and possibly get extra credit. You will have the option of using your own part(s) or the posted one. I strongly urge you to evaluate the posted solution and see if you can beat it by modifying your own work. If so, I might post yours instead.