COP 4620 – Programming Language Translation
COP 5625 (Regular & FEEDS) – Compiler Writing I
Fall 2003

New or updated items as of 9 Dec 2003:
    Sample output code, Codegen diagrams

Prerequisites:  

Data structures, C or C++ language programming, and assembly language concepts on any machine.  Note well that this is a programming intensive course and good C/C++ programming skills are absolutely required for success.

Catalog Description for COP 4620:

An introduction to compiler writing principles, tools, and techniques through a combination of study and programming projects. Both the underlying theory and implementation will be covered. Specific topics include overall organization of a compiler, scanning, grammars, top-down and bottom-up parsing, symbol table management, semantic analysis, code generation and memory management.

Catalog Description for COP 5625:

A comprehensive study of the issues involved in compiler construction. Lexical, syntactic and semantic analysis; code generation; run-time support; error handling. Each student will write a complete compiler.

Objectives:    

To develop an understanding of the basic principles, techniques, and tools of compiler writing through reading and practice.

Textbook:   

Modern Compiler Design by Grune, Bal, Jacobs, & Langendoen, John Wiley & Sons, 2000, ISBN 0-471-97697-0

Lecture PowerPoint Presentations

Professor:   

Roy B. Levow, Professor of Computer Science and Engineering
Office: LA-322B (Davie)        Office hours: WTh 3:30 - 6:50 pm
Office: SE-418 (Boca)            Office hours:  TBA
Phone:  (954) 236-1170         FAX:  (954) 326-1298
E-mail:  roy@cse.fau.edu        Web: http://www.cse.fau.edu

Time and place:  

Th 7:10 - 10:00 pm
Davie: LA-225 Davie Campus (live)
Boca Raton Campus: ULR Studio 3 (video conference)
Lecture from the Davie Campus will be broadcast over a live two-way link to the Boca Raton Campus.

Topics:

    1.  An overview of compiler design and operation
    2.  Scanning and lexical analysis
    3.  Grammars, parsing, and parser generation
    4.  Symbol table management
    5.  Semantic processing
    6.  Run-time memory management
    7.  Processing declarations, expressions, control structures
    8.  Processing subprograms and calls
    9.  Code generation
    10. Error recovery
    11. Optimization
    12. Compiling object-oriented languages

Compiler Project:

Students, individually or in teams of two, will be required to write a complete compiler for a small language, implemented in C.  The scope of the project will vary with the course level (undergraduate or graduate) and will depend on whether it is an individual or pair project.

Language Specification

The language for the project is a hybrid of C++ and Java.  For students working individually, a program will consist of just one class, as a wrapper for the program.  Code will be strictly procedural with no object instantiation.  Students working as a team will have to a simple object-oriented language that allows multiple classes and creation of multiple object instances.  All class components will be public.  All classes will inherit from a common class Object (as in Java) but there will be no other inheritance.

Code samples can be seen here.
Codegen diagrams from class can be seen here.

Project Phase 1:  Due Oct. 2 (FEEDS 10/9).

Phase 1 is the scanner.  Students working individually do not need to handle the "Additional" keywords and special characters.  Students working on a team need to handle all lexical components.  Each call to the scanner should return the next token along with it's value if needed.  Students working in a team must also record the line number and starting character position on the line of each token.  This is useful for error reporting.  The input should be read from a text fille.  A driver program should be written that takes the input file name as a command line parameter and prints a list of tokens, their values, and (for teams) their location in the input text.

Project Phase 2:

Generate AST.  Operator precedence parsing should be used to generate the AST for expressions.

Project Phase 3:

Code generation.  Target code (v.2) is a subset of C/C++ emulating a 1-1/2 address register architecture machine. 

Project submissions

Source code, executable code (PC or Unix), and your test output for each phase of the program are to be submitted using hwroy.  Printed program listings and test output are to be submitted in class, througth FEEDS, or to my office mailbox in either Boca or Davie.

Grading:

The compiler project will be the primary basis for the course grade. There will be at least two milestones for project work during the term at which time work-in-progress will be submitted for evaluation.  The project will be designed to allow completion within a single term.  In exceptional circumstances, incompletes may be granted to students who do not finish the project by the end of the term to allow a limited amount of additional time to complete the project.  In order to receive an incomplete, a student must have submitted satisfactory work-in-progress for milestone review.  There will be a penalty depending of the delay in submitting the project and the amount of work remaining to be done at the end of the term.

Accounts: 

All students must obtain a CSE Unix account.