Syllabus: CS541, Compiler Design, Fall 2018

CS541 is an course covering many aspects of compiling programming languages. It covers both the theory and practice of compiler-writing tools, such as lexical analyzers and parser generators, as well as symbol tables, runtime organization for simple and structured variables, and code generation. As a prerequisite, you should be adept in programming in a modern programming language (you will complete all assignments in Java) and have knowledge of machine organization (you will compile for the Java Virtual Machine, which we will describe in class).

You will complete a five-stage project that creates a comprehensive compiler (symbol table, lexical analyzer, parser, semantic checker, and code generator).

The first half of the class is devoted to lectures on the theory of scanning and parsing. The second half deals with practical matters of building a compiler. Each class session will present an oddity of Java.

Learning Outcomes

By the end of the course, you will be able to:

Times and places

Class FPAT 267, MWF 2:00pm ‒ 2:50pm
Instructor Raphael Finkel
E-mail raphael
Office Hardymon 230 (7-3885)
Office hours M 12n-1:30p, Th 10a-11:30a.


There are five programming assignments corresponding to five stages of a compiler. All are based on CSX_go (Computer Science eXperimental - Go syntax). Professor Charles Fischer, the author of our textbook, designed the original CSX language and the assignments.

I encourage you to use the machines in the MultiLab on the second floor of the Engineering Annex ( The tools you need are available there. You automatically get a class account at the MultiLab. You need to use a secure shell to contact these computers from elsewhere; you can use ssh from Unix, putty ( from Win32 machines, or MindTerm ( from any browser. If you use a secure shell to access the MultiLab, it is best to connect to or You may construct your programs on any computer you wish, but they must run properly on Linux in the MultiLab.

You must complete your assignments in Java.


Aug 20 1
Aug 27 2
Sep 3 3a
Sep 10  r  4
Sep 17 5
Sep 24 6b
Oct 1 7  7
Oct 8  8m
Oct 15 8c
Oct 22 9
Oct 29 10
Nov 5 10 10 11d
Nov 12 11  11  11
Nov 19 12 n
Nov 26 12  12 12e
Dec 3 13 14g 14
Dec 12  f
Code Meaning
1‒14 Chapter in the textbook
a-e Assignment due
Absolute deadline (class time)
Midterm exam
Discuss midterm exam
No class - University holiday
No class - Religious holiday
Final: Wednesday Dec 12, 1:00pm‒3:00pm


The text for the course is Charles N. Fischer, Ron K. Cytron, and Richard J. LeBlanc, Jr, Crafting a Compiler Addison-Wesley ISBN 978-0-13-606705-4, 2010.

There are many other good books on compiler construction, including:

  1. Aho, Sethi, Ullman, Compilers: Theory and Practice, Addison-Wesley, 1990. A classic.
  2. Michael L. Scott, Programming Language Pragmatics, Fourth Edition, Morgan Kaufmann, 2016


You will be graded 50% on programs and 50% on the tests. The final will only cover material in the course presented after the midterm. You are not graded on class attendance, but you really need to come to class.

Our accreditation association and the policy of the Graduate School require that there be different assignments and grading criteria for undergraduate students and graduate students in 400G and 500-level courses. Undergraduate students must contact me in the first week for details on the special criteria I will apply to you.

For programs, correctness is an important criterion, but is by no means the whole story. Grades on programs are based on

Extra credit is available on all programs. Don't attempt extra work until you have the basic assignment ready to hand in. Extra credit is only be used after initial final grades are assigned to raise grades that are close to borderlines.

Late penalty

Late programs are penalized 3% for each day late, starting at class time on the due date, but not including weekends or holidays. (Allowances for computer failure are announced in class and by the class mailing list.) The maximum penalty is 7 days late; after that, you may hand in the program and still get 79% until class time on the absolute deadline: Wednesday of the last week of classes. No extra credit is available on late programs. If you turn in a program early, you gain early credits (which also ignore weekends and holidays), which are only used to offset late penalties on other assignments but have no other value.

How to submit programs

Submit all work electronically. Collect all the files in your assignment (including program, documentation, test data, and output, into a single file (you may use shar, rar, zip, gzip, bzip2, or tar) and submit it to This online facility time-stamps your submission.

Responsible use of computers

You are expected to use the computing facilities on campus in accordance with standards of honesty and personal conduct. Those standards, outlined in the University of Kentucky Policy governing access to and use of University of Kentucky computing resources , available at \s-2\s+2, call for all members of the community to act in a responsible, ethical, and professional way. This note offers guidelines in applying those standards to use of these facilities.

The operating systems used by our facilities encourage sharing of information. Security mechanisms for protecting information from unintended access, from within the system or from the outside, are minimal. These mechanisms, by themselves, are not sufficient for a large community in which protection of individual privacy is as important as sharing. Users must supplement the system's security mechanisms by using the system in a manner that preserves the privacy of others.

For example, users should not attempt to gain access to the files or directories of another user without clear authorization from the other user (typically that authorization is expressed by setting file access permissions to allow public or group reading). Nor should users attempt to intercept any network communications, such as electronic mail or user-to-user dialog. A shared program should not secretly collect information about its users. Personal information about individuals, which a user would not normally disseminate, should not be stored or communicated on the system. Examples of such personal information are grades or letters of recommendation.

Actions taken by users intentionally to interfere with or to alter the integrity of the system are out of bounds. Such actions include unauthorized use of accounts, impersonation of other individuals in communications, attempts to capture or crack passwords or encryption, and destruction or alteration of data or programs belonging to other users. Equally unacceptable are intentional efforts to restrict or deny access by legitimate users to the system.


The assignments for this class are similar to ones assigned in previous semesters. You may not refer to any work submitted or published (on github, for example) by previous students. All academic work, written or otherwise, that you submit is expected to be the result of your own thought, research, or self-expression. You may certainly discuss the programs with each other, but you must not show each other your code; everyone must develop the code completely independently. It is a serious offense to allow other students to copy your work or to copy the work of other students (even if it is in a public computer file). If you borrow ideas, algorithms, wording, or code from other sources, you must acknowledge that fact or you have committed plagiarism. If you directly take more than about 4 words in a row from any source, you must indicate that you have done so, typically with a footnote or an in-line citation, using indentation or quote marks to set off the quoted text. (I took some of this text years ago from an online plagiarism guide.)  I punish offenses against this policy quite strictly.