CS230

Compiler Design


Instructor

Frederic Green, Mathematics/Computer Science, BP 334, ext. 7410. E-mail: fgreen (at) clarku (dot) edu.

Lectures

Tuesdays and Thursdays, 10:25-11:40am, BP326, occasionally in BP310.

Office Hours:

Tuesday 2:30-4:30 and Thursday, 1:15 - 4:30pm.

Text

Compilers: Principles, Techniques, and Tools, Second Edition, Alfred V. Aho, Monica S. Lam, Ravi Sethi, and Jeffrey D. Ullman, Addison-Wesley. Purchase or rent here.

Course Goals

To study the theory and practice of compiler design. In particular, we will discuss the principles and algorithms involved in parsing source programs, analyzing their semantics, and generating intermediate code from them. We will continue with an introduction to some of the design principles of the "back-end" of a compiler: for example, optimization, register allocation and code generation. Practical experience will be gained by writing a small C compiler with MIPS (or the assembly code of your choice) as a target language.

Course Work

Tests will consist of a midterm and a final, comprising 50% of the final grade. The remaining 50% will be determined by the project (see below) and a few written assignments.

The Project

Writing a compiler is no small task, but fear not.... the project will be broken down into a set of five smaller, manageable assignments; you will be introduced to it in due course. Grades are based on functionality (does it work?), design, and documentation.

Course Outline

   The plan of the book will be followed fairly closely.  You are responsible for all material discussed in lectures, and whatever I tell you in the book (certainly not all of it!). Here is a list of topics and the corresponding sections in the text:

I - A model compiler 1,  2
II - Lexical Analysis 3.1 - 3.7, 3.9
III - Parsing 4.1
   A - Review of CF grammars 4.2, 4.3
   B - Top-down parsing
         (recursive descent & LL) 4.4
   C - Bottom-up parsing (LR & LALR) 4.5 - 4.7
IV - Semantic analysis 5.1 - 5.4
V - Intermediate code generation 6.1-6.8
    A - Syntax-directed translation
    B - Abstract syntax trees, triples, etc.
VI - Run-time environments 7.1 - 7.5
VII - Code generation 8.1 - 8.8
VIII - Code optimization 9.1 - 9.4
IX - Other Miscellaneous Topics, from Chapters 10 - 12


Project Assignments

Links


Back to Fred Green's Home Page