CSE 504 Compiler Design

Fall 2026

Grading Schedule Instructor/TA Texts Lectures University Policies

Welcome to CSE 504! Public, mostly static information will be hosted on this page. We will use Brightspace for homework, and Piazza for discussions.


Overview

Computer Science projects increasingly involve the analysis of unstructured textual data. Yet, only a small minority of CS grads are proficient in text-processing with regular expressions and grammars, or have used parsing/transformation tools such as sed, AWK, Lex and Yacc. Students can address this gap by taking this course. Moreover, by understanding the process of code translation and optimization, students can become better at writing efficient yet readable/maintainable code.

Compilers is my favorite subject because it harnesses the beauty of theoretical computer science to solve very concrete software engineering problems. Time and again, it demonstrates how efficient software implementations can be automatically generated from compact, high-level specifications. Compilers also offers a perspective on how research results find their way into practice. Much of the course material originates from research papers written almost 50 years ago but remain every bit as relevant today.

Modern compilers are among the most complex pieces of software around. Through this course, students learn how to break down this complexity --- how to modularize their design, how to make the modules flexible and extensible, how to decouple design and implementation, and finally, how to build efficient implementations. This course will also provide significant experience in object-oriented programming with C++. Modern C++ has been the language of choice for writing high-performance code in recent years.

Course Topics

What is New/Different This Time

With help from AI tools, I expect all of you to be able to develop a language with sufficient new functionality that you will want to use! Check out hash, my hybrid shell, for one example of what is possible. You will develop a similar language called sash ("sane shell"). This project will give you experience in:

AI tools are great resources and can teach you an incredible amount. Use them that way --- not merely as subordinates that complete your work on their own. Your goal is to engage in deep discussions with AI to expand your knowledge of the domain, the tools and their capabilities; refine your design; evaluate implementation choices; and so on.


Schedule:

Lecture time/location: Tuesday/Thursday, 2:00pm to 3:20pm, Old Computer Science 2114.

Thanksgiving Break: November 25 to November 29.

Last lecture: Thursday, December 3.

Final Exam: Thursday, December 17, 11:15am to 1:45pm.


Lecture Slides and Recordings:

Topic
#
Topics and Lecture Recordings Slides
1 Introduction
Organization of a Compiler: 24 mins
PDF
2 Lexical Analysis
  • Regular expressions, Flex: 76 mins
PDF


Instructor:

R. Sekar
Office: 364 New CS Building
Office Hours: Tue/Thu 3:30pm to 4:30pm


Texts:

The primary text is the "Dragon book" --- Compilers: Principles, Techniques, and Tools. If you happen to have an earlier version of the book, that should be fine as well, going back all the way to 1977 version, which is called "Principles of Compiler Design" and has a green dragon on it, as opposed to the purple dragon on the latest version. We will use the textbook for material that has not changed significantly since the green dragon book. Your reference for newer material will be the lecture slides and additional material made available from this page.


Grading

The weighting for programming assignments, midterm and final exams will be roughly as follows.

Although we are going to use AI agents for coding, you need to understand your code and be able to defend it. If you don't do that, then you will likely do poorly in the course for two reasons. First, if you aren't in charge of what is developed, it is most likely that the developed code won't pass all our tests. Second, the bulk of your grade comes from exams, and if you don't understand the code, you will have difficulty answering some of the exam questions. Finally, we may ask you to explain parts of your code in detail, and if you can't, that will be considered grounds for initiating an academic dishonesty case.

You are advised to start working on the projects at the earliest possible time even if the deadlines are far away. The dates the projects are due will be clearly specified. Projects are due by 11:59pm on the specified date. Late projects will be penalized at the rate of 5% for the first day, 15% the second day and 25% per day after that. So, there is no point submitting a project more than 4 days late! No further extensions will be allowed.

Each student gets one late pass that allows them to submit one assignment up to 4 days late. Use the late pass wisely. I will not accept more than one late submission for any reason, including emergencies.

Any form of copying in the course, and all forms of academic dishonesty, are considered serious offenses, and will be prosecuted to the maximum extent permitted by university policies. The minimum penalty for any form of copying, whether from your friends, the Internet or outside sources, or from previous offerings of the course, will be an F-grade. There will be no exceptions.

Student Accessibility Support Center Statement

If you have a physical, psychological, medical, or learning disability that may impact your course work, please contact the Student Accessibility Support Center, Stony Brook Union Suite 107, (631) 632-6748, or at sasc@stonybrook.edu. They will determine with you what accommodations are necessary and appropriate. All information and documentation is confidential.

Academic Integrity Statement

Each student must pursue their academic goals honestly and be personally accountable for all submitted work. Representing another person's work as your own is always wrong. Faculty is required to report any suspected instances of academic dishonesty to the Academic Judiciary. For more comprehensive information on academic integrity, including categories of academic dishonesty, please refer to the academic judiciary website.

Critical Incident Management

Stony Brook University expects students to respect the rights, privileges, and property of other people. Faculty are required to report to the Office of Student Conduct and Community Standards any disruptive behavior that interrupts their ability to teach, compromises the safety of the learning environment, or inhibits students' ability to learn. Further information about most academic matters can be found in the Undergraduate Bulletin, the Undergraduate Class Schedule, and the Faculty-Employee Handbook.