Thursday 7:00 - 9:00 pm
Room 109, Warren Weaver Hall
Professor Edmond Schonberg
Instructor: Edmond Schonberg
Xin Zhang, Room 408 WWH (email@example.com)
All students should register themselves with the class list, which is used for
all technical discussions concerning the course and the course project.
To subscribe to this list visit the web page:
where you will find full directions.
Please send all your questions to this list (not to the instructor) so that
everyone can participate.
Assignment 0 The final project for the course will
involve writing a code generator for the target machine of your choice.
The first step is to review the assembly language for that machine, so
you know what your code generator is supposed to generate! For this zeroth
assignment, you must write a small procedure in assembly language (for
example, your favorite sorting algorithm, quicksort or heapsort prefered)
as well as a test program in C (or the high-level language of your choice)
that calls and tests your assembly routine. Hand in the source for the
assembly program and for the driver, and the output of the program.
Tndicate the machine on which you are running and the assembler you used.
If you need to refresh your knowledge of assembly language, the following
may prove useful:
Free Assembly Tutorial
Free Assembler (NASM)
On a Unix system you can run gcc with the -S switch to obtain the generated
assembly code, which provides the quickest introduction to the conventions
of the assembler on your machine.
Assignment 1: lexical analysis
Assignment 2: Using the GNAT front-end
Assignment 3: table-driven parsing
Assignment 4: intermediate code generation
Assignment 5: register coloring
Grune, Bal, et al. : Modern Compiler Design (Wiley)
This is a recent textbook, with an extensive coverage of modern code generation
techniques, and specialized chapters on the compilation of functional and
logic programs. We will cover selected sections of the text.
Aho, Sethi and Ullman: Compilers, principles, Techniques and tools
This is still a standard text, even though more than 15 years old.
Scott: Programming Language Pragmatics.
A nice balance of language issues and implementation issues, with substantial
elementary information about compiler structures and organization.
Addtional recommended readings:
Fraser and Hanson: a retargetable C compiler (Benjamin Cummings, 1996)
Muchnick: advanced compiler design and implementation (Morgan Kaufman, 1997)
Fisher & LeBlanc : Crafting a Compiler (Benjamin Cummings)
Appel : modern compiler implementation in C : basic techniques
Dewar & Smosna : Microprocessors, a programmer's perspective
Throughout the course we will be referring to the sources of the GNAT
compiler, which will also be the basis of the course project. The
compact overview of GNAT provides a
roadmap to its main components. You can download GNAT for your
favorite machine, and get the full sources of the compiler, from the
NYU ftp site: ftp cs.nyu.edu,
directory pub/gnat. To build the compiler, you will need the sources
for GCC 2.81.
You may also find it useful to browse
the GNAT sources here. To download the entire set, grab gnat-html.zip, unzip it on your local
machine, and point your browser to index.htm.