Join Amazon Prime and ship Two-Day for free and Overnight for $3.99. Already a member? Sign in.

 

or
Sign in to turn on 1-Click ordering.
 
 
More Buying Choices
26 used & new from $31.09

Have one to sell? Sell yours here
 
   
A Retargetable C Compiler: Design and Implementation
 
 
Tell the Publisher!
I’d like to read this book on Kindle

Don’t have a Kindle? Get yours here.
 
  

A Retargetable C Compiler: Design and Implementation (Paperback)

by David R. Hanson (Author), Christopher W. Fraser (Author)
3.6 out of 5 stars See all reviews (7 customer reviews)

List Price: $69.99
Price: $55.99 & this item ships for FREE with Super Saver Shipping. Details
You Save: $14.00 (20%)
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
In Stock.
Ships from and sold by Amazon.com. Gift-wrap available.

Only 2 left in stock--order soon (more on the way).

Want it delivered Wednesday, July 22? Choose One-Day Shipping at checkout. Details
11 new from $52.43 15 used from $31.09

Frequently Bought Together

A Retargetable C Compiler: Design and Implementation + Advanced Compiler Design and Implementation + Optimizing Compilers for Modern Architectures: A Dependence-based Approach
Price For All Three: $240.23

Show availability and shipping details


Customers Who Bought This Item Also Bought

Writing Compilers and Interpreters

Writing Compilers and Interpreters

by Ronald Mak
4.0 out of 5 stars (22)  $47.93
Compiler Design in C (Prentice-Hall software series)

Compiler Design in C (Prentice-Hall software series)

by Allen I. Holub
Let Over Lambda

Let Over Lambda

by Doug Hoyte
3.7 out of 5 stars (3)  $35.95
Software Tools

Software Tools

by Brian W. Kernighan
4.5 out of 5 stars (6)  $27.01
The Algorithm Design Manual

The Algorithm Design Manual

by Steven S. Skiena
4.6 out of 5 stars (31)  $61.15
Explore similar items

Editorial Reviews

Product Description
This new book examines the implementation of lcc, a production-quality, research-oriented retargetable compiler, designed for the ANSI C programming language. The author's innovative approach uses a line-by-line explanation of the code to demonstrate how lcc is built. Accompanying disk contains the full source code for the Icc compiler, the back ends, and the code-generator.

From the Inside Flap

The compiler is the linchpin of the programmer's toolbox. Working programmers use compilers every day and count heavily on their correctness and reliability. A compiler must accept the standard definition of the programming language so that source code will be portable across platforms. A compiler must generate efficient object code. Perhaps more important, a compiler must generate correct object code; an application is only as reliable as the compiler that compiled it.

A compiler is itself a large and complex application that is worthy of study in its own right. This book tours most of the implementation of lcc, a compiler for the ANSI C programming language. It is to compiling what Software Tools by B.W. Kernighan and P.J. Plauger (Addison-Wesley, 1976) is to text processing like text editors and macro processors. Software design and implementation are best learned through experience with real tools. This book explains in detail and shows most of the code for a real compiler. The accompanying diskette holds the source code for the complete compiler.

lcc is a production compiler. It's been used to compile production programs since 1988 and is now used by hundreds of C programmers daily. Detailing most of a production compiler in a book leaves little room for supporting material, so we present only the theory needed for the implementation at hand and leave the broad survey of compiling techniques to existing texts. The book omits a few language features--those with mundane or repetitive implementations and those deliberately treated only in the exercises--but the full compiler is available on the diskette, and the book makes it understandable.

The obvious use for this book is to learn more about compiler construction. But only few programmers need to know how to design and implement compilers. Most work on applications and other aspects of systems programming. There are four reasons why this majority of C programmers may benefit from this book.

First, programmers who understand how a C compiler works are often better programmers in general and better C programmers in particular. The compiler writer must understand even the darkest corners of the C language; touring the implementation of those corners reveals much about the language itself and its efficient realization on modern computers.

