Writing your own C compiler

Course Pages

Stanford  Compiler Design Course (Jeff Ullman)

Notes on formal languages and parsing

Grammars ( LL , LL(1),  LR , SLR , LALR  )

for distinguishing between different kinds of LR grammars see

different kinds of LR grammars
about bottom up parsing in general and about LR and SLR parsers, though it doesn’t discuss much about the differences between the different kinds of LR grammars

Recursively enumerable.
in the above lecture, “unrestricted grammar” is first defined. (page 6 tells) the language generated by unrestricted grammar is recursively enumerable. (page 7) gives the defintions for context sensitive language. the distinction between different kinds of languages is based on the restrictions they put on the grammar (for eg. in CFG, the LHS must be a single non terminal)
Refer notes about chomksy hierarchy to get the distinction between regular, contextfree,context-sensitive etc

Code Generation
This book has details about assembly language – calling convention etc. useful if you are planning to write a compiler.

Data Flow Analysis

for Dataflow Analysis (Reaching definitions, Live Variables etc) see the link (especially scribe notes)
useful to read it in conjunction with the Aho Ullman’s chapters on optimization

compilers vs. Interpreters

Text Books

Engineering a Compiler – Cooper and Torczan
Aho Ullman Sethi – Compiler Design

Reference Books

Advanced Compiler Design and Implementation by Steven S. Muchnick
Compiler Design by Renhard Wilhelm, Dieter Maurer
Modern Compiler Design by D. Grune, H. Bal, C. Jacobs, K. Langendoen
The Art of Compiler Design: Theory and Practice by Thomas Pittman, James  Peters
The Compiler Design Handbook: Optimizations & Machine Code Generation by Y. N.  Srikant, Priti Shankar
A Retargetable C Compiler : Design and Implementation by David R. Hanson,  Christopher W. Fraser


7 Responses to Compilers

  1. gatenotes says:

    Register Allocation (Prof.Alex Aiken)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s