Department of Computer Science
CSU Stanislaus
California State University

CS4300-001: Compiler Theory

Fall 2023


 

Instructor Dr. Xuejun Liang

My Office: DBH 282

Office Hours: MW 1:00 p.m.-2:00 p.m. and Th 11:00 a.m. – 12:00 a.m.

ZOOM Meeting ID: 4438930033, Phone: (209) 667-3169, Email: xliang@csustan.edu

 

Class Information

Classroom: DBH 103

Class Date & Time: TR 9:30 a.m. – 10:45 a.m.

Class Website: https://www.cs.csustan.edu/~xliang/Courses2/CS4300-23F

Class Server: wozniak.csustan.edu (You can use PuTTY to remote login.)

 

Course Materials

Required Textbook

Compilers: Principles, Techniques, & Tools, 2/E, by Alfred V. Aho, Monica S. Lam, Ravi Sethi and Jeffrey D. Ullman, Addison Wesley, 2007. ISBN: 9-780-321-486-813

 

Reference Textbooks

1.      Compiler Construction: Principles and Practice, by Kenneth C. Louden, PWS Publishing Company, 1997

2.      flex & bison: Text Processing Tools, by John Levine, O'Reilly Media, Inc., 2009

3.      Modern Compiler Implementation in Java, 2/E, by Andrew W. Appel and Jens Palsberg, Cambridge University Press, 2002

4.      Modern Compiler Implementation in C, by Andrew W. Appel and Maia Ginsburg, Cambridge University Press, 2004

5.      Advanced Compiler Design and Implementation, by Muchnick Steven, Morgan Kaufmann, 2008

6.      Engineering a Compiler, 2nd Edition, by Keith Cooper and Linda Torczon, Addison Wesley, 2011

 

Handouts

1.      Cool Reference Manual

2.      Tour of Cool Support Code

3.      Cool Runtime System

4.      Cool Example Programs

5.      SPIM Simulator manual

6.      Cool Java Documents

 

Reference Materials

1.      Flex manual

2.      JLex manual

3.      JFlex manual

4.      Bison manual

5.      Java CUP manual

6.      Lex - A Lexical Analyzer Generator

 

Lecture Slides

1.      Chapter 1: Introduction (A)

2.      Chapter 2: A Simple Syntax-Directed Translator (A, B, C, D)

3.      Chapter 3: Lexical Analysis (A, B, C, D)

4.      Chapter 4: Syntax Analysis (A, B, C, D, E, F, G, H)

5.      Chapter 5: Syntax-Directed Translation (A, B, C, D)

6.      Cool 1

 

Course Syllabus and Major Topics

 

Course Description

This course is an introduction to the major methods used in compiler implementation. The parsing methods of LL(k) and LR(k) are covered as well as finite state methods for lexical analysis, symbol table construction, internal forms for a program, run time storage management for block structured languages, and an introduction to code optimization.

 

Course Outcomes

Students who successfully complete the course should be able to

  1. Build a compiler for a (simplified) programming language.
  2. Utilize compiler construction tools, such as generators of scanners and parsers.
  3. Apply algorithms for lexical analysis.
  4. Apply algorithms for LL(1), LR(1), and LALR(1) parsing.
  5. Select an intermediate representation, translate expressions, and check types.
  6. Describe how the compiler creates and manages a run-time environment to support execution of its target programs.

7.      Describe how the code generator performs instruction selection, register allocation and assignment, and instruction ordering.

 

Homework Assignments

Homework assignments will be announced in class and available on Canvas.

You will submit your assignments on Canvas.

 

Programming Assignments and Projects (Thanks to Professor Alex Aiken)

Programming assignments and projects will be announced in class and available on Canvas.

You will get skeleton programming files, compile and run your programs, and submit your programming files on the class server.