Second, most texts on programming must necessarily use small examples, which often demonstrate techniques simply and elegantly. Most programmers, however, work on large programs that have evolved--or degenerated--over time. There are few well documented examples of this kind of "programming in the large" that can serve as reference examples. lcc isn't perfect, but this book documents both its good and bad points in detail and thus provides one such reference point.

Third, a compiler is one of the best demonstrations in computer science of the interaction between theory and practice. lcc displays both the places where this interaction is smooth and the results are elegant, as well as where practical demands strain the theory, which shows in the resulting code. Exploring these interactions in a real program helps programmers understand when, where, and how to apply different techniques. lcc also illustrates numerous C programming techniques.

Fourth, this book is an example of a "literate program." Like TEX: The Program by D.E. Knuth (Addison-Wesley, 1986), this book is lcc's source code and the prose that describes it. The code is presented in the order that best suits understanding, not in the order dictated by the C programming language. The source code that appears on the diskette is extracted automatically from the book's text files.

This book is well suited for self-study by both academics and professionals. The book and its diskette offer complete documented source code for lcc, so they may interest practitioners who wish to experiment with compilation or those working in application areas that use or implement language-based tools and techniques, such as user interfaces.

The book shows a large software system, warts and all. It could thus be the subject of a postmortem in a software engineering course, for example.

For compiler courses, this book complements traditional compiler texts. It shows one way of implementing a C compiler, while traditional texts survey algorithms for solving the broad range of problems encountered in compiling. Limited space prevents such texts from including more than a toy compiler. Code generation is often treated at a particularly high level to avoid tying the book to a specific computer.

As a result many instructors prepare a substantial programming project to give their students some practical experience. These instructors usually must write these compilers from scratch; students duplicate large portions and have to use the rest with only limited documentation. The situation is trying for both students and instructors, and unsatisfying to boot, because the compilers are still toys. By documenting most of a real compiler and providing the source code, this book offers an alternative.

This book presents full code generators for the MIPS R3000, SPARC, and Intel 386 and successor architectures. It exploits recent research that produces code generators from compact specifications. These methods allow us to present complete code generators for several machines, which no other book does. Presenting several code generators avoids tying the book to a single machine, and helps students appreciate engineering retargetable software.

Assignments can add language features, optimizations, and targets. When used with a traditional survey text, assignments could also replace existing modules with those using alternate algorithms. Such assignments come closer to the actual practice of compiler engineering than assignments that implement most of a toy compiler, where too much time goes to low-level infrastructure and accommodating repetitive language features. Many of the exercises pose just these kinds of engineering problems.

lcc has also been adapted for purposes other than conventional compilation. For example, it's been used for building a C browser and for generating remote-procedure-call stubs from declarations. It could also be used to experiment with language extensions, proposed computer architectures and code-generator technologies.

We assume readers are fluent in C and assembly language for some computer, know what a compiler is and have a general understanding of what one does, and have a working understanding of data structures and algorithms at the level covered in typical undergraduate courses; the material covered by Algorithms in C by R. Sedgewick (Addison-Wesley, 1990), for example, is more than sufficient for understanding lcc.

Acknowledgments

This book owes much to the many lcc users at AT&T Bell Laboratories, Princeton University, and elsewhere who suffered through bugs and provided valuable feedback. Those who deserve explicit thanks include Hans Boehm, Mary Fernandez, Michael Golan, Paul Haahr, Brian Kernighan, Doug McIlroy, Rob Pike, Dennis Ritchie, and Ravi Sethi. Ronald Guilmette, David Kristol, David Prosser, and Dennis Rithchie provided valuable information concerning the fine points of the ANSI Standard and its interpretation. David Gay helped us adapt the PFORT library of numerical software to be an invaluable stress test for lcc's code generators.

Careful reviews of both our code and our prose by Jack Davidson, Todd Proebsting, Norman Ramsey, William Waite, and David Wall contributed significantly to the quality of both. Our thanks to Steve Beck, who installed and massaged the fonts used for this book, and to Maylee Noah, who did the artwork with Adobe Illustrator.

Christopher W. Fraser
David R. Hanson

0805316701P04062001

See all Editorial Reviews


