A Retargetable C Compiler : Design and Implementation
||Author: David R. Hanson, Christopher W. Fraser|
List Price: $69.99
Our Price: Click to see the latest and low price
Publisher: Addison-Wesley Pub Co (31 January, 1995)
Sales Rank: 77,417
Average Customer Rating: 3.75 out of 5
Customer ReviewsRating: 5 out of 5
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.
Rating: 3 out of 5
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 reader to jump back several (sometimes dozens of) pages to references made. This text seemed more suited to University level Computer Science students than to the average Joe Schmoe who just wants to write a C compiler. Overall, this is a good book that details the gory insides of a compiler very well, and the added bonus of being able to get the source code is essential, as viewing the complete code while reading the book is almost a necessity, but it's not for the average/intermediate level coder.
Rating: 3 out of 5
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." Secondly, they wrote their compiler in pre-ANSI C, making it difficult to read. Similarly, they use a hokey "hypertext" style format for presenting the source code,also making it difficult to read. Thirdly, their techniques are questionable - they don't use automatic tools for scanning or parser generation. In fact their scanner is one big 'case' statment. Their parser is recursive descent, hand-written. This is one of the least maintainable and most hard to read parsing techniques. I do give them credit, though, for writing a compiler with easily changeable back ends. This part is way cool, especially with such diverse platforms as Sparc and x86. Finally, their writing is not easily read - especially with the hokey code interspersed. I bought it wanting to learn about their code generation but have decided to return it, and will probably buy Advanced Compiler Design And Implementation; Muchnick, Steve instead.
· Optimizing Compilers for Modern Architectures: A Dependence-based Approach
· Writing Compilers and Interpreters
· lex & yacc, 2nd Edition
· Virtual Machine Design and Implementation in C/C++ (With CD-ROM)
· Advanced Compiler Design and Implementation