CSCI 4570  Compilers Spring 2004

Professor: Krys J. Kochut
Texts: Compilers. Principles, Techniques, and Tools by Alfred V. Aho, Ravi Sethi, Jeffrey D. Ullman, Addison-Wesley 1986.
Grading:
Test I and II 100
Final 130
Programs 170
Grading Scale:
90% - 100% A
80% - 89% B
70% - 79% C
60% - 69% D
below 60% F
Remarks:

In this class the students will study the principles of compiler design and implementation. We will concentrate on the organization of a simple but complete compiler, including the initial phases of a typical front-end. We will begin with scanners, then go on to various parsing techniques, type checking, syntax-directed translation, and code generation. We will also talk about symbol tables, error recovery and runtime systems. Discussions will include compiler compilers (scanner and parser generators), as well code generation and optimization.

Each student is expected to design and implement a simple compiler (the details will be discussed later). All programming should be done in either C++ or C. Development in Java is also possible, but using compiler-compiler tools for Java may be more challenging. The programming project will be split into a few parts to make the development a large program manageable.

Each student is expected to do his/her own work. You are not allowed to work in teams. All suspected cases of academic dishonesty will be handled in strict accordance with department and university policy. The grade of I (incomplete) is reserved for special cases only, such as a serious illness, and will be decided on individual basis.

The course syllabus outlines a general plan for the course and deviations may be necessary.

 

Project:

This semester, the students will be implementing a simple one-pass compiler for Micro C , a small subset of the programming language C.

The programming project will be subdivided into four parts. Current assignments are listed below:

  1. Part 1.
    As an example, I am including a Lex specification file for a simple desk calculator.
    The wordcount (wc) specification presented in class is also available.
  2. Part 2.a) As an example, I am including a YACC specification file for a simple desk calculator, together with the associated LEX specification, and a simple main program.
    A good discussion of shift/reducue and reduce/reduce conflicts is included in the Bison manual.
    A few hints on providing error recovery in YACC-generated parsers are also included.
  3. Part 2.b) As an example of using semantic rules in YACC, I am including a YACC specification file for a simple desk calculator (including evaluation of expressions), together with the associated LEX specification, and a simple main program.
    I also created a page with additional hints on implementing symbol tables.
  4. Part 3. The last programming assignment is to generate intermediate code for the virtual computer, called UGAVAC.
    UGAVAC intermediate code generation should be handled according to the Micro-C code patterns.
    Some hints on how to facilitate code generation for type conversions in passing parameters in function calls are also provided, including the necessary changes to the grammar..

 

Exam dates:
Test I February 19, 2004 regular class time
Test II April 1, 2004 regular class time
Final  May 6, 2004 8:00 - 11:00 am