Product Details

  • Paperback: 592 pages
  • Publisher: Addison-Wesley Professional (February 10, 1995)
  • Language: English
  • ISBN-10: 0805316701
  • ISBN-13: 978-0805316704
  • Product Dimensions: 8.9 x 7.2 x 1.3 inches
  • Shipping Weight: 2.1 pounds (View shipping rates and policies)
  • Average Customer Review: 3.6 out of 5 stars See all reviews (7 customer reviews)
  • Amazon.com Sales Rank: #428,721 in Books (See Bestsellers in Books)

    Popular in these categories: (What's this?)

    #9 in  Books > Computers & Internet > Programming > Languages & Tools > Compiler Design
    #36 in  Books > Computers & Internet > Programming > Languages & Tools > Compilers

Look Inside This Book

Citations (learn more)
3 books cite this book:


Tags Customers Associate with This Product

 (What's this?)
Click on a tag to find related items, discussions, and people.
Check the boxes next to the tags you consider relevant or enter your own tags in the field below.

Your tags: Add your first tag
 
Help others find this product — tag it for Amazon search
No one has tagged this product for Amazon search yet. Why not be the first to suggest a search for which it should appear?

Sell a Digital Version of This Book in the Kindle Store

If you are a publisher or author and hold the digital rights to a book, you can sell a digital version of it in our Kindle Store. Learn more

 

Customer Reviews

7 Reviews
5 star:
 (2)
4 star:
 (1)
3 star:
 (3)
2 star:
 (1)
1 star:    (0)
 
 
 
 
 
Average Customer Review
3.6 out of 5 stars (7 customer reviews)
 
 
 
 
Share your thoughts with other customers:
Most Helpful Customer Reviews

 
14 of 15 people found the following review helpful:
5.0 out of 5 stars Excellent, December 12, 2001
By Andrew Kadatch (Redmond, WA United States) - See all my reviews
This book is definitely _not_ for beginners, but compilers are not supposed to be written by novices -- if there is rocket science in computers, it is compiler development. Crystal clear style and language make this book easy reading, and LCC is the best non-optimizing compiler I've seen (and believe me, I've seen many compiler sources): orthogonal, easy to follow design, well-thought data structures and overall architecture.

I treat this book as a perfect collection of brilliant ideas, many of which you will find implemented in most commercial compilers.

Whether it helps to write your own compiler? -- sure. Are you thinking about IR (internal representation) that will be easy to create and, most important, walk through and manipulate? -- take a look how Fraser et al did it; they did it well. Think how to write a front end or code generator? -- it's all there. Sure, blind copying won't work -- optimizing compiler will call for way more sophisticated BURG-like technique (one of the best known code generation techniques by now), but, all in all, it'll be BURG-like, and it's in the book as well.

So, if you want to show your students (or learn yourself) how compilers should be written, you cannot find anything better than LCC accompanied by this book. Fraser's team did it right.

Comment Comment | Permalink | Was this review helpful to you? Yes No (Report this)



 
7 of 8 people found the following review helpful:
4.0 out of 5 stars Almost everything you need to know about a simple compiler, January 27, 1999
By A Customer
I first read this book when I ported lcc 3.5 to the Alpha (and later helped tune the production 4.0 port). The book is extremely clear and complete with regard to the lcc compiler itself; it is an invaluable reference for anyone who works with lcc.

In the two years since I last worked directly with lcc, I've consulted the book on numerous occasions; Messrs. Fraser and Hanson have a clear writing and programming style that makes this book (and the awesome paper that they wrote with Todd Proebsting on lburg) one of my standard "how-to" books on simple IR and code generation issues.

I'd only like to see more information about lburg; in particular, more about using lburg to do some simple optimizations. The writing style is clear and reasonably concise, but the constraints of retrofitting literate programming techniques onto an existing software project can make the code presentation a little fragmented. Still, I always found what I wanted and usually found the explanation to be quite good.

Comment Comment | Permalink | Was this review helpful to you? Yes No (Report this)



 
3 of 3 people found the following review helpful:
5.0 out of 5 stars Very nice "Cookbook", October 22, 2005
By Jos van Roosmalen (The Netherlands, Europe) - See all my reviews
(REAL NAME)   
First of all, this book is not for starters in the area of compiler design. Starters in the area of compiler design who are looking for a 'cookbook', I recommend to read 'Programming Language Processors in Java: Compilers and Interpreters' by David Watt.

Why do I like this book? Because it is a cookbook for a 'full blown' C Compiler in C itself. Well actually it's a compiler for a subset of C, but it is still very comprehensive!

It offers a lot of code snippets which are really well commented about what/where/how.

A disadvantage of this book is that it doesn't cover advanced topics such as code optimizations. This is the area where the action is right now. All other parts (scanning/parsing/etc) can be bought of the shelf.

But it remain a very nice text, to give you an valuable insight in how a compiler could be implemented.
Comment Comment | Permalink | Was this review helpful to you? Yes No (Report this)


Share your thoughts with other customers: Create your own review
 
 
Ad
 
Most Recent Customer Reviews

2.0 out of 5 stars Source code in Web is a bad choice
This book lays out the compiler's source code in Web (think Knuth), in which instead of seeing an entire program, you see a small fragment, and notes to look up the rest on a... Read more
Published on February 23, 2006 by Nicholas Paul Johnson

3.0 out of 5 stars Only for *advanced* programmers
I bought this book several years ago, and still haven't managed to make my way through it. The text is sometimes hard to follow, the code fragments even harder, requiring the... Read more
Published on May 27, 2000 by Andrew Jones

3.0 out of 5 stars Only for *advanced* programmers
I bought this book several years ago, and still haven't managed to make my way through it. The text is sometimes hard to follow, the code fragments even harder, requiring the... Read more
Published on May 27, 2000 by Andrew Jones

3.0 out of 5 stars How they wrote *their* compiler, not how to write *yours*
I did not like this book. First of all the authors are egotistical saying things along the lines of "this compiler *must* be great, hundreds of people are using it. Read more
Published on April 5, 1999

Only search this product's reviews



Customer Discussions

 Beta (What's this?)
New! See all customer communities, and bookmark your communities to keep track of them.
This product's forum (0 discussions)
  Discussion Replies Latest Post
  No discussions yet

Ask questions, Share opinions, Gain insight
Start a new discussion
Topic:
First post:
Prompts for sign-in
  [Cancel]


Active discussions in related forums
   


Product Information from the Amapedia Community

Beta (What's this?)



Look for Similar Items by Category


Light It Up

Shop for sconces

Add light and beauty to your home with sconces from the Lighting & Electrical Store. Shop our extensive selection of indoor and outdoor fixtures.

Shop all sconces

 

Best Books of 2008

Best of 2008
Find our top 100 editors' picks as well as customers' favorites in dozens of categories in our Best Books of 2008 Store.
 

Buy Three Books, Get a Fourth Free

4-for-3 Books
Order any four eligible books under $10 and get the lowest-price book free in our 4-for-3 Books Store. See more details.
 

Paint the Town--or Just Your Home

Shop for painting tools and supplies
From applicators to paint, stains, and solvents, find all the painting tools and supplies you need to spruce up your walls.

Shop Painting Tools & Supplies now

 
Ad

 

Feedback

If you need help or have a question for Customer Service, contact us.
 Would you like to update product info or give feedback on images?
Is there any other feedback you would like to provide?

Your comments can help make our site better for everyone.


Where's My Stuff?

Shipping & Returns

Need Help?

Your Recent History

  (What's this?)
You have no recently viewed items or searches.

After viewing product detail pages or search results, look here to find an easy way to navigate back to pages you are interested in.

Look to the right column to find helpful suggestions for your shopping session.

Continue shopping: Top Sellers
Free
Free by Chris Anderson
Paranoia
Paranoia by Joseph Finder
The Adventures of Sherlock Holmes
The Adventures of Sherlock Holmes by Arthur Conan, Sir, 1859-1930 Doyle
Glenn Beck's Common Sense

Conditions of Use | Privacy Notice © 1996-2009, Amazon.com, Inc. or its affiliates