A Retargetable C Compiler Design And Implementation

  • Author: Christopher Fraser
  • Co-Author: David Hanson
  • Publisher: Benjamin/Cummings Publishing Company
  • ISBN-13: 9780805316704
  • Pages: 572
  • Binding: Hard Binding
  • Year of Pub / Reprint Year: 1995
  • Price USD: 69.95

Description

About The Book

This new text examines the design and implementation of lcc, a production-quality, retargetable compiler for the ANSI C programming language, designed at AT&T Bell Laboratories and Princeton University. The authors’ innovative approach—a ‘literate program’ that intermingles the text with the source code—gives a detailed tour of the code that explains the implementation and design decisions reflected in the software. And while most books describe toy compilers or focus on isolated pieces of code, the authors provide the entire source code for a real compiler, which is available via ftp. Structured as a self-study guide that describes the real-world tradeoffs encountered in building a production-quality compiler, this book is useful to individuals who work in application areas applying or creating language-based tools and techniques.
Explores the interaction between compiler theory and practice through the discussion of lcc.
Covers compiler theory only as needed to understand the implementation of lcc, focusing instead on practical, applied issues.
Encourages a broader understanding of programming in C through an examination of lcc, a production-quality compiler in use since 1988.
Provides full code generators for the MIPS R3000, SPARC, and Intel 80×86 architectures and successors.
The full source code for the lcc compiler, the three back ends, and the code-generator generator is freely available.
Uses icons and brief indices in the margins to cross- reference code fragments and connect code usage.
Audience
Senior undergraduate or graduate level second course. Any researcher or implementer of compilers for parallel or advanced computers.

Table Of Contents

Preface1Introduction12Storage Management233Symbol Management354Types535Code Generation Interface786Lexical Analysis1027Parsing1278Expressions1479Expression Semantics17210Statements21611Declarations25212Generating Intermediate Code31113Structuring the Code Generator35214Selecting and Emitting Instructions37315Register Allocation40816Generating MIPS R3000 Code43017Generating SPARC Code46318Generating X86 Code49619Retrospective526Bibliography535Index541How to Obtain Icc563

About The Authors

Since 1975, Christopher W. Fraser has researched compiling, particularly producing code generators automatically from compact specs, and has published many technical articles in this area. He originated retargetable peephole optimization, which GCC, a popular C compiler, uses to help select instructions. From 1977 until 1986, Fraser taught computer science, including compiling, at the University of Arizona. Since 1986, Fraser has conducted computing research at AT&T Bell Laboratories in Murray Hill, New Jersey.

David R. Hanson is a Professor of Computer Science at Princeton University with more than 20 years of research experience in programming languages. He has conducted research in conjunction with Bell Laboratories and is the co-author of lcc, a production quality, research compiler for the C language that is popular with the Unix community. lcc is presented and analyzed in the book A Retargetable C Compiler: Design and Implementation , by Christopher Fraser and David Hanson (c) 1995, Addison-Wesley.