| Reviewer: |
M. Cleary
-
See all my reviews |
|
Softpanorama |
May the source be with you, but remember the KISS principle ;-)
|
| Peephole optimization | Program Graphs | Algorithms | Assembler | C | Language design and implementation | Etc |
Compiler construction (see also my page with the collection of links) stopped to be a black art approximately after publishing of David Gries' book. Now it's a pretty established field. At the same time this is very interesting and underutilized area -- compilers represent an interesting paradigm for solving a very broad class of problems. One of the most underestimated books on compliers is probably the first volume of The Art Of Computer Programming, the book that should be on the shelf of any complier writer.
Separation of lexical aspects, syntactic aspects and semantic aspects of the task proved to be a very fruitful approach. Moreover OO technology can be to a certain extent considered as a rather primitive implementation of the compiler-compiler paradigm -- extending the language dynamically.
Lexical analysis phase should be IMHO better coded by hand and it can do some look ahead in order to simplify the next phase: syntax analysis. Actually even if you deal with the simple, regular lexical structure you do not need to use Lex of similar tools to generate lexical scanner. Hand written scanners are simpler, more powerful and more flexible. Moreover usually lexical analyzers can use advanced instructions for a particular architecture (like tr) so mixture of C and assembler is the best way to go.
But as for syntactic analyzers, using something like YACC can improve reliability of program and can be recommended. YACC has some debugging capabilities and you can ask questions and probably get answers in comp.compiler group.
Compilers does not exist as an isolated phenomenon -- a lot depends on hardware in hand and programming language in hand. So books on assembler actually belong to this category. You need at least one good assembler book if you plan generate assembler code or even more if you plan generate object code ;-)
Compiler writing produced several interesting algorithms including algorithms on directed graphs -- a very fascinating area. I hope that Donald Knuth will eventually write a volume devoted to compiler construction. This area definitely needs a giant. Meanwhile combination of Gries' book and Aho and Ullman's books (plus a couple of more modern books) can probably serve you as a substitute of this inexistent volume of the Art of Programming.
Although this area is semi-forgotten, one active software development paradigm related to compiler technologies is so called program generation and generator programming pattern ;-). There are several books related to this topic.
The last part and the most complex part of compiler writing is the
code optimization and here a tree representation can be extremely useful. I strongly
recommend to try peephole optimization as the first method. It was introduced
in the paper McKeeman, W.M. Peephole Optimization. CACM 8 (July 1965),
p 443-444. See also Aho, Alfred V., Ravi Sethi, Jeffrey D. Ullman. "Compilers: Principles,
Techniques, and Tools". Addison Wesley, 1986. Peephole optimization is a method
to improve the quality of the program by examining a short sequence of target instructions.
The peephole is a small moving window on the target program. Instructions in the
peephole are optimized only considering the instructions in the peephole. Peephole
optimization is applied over the target program, moving the peephole window. It
can also be defined as the pattern matching and conditional replacement performed
on small sections. (see Vicki H. Allan. Peephole Optimization as a Targeting and
Coupling Tool, page 112-121 1989, ACM Proceedings of the 22nd annual international
workshop on microprogramming and micro architecture).
Among other things it includes (see Subject D1 Peephole Optimization and Optimal Code Generation):
redundant-instruction elimination like in
(1) MOV R0, a
(2) MOV a, R0 # Whenever (2) is executed
right after (1), it is redundant.
debug = 0;
if (debug) {
print debugging information
}
See Peter B. Kessler "Discovering Machine Specific Code Improvement", Sigplan Notices, July 1986. pp 249-254 and a related paper by Massalin in ASPLOS '87: Superoptimizer --- A look at the smallest program. Proceedings of the Second International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS II), Oct. 1987, IEEE:
Abstract:
The superoptimizer is a tool that, given an instruction set, finds the shortest program to compute a function. Startling programs have been generated, many of them engaging in convoluted bit-fiddling bearing little resemblance to the source programs which defined the functions. The key idea in the superoptimizer is a probabilistic test that makes exhaustive searches practical for programs of useful size. The search space is defined by the processor's instruction set, which may include the whole set, but it is typically restricted to a subset. By constraining the instructions and observing the effect on the output program, it is possible to gain insight into the design of instruction sets. In addition, superoptimized programs may be used by peephole optimizers to improve the quality of generated code, or by
assembly language programmers to improve manually written code
Nikolai Bezroukov
|
You can use Honor System to make a contribution, supporting this site |
**** Compiler Construction Principles and Practice
- Hardcover: 592 pages
- Publisher: Course Technology; 1 edition (January 24, 1997)
- Language: English
- ISBN: 0534939724
- Average Customer Review:
based on 10 reviews. (Write a review)
- Amazon.com Sales Rank: #177,613 in Books
One of the best books, April 6, 2005
This book is outstanding! The Dragon Book is way overhyped. I have tried again and again to follow the dragon book, and each time I found it too difficult. On the other hand, Louden's book has answered many questions that I had in a clear, concise manner! I love this book! I have also flipped through almost all other compiler/interpreter books on the market in various bookstores, but none of them compare. This is *THE* book on introductory compiler design. Other books you might want if interested in writing your own programming language/compiler are "Programming Language Pragmatics", "Lex and Yacc", "Java Virtual Machine Specification" and "Virtual Machine Design and Implementation in C/C++".
Reviewer: M. Cleary - See all my reviews
![]()
I taught from this book, May 6, 2003
This is an excellent basic book on compilers. Its strength is its strong practical approach combined with using YACC/LEX technology. It hand holds you through the development of a simple compiler. If I wanted to learn about compilers I would read this first. Its weakness is it is too narrow. There are plenty of features of languages that are not addressed but in passing. Its goal is to get a compiler built. For a compilers 101 class there is no better book.
Reviewer: meerkat "Captain Meerkat" (Moscow, ID USA) - See all my reviews
by Keith Cooper, Linda Torczon
- Hardcover: 801 pages
- Publisher: Morgan Kaufmann (October 27, 2003)
- ISBN: 155860698X
- Average Customer Review:
based on 5 reviews. (Write a review)
- Amazon.com Sales Rank: #148,516 in Books
Programming Language Processors in Java: Compilers and Interpreters
by David Watt, Deryck Brown (Hardcover)
|
|
||
|
||
Programming Language Pragmatics is one huge exception. None of the books I have read come close to the clarity that this book exhibits. On many occassions, the choice of words and presentation in this book has made me go 'Wow, I thought I already knew this stuff...' Besides core topics, it has interesting discussion like concurrency, data-abstraction (object-oriented) and non-imperative programming models (functional and logic). TOC (with my comments) Ch. 1 Introduction Ch. 2 Programming Language Syntax (theory of Regular Expression, Context-Free Grammars, Automata etc) Ch. 3 Names, Scopes, and Bindings (binding, scope rules, closures etc) Ch. 4 Semantic Analysis (attribute grammars, attribute flow, syntax tree etc) Ch. 5 Assembly-Level Computer Architecture (keeping the pipeline full, register allocation etc) Ch. 6 Control Flow (expression evaluation, iteration, recursion, nondeterminacy etc) Ch. 7 Data Types (type checking, pointers and recursive types etc) Ch. 8 Subroutines and Control Abstraction (stack layout, calling sequences, parameter passing etc) Ch. 9 Building a Runnable Program (back-end compiler structure, intermediate forms etc) Ch. 10 Data Abstraction and Object Orientation (encapsulation, inheritance, dynamic method binding, multiple inheritance, the object model of smalltalk) Ch. 11 Nonimperative Programming Models: Functional and Logic Languages Ch. 12 Concurrency (shared memory, message passing etc) Ch. 13 Code Improvement (peephole, redundancy elimination, data flow analysis, loop improvement, instruction scheduling, register allocation etc) App. A Programming Languages Mentioned App. B Language Design and Language Implementation This is a very impressive book; truly one of my best investments in books so far. |
5 Stars with caveats......., October 10, 2000
Reviewer: A reader from Vermont
Its hard to tell from the title of this book who will benefit from reading it
but from a practical standpoint, C++ library designers and those with an interest
in the "bleeding edge" of software engineering should find it very enlightening.
The primary focus of this book is speeding up the lifecycle of program design
by utilizing "Generative Programming". GP is a fancy name for programming
using domain specific notations and generating highly optimized code without
burdening the application programmer with low level details of domain libraries.
Chapter 1 "What is this book about?" - The authors describe GP. Short and sweet.....
Chapter 2 "Domain Engineering" - A rather dry, pedantic review of current Domain Engineering methods. This chapter reads like a PHD lit review. Boring....
Chapter 3 "Domain Engineering and OO Analysis and Design" - Why OO Analysis isn't appropriate for designing reusable libraries and analysis methods that are more suitable for the task. Quick and painless....
Chapter 4 "Feature Modeling" - One of the high points of the book. For those of you who have been stymied by the inflexibility of UML, the authors introduce the technique of "feature diagrams" which allow library designers to defer decisions like inheritance vs. aggregation until later in the design. Potentially very useful.
Chapter 5 "The Process of GP" - Describes how GP should work in an ideal world (which unfortunately doesn't exist yet). A bit too abstract.....
Chapter 6 "Generic Programming" - Describes type based programming (i.e. C++ templates) and various languages support for Generic Programming. Java programmers won't like this one!
Chapter 7 "Component-Oriented Template-Based C++ Programming Techniques" - The title pretty much says it all. Good introduction to C++ templates.
Chapter 8 "Aspect-Oriented Programming" - Aspects are portions of code that have little to do with the actual intent of the code. Examples are synchronization and error handling. This chapter describes how messy aspects can make code and how to separate aspects from core functionality. Good stuff....
Chapter 9 "Generators" - Describes how ideal code Generators should work. Good introduction to the topic.
Chapter 10 "Static Metaprogramming in C++" - For me this is the high point of the book. Compile time control structures such as IF<>, SWITCH<>, DO<> and WHILE<> are introduced. These can be used to generate configurable types as shown in later chapters. These structures are difficult to debug but if used conservatively are very powerful!
Chapter 11 "Intentional Programming" - A description of Microsoft's Intentional Programming environment. IP is the ideal GP development environment that allows library designers to enhance the main IDE with domain specific libraries. Developers interact directly with the source parse trees that are rendered to the IDE in a domain specific manner. The description is interesting but the IP Software is potential Vaporware and I'm kinda sick of reading about MS development tools that will change the world (C# anyone????)
Chapter 12-14 - The final chapters describe how to build template class generators that allow the application programming to specify functionality as a template parameter and the generator will build the type. It's as close to GP as we can get today. A list container class, bank account class and a highly optimized matrix library are designed using the GP methodology. It's nice to see the authors actually practicing what they preach.
Aside from the overly academic feel to the book and touting Microsoft fantasy-ware (which may become available... who knows?) this book offers much food for thought for system designers and C++ library implementers. The template tricks described are difficult to debug but with a little luck future compilers will provide better support for this style of compile time design. I look forward to the 2nd or 3rd edition of this book when this stuff matures.
Parser Design for the 21st century, February 7, 2002
Reviewer: Grant Steinfeld (see more about me) from New York, ny United States
I found this powerful parser framework easy to understand (with a little help from my friends) and a pleasure to incorporate into my programmers toolbox.Aho is for Computer Scientists and Mathematicians, while the organic nature of Steve's thinking and elegant application of Design Patterns to the problem of creating an extensible parser, is more up a Biologist turned webmaster alley.
In less that a few days we were able to convert IDL to WSDL, in less than 100 lines of code!
The only issue I had was the text sometimes could have benefited with some graphical depiction of the concepts, or even an accompanying flash animation / demo website. Maybe in the next edition?
2 of 2 people found the following review helpful:
The ideas in the book are worth exploring, February 9, 2002
Reviewer:
Soumen Sarkar (see more about me) from Fremont, CA United States
Agreed that XML may not be the best language to capture domain specification
expressiveness. But use of XML/XSLT to do custom code generation has the
benifit of rapid application prototyping and development. The crucial
fact is that the domain specification is captured in XML only relatively few
times and project software developers mainly use the generated code. The question
is how many people in the project is exposed to 'ugliness' of XML and how many
times. The advantages of 'neat' code generation far outweigh the disadvantages
of 'ugliness' of domain specification in XML.
In a real Network Management Software development I achieved 60% of generated code (EJB, SNMP, Java utilities) by using custom code generation by XML/XSLT. Only myself dealt with XML other software developers happily used generated code. You can imagine the lead the project had and continues to have because of use of XML/XSLT in project specific custom code generation. The code generation system is stable now -- any new addition in EJB, SNMP model results in thousands of lines of Java/SQL/XML/SVG code without any additional effort.
I would, therefore, continue to recommend the book as worth exploring. This book really contributed new techniques in software development. More specically with XML/XSLT you have freely available tools to implement "model driven programming" in your software project.
Soso, January 15, 2002
Reviewer: A reader from Victoria, Canada
While the book has interesting ideas, it ignores useful results of the domain-specific
language community. More important, it preaches to use XML as a domain-specific
language, which is in my opinion a disastrous idea.
Terence Parr (jGuru.com) provides an excellent argument why this is the case in his article "Answers to the question 'When shouldn't you use XML?'", August 2001, IBM developerWorks : XML zone : XML zone articles:
"XML is a poor human interface: Humans have an innate ability to apply structure to a stream of characters (sentences), therefore, adding markup symbols can only make it harder for us to read and more laborious to type. The problem is that most programmers have very little experience designing and parsing computer languages. Rather than spending the time to design and parse a human-friendly language, programmers are using the fastest path to providing a specification language and implementation: "Oh, use XML. Done." And that's OK, but I want programmers to recognize that they are providing an inferior interface when they take that easy route."
Besides, the book is poorly typeset. It appears that the font was increased until the book had more than 400 pages. I have never seen a bigger font in a computing book! I don't know why Prentice Hall endangers their good reputation with such a poorly typeset publication. Better try to borrow the book first before potentially wasting your money.
Good treatment of difficult material, December 23, 1999
Reviewer: Mr James S Battle from
This book has a nice balance of theory and practical algorithms. There is enough
detail to allow a (patient) reader to implement his own compiler tools, though
like most other books on the subject, this book leaves you with the feeling
that the area might have died about twenty years ago (no insult intended!);
an update needed, to include OO languages, some treatment of the complexities
associated with parsing modern languages, C++ etc. All things considered, still
a great book, well worth the money.
authoritative, informative, and dull., November 28, 1999
Reviewer:
Ray Dillinger (see more about me) from Silicon Valley
This is a useful and highly informative text. It covers
technique and structures for the efficient compilation of OO, functional, and
Logic Programming Languages -- languages not well covered by the Dragon Book.
The code examples are sparse, and in pseudocode. The authors present
a lot of theory as mathematical formalisms -- one of the most precise and complete
ways to do it of course, but reading it is uphill work. They also cover technique
and give reasonable discussion of the complexity of various approaches. The
coverage of detail is absolutely superb.
However, to my eye and mind, the book is dreadfully dull. I find most compiler texts fun and engaging, inviting me to explore new ideas and make judgements about approaches. By contrast, this text is like being led by the hand (or by the nose) through every decision, idea, and comparison by someone who knows everything there is to know about it and doesn't care what you think or whether you get it. The technique is presented as an implementation of the theory, but real-world examples of situations requiring the application of that theory are scarce. Finally, the entire thing is written without a trace of wit or humor. I can't fault this book technically -- but I'm not confident of its ability to hold a student's attention.
Andrew W. Appel / Hardcover / Published 1998
I think it is recommended in the universities because of the support tools JLex and CUP, the documentation of which is again more pathetic!
**** Compiler Construction Principles and Practice
|
|
Mak is useful, but do use it with caution., April 15, 2000
Reviewer:
Sean G. O'Sullivan (see more about me) from Fredericksburg, Va
There are several things you should know about this book:
1) The book implements a top-down or recursive-descent parser, as opposed to a standard shift-reduce parser. This is *very* important, as lex/yacc, Visual Parse++, and other parsing tools are efficient shift-reduce machines. Thus, the parser isn't really portable. Even so, I did find the the symbol table design that's used by the parser to be critical for what I needed.
2) The printed material is mostly (say 70%) code listings, thus even though the book is a whopping 838 pages, it would be much slimmer with fewer listings. The code is downloadable from the publisher's (Wiley) site.
3) The 30% of text and figures that are in the book could be much more insightful. For example, Chapter 11 - the interactive debugger should at least have some description (screenshots perhaps) of how to use the debugger. (Hint, the commands end with a semi-colon.)
4) Even though this book is C++ oriented, it doesn't use standard containers like linked lists, or trees (maps/sets). The classes have pointers in them that makes the class also act as a its own node in a list or whatever. This makes the design much more confusing than it needs to be.
5) The symbol table implementation has heavy circular dependencies. Quite honestly I don't know of a better implementation (yet). This does, however pose a problem if you'll need to extend the design (to use STL containers, to self-serialize, etc.)
The book has been a godsend, but I couldn't honestly let the 4 and 5 star reviews sit unchallenged. If I had known the above sooner, I could have saved quite a few weekends.
I think an Ideal Writing Compilers book would come bundled
with a thirty day version of Visual Parse++ or Dr. Parse, and work from there.
Great Introduction, March 22, 2000
Reviewer:
Kevin P. Albrecht (see more about me) from Tampa, Florida
This is a good introduction for people with no previous knowledge of writing
a compiler. I recommend good working knowledge of C++; and if you know Pascal,
you're even better off. Knowledge of basic data structures (Stacks, Linked Lists,
Binary Trees) is also important. The language that he implements is Pascal,
but it would be a simple task to implement another language.
A fine book on compiler construction using C++., August 30, 1999
Reviewer: Lee Carlson (globalmath@aol.com) from St.Louis, MO
This book gives a very detailed discussion of how to write a compiler using
C++. As such it could function as a supplementary textbook for a course in compilers
or as one for an advanced course in C++. The author describes in detail every
step of the way, and it makes interesting and fun reading. Buy it: it is well
worth the price.
[Watt_Brown ] Programming Language Processors in Java: Compilers and Interpreters
by David Watt, Deryck Brown
|
Good illustration of compiler concepts. One of the better basic compiler books i have read so far. Next book should be "Progamming language pragmatics" followed by "Advanced
compiler design and implementation" |
This book will not provide proofs or a lot in the way of choices for designing a compiler. This is good when you are starting out. The last thing you need if you actually want to learn about compiler design from front to back is a hundred different ways of doing the same thing. The text takes you through a small version of the "Triangle" language ("Mini-Triangle") - and the code for the entire Triangle language is available for download. This book makes learning about compilers effortless for anyone with an OO background and a little knowledge of the most common algorithms learned in any into course on algorithms. If you can't learn from this text, then don't bother with any other. The next book I'd recommend after reading this text is the Dragon Book. Then you can try on Advanced Compiler Design for size - which I am doing at present. A great book to read along (or just before of after) this text is Programming Language Pragmatics. I read it in parallel. If I had to do it again, I'd probably read it first. |
Excellent Introductory Compiler Text, September 28, 1999
Reviewer: A reader from St. Louis, MO, USA
This is a comprehensive and easy to understand text. It covers all the fundamental stages of compiler design, with plenty of explanation (both practical and theoretical). It doesn't exhaustively cover every conceivable topic, but it does leave you with a good taste of what's involved. Of course, it is not a book for beginning programmers, and there are very few code examples. Judging by the comments of some reviewers, I would suspect that they gave poor reviews because they lacked the prerequisite background (familiarity with a good HLL like C, data structures, mathematical background etc). As with any 'advanced' topic in computer science, there is quite a lot expected from you. Upon first reading, some topics occasionally seem overwhelming. Welcome to Earth. This is where your library card comes in. Do a little research and then come back to this text; you'll find that it is well organized and extremely clear. If you want a cookbook this book isn't for you. If you want a solid understanding of compiler fundamentals then this book is your best bet.
5 of 7 people found the following review helpful:
Great for hard-core compiler gurus, November 29, 1999
Reviewer: A reader from Dallas, TX
I picked this text up in anticipation for a compiler course at Georgia Tech. I have not read any other compiler books, so I have little to compare it to. However, I can definitely say that this is a book for people who are looking for "hard-core" compiler knowledge. It is a very dry and meticulous book. Contrary to the opinions of other reviewers, this is not an "easy to understand text". It will take quite a bit of determination to get the most out of it. If you don't love the stuff, you'll stop reading at page 100 or so. As for topics explained in this book, it seems to cover just about everything you will need to understand and write a full-blown compiler.
Reviewer: eoi (see more about me) from LA CA
Crafting a Compiler with C offers an innovative approach to compiler design for students or professional programmers who use C. Through numerous examples and exercises, you'll learn how to design a working compiler from start to finish. The book also provides balanced coverage of both theoretical and implementation issues, with detailed discussions of standard compiler topics such as top-down and bottom- up parsing, semantic analysis, intermediate representations, and code generation. All the procedures in this book are presented in a readable, C-based notation. Features:
· Based on the best-selling Crafting a Compiler.
· Balances an excellent, readable introduction to compiler theory with a wealth of realistic compler design examples and exercises.
· Emphasizes the use of compiler tools that generate parsers and scanners.
· Discusses LR parsing and reduction techniques thoroughly.
· Introduces FLex and ScanGen early.
· Includes optional advanced topics at the end of each chapter.
Chapter 1 Introduction
An overview of the compilation process begins the text. The concept of constructing a compiler from a collection of components is emphasized. The idea of using tools to generate some of these components is introduced.
Chapter 2 A Simple Compiler
A very simple language, Micro, is presented, and each of the components of a compiler is discussed with respect to compiling Micro. Parts of the text of a compiler for Micro (written in Ada) are included in this chapter. The compilation of features of more comprehensive Ada subsets is the motivation for the techniques presented in the following chapters.
Chapter 3 Scanning Theory and Practice
The basic concepts and techniques for building the lexical analysis component of a compiler are presented. This discussion includes both the development of hand-coded scanners and the use of scanner generation tools for implementation of table-driven scanners.
Chapter 4 Grammars and Parsing
Fundamentals of formal language concepts and grammars are presented in this chapter, including context-free grammars, BNF notation, derivations, and parse trees. Since First and Follow sets are used in the definitions of both top- down and bottom-up parsing techniques, they are defined in this chapter. A discussion of language and grammar relationships is also included.
Chapter 5 LL(1) Grammars and Parsing
Top-down parsing is presented as the initial approach to syntax analysis. Both recursive descent and LL(1) are discussed, with an emphasis on the latter. Use of parser generators is a major focus of this chapter.
Chapter 6 LR Parsing
Bottom-up parsing is presented as an alternative approach to syntax analysis. LR, SLR and LALR parsing concepts are introduced and compared with LL techniques. Again, use of parser generators is a major focus of the chapter.
Chapter 7 Semantic Processing
The fundamentals of semantic processing in conjunction with top-down and bottom-up parsers are presented in this chapter. Topics include a comparison of alternative compiler organizations, addition of action symbols to a gram mar (for top-down parsing), rewriting grammars for "semantic hooks" (for bottom-up parsing), definition of semantic records and use of a semantic stack, checking semantic correctness, and producing intermediate code.
Chapter 8 Symbol Tables
This chapter stresses the use of a symbol table as an abstract component, util ized by the rest of the compiler through a precisely defined interface. Possible implementations are presented, followed by discussions of symbol tables for handling nested scopes and language features used to define names accessible from surrounding scopes (such as records and Ada packages).
Chapter 9 Run-time Storage Organization
Basic techniques for run-time storage management is presented, including dis cussions of static allocation, stack-based allocation and generalized dynamic (heap) allocation.
Chapter 10 Processing Declarations
Basic techniques for processing type, variable, and constant declarations are discussed. The organization of this material is based on semantic routines for handling specific language features.
Chapter 11 Processing Expressions and Data Structure References
Semantic routines for handling variable references and arithmetic and Boolean expressions are outlined. Address computation methods for array elements and record fields are included in the discussion of variables references. In this
and the next two chapters, emphasis is placed on techniques for checking semantic correctness and generating intermediate code for use by a target code generator.
Chapter 12 Translating Control Structures
Compilation techniques for features such as if statements, case statements, and various looping constructs are the focus of this chapter. A point of emphasis is effective use of a semantic stack or syntax tree to simplify the job of handling these constructs, which can be nested and which can extend over arbitrary amounts of program text. Students should gain an understanding of the advantage of this general technique over ad hoc approaches.
Chapter 13 Translating Procedures and Functions
Techniques for processing both declarations and calls of subprograms are presented. Since much of the complexity of this topic involves parameters, considerable material is provided that deals with building parameter descriptions, checking for correctness of actual parameters in subprogram calls, and code-generation techniques required by various parameter modes. The concept of a run-time activation stack is discussed here, and the support routines necessary to implement one are outlined.
Chapter 14 Attribute Grammars and Multipass Translation
Multipass translation is modeled by traversal over an intermediate form. The attribute model of information flow receives particular emphasis.
Chapter 15 Code Generation and Local Code Optimization
The code generator is presented as a separate component that translates from the intermediate code generated by the semantic routines to the final target code of the compiler. Such topics as instruction selection, register management, and use of addressing modes are presented. Use of a code generator- generator is discussed. Discussion of basic block optimizations is included in this chapter.
Chapter 16 Global Optimization
The focus of this chapter is on practical techniques that yield useful improvements from a moderate amount of effort. Thus the main sections of the chapter include global data flow analysis, optimizing subprogram calls, and optimizing loops.
Chapter 17 Parsing in the Real World
This chapter includes material on two major topics necessary for implementing practical compilers: syntax-error handling and table compaction. The error-handling section presents error-recovery and error-repair techniques applicable to recursive descent, LL and LR parsers. The table compaction techniques included are applicable to both LL and LR parser tables, as well as to scanner tables and any other situation requiring efficient storage with fast access to elements of sparse tables.
Good treatment of difficult materialDecember 23, 1999
Reviewer: Mr James S Battle from London
Paperback - 452 pages Book&Disk edition (August 15, 1994)
John Wiley & Sons; ISBN: 0471597546 ; Dimensions (in inches): 1.15 x 9.18 x
7.46
Other Editions:
Software
Amazon.com Sales Rank: 60,568
A good first step, April 20, 1999
Reviewer: A reader
from
This is a good, basic, "gateway" book on compiler and interpreter design and
implementation. It can easily provide the reader with the basic concepts of
this tricky topic in a way that will allow the reader to move on to more complicated
materials.
Having taken a compiler construction class in college using "Compilers : Principles, Techniques, and Tools", I can say that this book is much easier to understand and I wish we had spent the first 2-3 weeks of the course covering the material therein.
If you are new to compiler construction or are interested in producing a simple interpreter, this book is for you. If you already consider yourself well read in compiler technology, this book may be of questionable value.
Incomplete, poorly organized, and not very well written, April 6, 1999
Reviewer: A reader from
As with several other O'Reilly books, I found Lex & Yacc
to be maddeningly uneven. The approach is to give a too-brief synopsis of the
tool, then illustrate its use using a very specific example that, one suspects,
is merely the handiest project the authors had available.
I had a fair bit of programming experience when I bought the book, but none with Lex or Yacc. Some fundamental questions came up during the course of my muddling through, and these were left unanswered. I actually got more insight into these tools from a ~20-page web site on the topic.
The reference chapters are organized alphabetically ("ambiguities & conflicts", "bugs", ..., "%ident declaration"), and in a way that does not help someone who is looking for a specific answer (in trying to find out about the possibility of more than one parser in a program, who would think to look under 'v' for "variant and multiple grammars"?). These 'reference chapters' seemed more like a place to dump the information not discussed elsewhere.
Maybe it's a lost cause, finding a comprehensive, well-written introduction to such an arcane topic, but I'm still looking.
Dragon book is cool, but it is only for beginners. If you
are a beginner, always start with Dragon book, but don't abuse this classic
book.
The definitive compiler book for the 1990s, September 23, 1998
Reviewer: Paul Haahr (haahr@jivetech.com) from San Francisco, CA
This book is the comprehensive text for anyone working on an optimizing compiler
for uniprocessor systems. It gives good detail on all major approaches and is
up-to-date on important techniques like SSA form and partial redundancy information.
As someone working directly in the field, it's saved me the effort of
hunting up original research papers in many areas. One drawback for
this book as a practical tool: the pseudocode used to illustrate examples
is often pretty far from being suitable for real implementations.
A warning: this is not an introductory book,
and people who want to learn about the basics of building a compiler should
look elsewhere; perhaps Andrew Appel's ``Modern Compilers'' series. Muchnick's
book is for people who want to write compilers which generate high-performance
code
One of the first books on compiler construction. Outdated but still very important to read. The author can be considered as one of the "verification victims" -- despite being a very talented educator he did not produce any other book of equal significance: all other his books are overburdened with verification scholastic.
A Retargetable C Compiler : Design and Implementation
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.
How they wrote *their* compiler, not how to write *yours*, April 5, 1999
Reviewer: A reader from USA
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.
Material below is partially based on The Teaching About Programming Languages Project. There is huge amount of this type of books and many are too scholastic and/or try to use (unnecessary) formalisms without justifying their usefulness.
Authors WEB page: Principles of Programming Languages: Design, Evaluation and Implementation by Bruce J. MacLennan (Oxford University Press), third edition, 1999).Courses that use this book:
Authors WEB page: Programming Language Concepts and Paradigms by David A. Watt (Prentice-Hall, 1990).
Authors WEB page: Programming Languages: An Interpreter-Based Approach by Samuel N. Kamin (Addison-Wesley Publishing Company, 1990).
If you use this text, you might also be interested in graduate courses that use this book.
Ravi Sethi, Tom Stone (Editor) / Hardcover / Published 1996
Amazon price: $51.95
Authors WEB page: Programming Languages: Concepts and Constructs by Ravi Sethi (Addison-Wesley Publishing Company, 1996)
Copyright © 1996-2007 by Dr. Nikolai Bezroukov. www.softpanorama.org was created as a service to the UN Sustainable Development Networking Programme (SDNP) in the author free time. Submit comments This document is an industrial compilation designed and created exclusively for educational use and is placed under the copyright of the Open Content License(OPL). Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.
Standard disclaimer: The statements, views and opinions presented on this web page are those of the author and are not endorsed by, nor do they necessarily reflect, the opinions of the author present and former employers, SDNP or any other organization the author may be associated with. We do not warrant the correctness of the information provided or its fitness for any purpose.
Last modified: February 28, 2008