
eShop USA > Books > Engineering a Compiler
Engineering a Compiler
Availability: Usually ships in 24 hours
List Price: $82.95Our Price: $66.36 You Save: $16.59 (20%)Prices subject to change.
Customer Reviews
Rating: - Best introductory codegen/optimization book out there
I've been working on commercial development tools for nearly 15 years now, with most of that time spent on compilers, and most of the compiler time spent on optimization and code generation.
The strength of this book is that it is a good introduction to modern compiler design, with many up-to-date techniques and references to recent papers. The authors present many algorithms in a very easy-to-grasp manner, and provide useful engineering insights. I've focused almost exclusively on the codegen/optimization sections of the book, so I can't say much about the chapters on parsing and semantic analysis.
The weakness of the book is that they don't discuss some important topics related to the areas that they do cover well. For example, pointer disambiguation, and what effect pointers and aliasing have on SSA form. There is no discussion whatsoever of this topic when they talk about things like dead code elimination. The SSA-based algorithm they present there has a first step of "mark all the needed operations as needed", but there is no discussion of what this means for writes to dereferenced pointers, or the trade-offs you face there (e.g. marking all writes to dereferenced pointers is inexpensive, but conservative, but the analysis required to mark only those dereferences that are truly necessary can be expensive and/or completely subsume the liveness issue they are trying to solve inexpensively with this SSA-based algorithm).
Having read many journal articles on optimization, this is unfortuntately common in the literature as well.
Rating: - Depends on what you want
What it is: A great introduction to basic concepts in contemporary compilers.
What it's not: A handbook for someone thrown in at the deep end of commercial compiler development.
I can imagine a very good one-term course in compiler construction built around this text. After a brief introduction, it gets immediately into the classic topics of lexical scanning, parsing, and syntax analysis. These three chapters help any beginner understand the multiple levels of processing, from the character level, up through reorganizing grammars for practical parsing and table-driven techniques, to the lower levels of sematic analysis. This includes a very brief discussion of type systems and type inference - less than 20 pages, on a topic that whole books devote themselves to. These 200 pages typify what you'll see in the rest of the book: a lot of attention paid to lexical analysis, a problem largely eliminated by automated tools (lex and yacc being the best known), and thin mention of the harder problems that differ significantly across languages and applications of languages.
Chapter 5 addresses the critical issue of intermediate representation, the data structures that represent the program during analysis, optimization, and code generation. Chapter 6 is titled "The Procedure Abstraction." It deals with much more than its name suggests, including procedure activation records (generalizations of stack frames), parameter passing, stack management, symbol visibility and scoping, and scraps of symbol table organization - important stuff, but hard to understand as "procedure abstaction." The next chapter deals with "Code Shape," a grab-bag including value representations, arrays and strings, control constructs, and procedures (again). It also presents a very few pages, at the end, on object oriented language - hardly enough to scratch the surface, let alone build competence. And, for lack of a better place to stick them, I would have expected support for parallelism and exceptions to appear here, but this book seems to omit the topics altogether.
Code analysis and optimization appear in chapters 8-10. That includes a competent introduction to static single assignment notation, a staple of current compiler technology mentioned earlier, in the section on intermediate representation. This covers a range of basics, but omits all significant mention of arrays, the workhorses of performance computing. Chapters 11-13 introduce the basics of instruction selection, scheduling, and register allocation. Although it mentions some hardware effects, like out-of-order execution in superscalar architecture, discussion stays close the instruction sets of popular processors. As a result, it omits mention of SIMD, VLIW, DSP, and more exotic architectures, the ones most in need of good code generation. Compiler-specific support libraries, e.g. the kind that make up for lack of hardware divide instructions, should have appeared somewhere around here, but are oddly absent.
The authors present an adequate introduction for the beginner, someone who's still not sure what a hash table is (see appendix B). It introduces many basic topics, but doesn't go into a lot of depth in any of them. The student who finishes this book will understand most major issues of classical compiler construction. I just can't see a serious, working competence coming out of this text, though. I give it four stars as an academic introduction, but a lot less for anyone with immediate problems to solve.
-- wiredweird
Rating: - If you are a beginner...Do not buy it
I read this book and really did not like it. It is a nightmare for any one new to compilers. It is difficult to read with more emphesis on the backend of the compiler.
The following texts are much better for a beginner:
1. Louden's Compiler construction --> the best text for a beginner.
2. the Dragon book
Rating: - A great starter guide to writing a compiler
I recently used this book to supplement the Dragon book in a Compilers course. I found this book so much easier to read and understand. They do a great job of laying out the basics and introducing you to compiler design.
I also liked how they seemed to keep an open mind about which intermediate representation is best to use. They discuss the pros and cons of graphical IRs vs Linear IRs, and let you decide which best fits your needs.
Their open mindedness ended when it came to optimization though. I got the impression that the authors consider SSA (static single assignment) form to be the silver bullet of optimization. Almost all of the optimizations they discuss in this book rely on your IR being in SSA form! I agree that SSA form does indeed make many optimizations much easier, but there is a very high initial cost involved in converting to and from SSA form. In there defense they spend almost an entire chapter on how to do these conversions.
So to sum up, this book does a great job of introducing you to compiler design. It is well written and very easy to understand. It also does a good job of discussing different compiler design choices and their pros and cons. The only short coming of this book is that the entire optimization discussion is revolves around SSA form.
Rating: - Terrible for Starters
This book was the textbook for an undergraduate course on compilers. Let me make it short: I never read it after reading the first chapter. The authors may be top experts on compilers but they shouldn't be writing books. Another book written in 1982 (compilers, principles, techniques and tools) saved my life for this class. If you are a beginner "do not buy this book".
Featured Listmania!
| |
 |