Syllabus
CSCI 4627
Procedural Languages and Compilers
Spring 2005

Class meeting 9:00-9:50 MWF Austin 306
Instructor Karl Abrahamson
Office Sci&Tech C-113
Office hours MW 10:30-11:45;
MW 2:00-3:15;
or by appointment
Phone 328-9689
Email karl@cs.ecu.edu
Course web page www.cs.ecu.edu/~karl/4627/spr05/
My web page www.cs.ecu.edu/~karl/
Text Compiler Construction: Principles and Practice by Kenneth C. Louden


Prerequisites

CSCI 3510. You should have a good understanding of programming and be able to write well structured and well organized programs in C++.

CSCI 3601. This requirement is not very strong. You should have a general understanding of machine language and binary files, but you will not need to know any machine language or assembly language in detail.

CSCI 3675. You should have seen context-free grammars before, and have an elementary understanding of program evaluation.


Introduction

Compilers are translators that translate from one programming language to another. Early compilers (such as for Fortran and Cobol) were written in a completely ad-hoc way. The cost of writing a compiler was very high, with a typical estimate of 30 person-years to develop a compiler for the relatively simple early languages. The state of the art has improved fantastically since then, with the advent of elegant mathematical tools and related program development tools.

It is useful for a computer scientist to study compiler design for several reasons.

  1. Anyone who does any software development needs to use a compiler. It is a good idea to understand what is going on inside the tools that you use, in order to have a better understanding of their capabilities and their limitations.

  2. Compilers are sophisticated text processors. Most programs need to do some text processing, even if only to read in the contents of a configuration file. Techniques that were developed for writing compilers are useful in a variety of other software.

  3. One of the more useful techniques for software design for large projects is to develop a special-purpose language that makes the project easy to implement. It can take less time and effort, and lead to a higher quality product, to spend the time to develop and implement a small special purpose language and to write the software in that language, than to write the software in a general purpose language.

  4. Compilers benefit tremendously from careful analysis of a problem, and from tools for performing that analysis. A study of compiler design gives a good feeling for how a large problem can be broken down and solved in a manner that is not ad-hoc.

    The methods used for designing compilers are precise and well-developed. A compiler gives a view of a different style of software development, not based on seat-of-the-pants methods, but based on a mathematical description of a problem.

  5. A course in compilers offers a good opportunity to get experience with a larger piece of software.


Course objectives

After completing this course the student should understand both the theory and practice of compiler design, and be able to implement a complete compiler for a small programming language.

The student should also understand how to describe certain kinds of problems and their solutions using the mathematics of attribute grammars.

The student will understand the architecture of a compiler, and the kinds of optimizations that compilers typically perform.


Topics

  1. Overview of compilers. The compilation process and the anatomy of a compiler. (Text, Chapter 1)

  2. Lexical analysis. The role of the lexical analyzer. Finite state machines. Regular expressions. Lexical analysis tools and lexer generators. (Text, Chapter 2)

  3. Context-free grammars. Writing grammars for programming languages. Transformations on grammars. (Text, Chapter 3)

  4. Parsing. Top-down predictive parsing. Recursive descent. Table-driven parsers and LL(1) grammars. Brief study of bottom-up parsing. Discussion of parser generators. (Text, Chapters 4 and 5)

  5. Table management and semantic analysis. The symbol table. (Text, Chapter 6)

  6. Syntax-directed translation. Attribute grammars. (Text, Chapter 8)

  7. Discussion of back-end analysis and improvement. Elementary optimizations. Optimizations typically made by compilers.


Attendance policy

I will not take attendance. It is up to you to attend class. You are responsible for announcements and assignments given in class. If you miss a class, it is up to you to obtain notes and any other information that was provided in the class. Excuses that you did not know about something because you did not come to class and did not obtain the information will not count for anything at all.

Those who choose not to attend class can count on doing poorly in this course. If you choose not to attend class, then you must live with the consequences of that decision, however bad they are.


Incompletes

No incompletes will be issued in this course except for extraordinary circumstances, and even then only if you are nearly done already, and have done work of acceptable quality that it is realistic that you can pass the course. An incomplete will not be given simply because a student could not find the time to work on the programming project. By registering for this course, you are committing to finding time to do the work.


Grading

Grading will be on the basis of homework (10%), a programming project (writing a compiler) (35%), two midterm exams (15% each) and a final exam (25%). Cutoffs for grades will tentatively by 90% for an A, 80% for a B, 70% for a C and 60% for a D. Those cutoffs will not be raised.

Count on the project taking quite a bit of time.


Weather emergencies

In the event of a weather emergency, information about ECU can be accessed through the following sources:

ECU emergency notices http://www.ecu.edu/alert
ECU emergency information hotline 252-328-0062


Students with disabilities

East Carolina University seeks to comply fully with the Americans with Disabilities Act (ADA). Students requesting accommodations based on a covered disability must go to the Department for Disability Support Services, located in Brewster A-114, to verify the disability before any accommodations can occur. The telephone number is 252-328-6799.