Slashdot Mirror


Good Books on Compiler Programming?

Josuah asks: "I just started my CS164 Compilers class at the University of California, Berkeley and the book we are using is called Compilers: Principles, Techniques, and Tools by Alfred V. Aho, Ravi Sethi, and Jeffrey D. Ullman, published by Addison-Wesley. Our professor told us today that the book kinda sucks because it is old (1988) but was unable to suggest a better book. Does anyone know of a good book on modern compiler programming? "

1 of 15 comments (clear)

  1. Muchnick, Morgan, Appel, and Wolfe by haahr · · Score: 3
    Aho, Sethi, and Ullman is fine for the front-end of a C, Fortran, or Pascal compiler, but isn't very good if you care about interesting type systems or dynamic languages, and is absolutely awful for optimization in a modern compiler.

    Advanced Compiler Design and Implementation by Steve Muchnick is probably the best single book out there, if you don't care about parsing or other front-end issues. Almost all optimization issues are well covered. While writing a JIT for Java, this was the book I had open most often. My biggest criticism is that the algorithms are very high level and abstract: one I implemented ran in O(n^4) time as it was described, but with reasonable data structures was brought down to O(n log n) time.

    Robert Morgan's Building an Optimizing Compiler is also quite good. It covers mostly the same material as Muchnick's, but where Muchnick gives a survey of most major techniques in a given area, Morgan picks one and takes you through a pretty real implementation. It's not nearly as good a reference, but is definitely an easier read.

    Andrew Appel's Model Compiler Implementation in (ML|C|Java) is really good for the text, but the code is odd. Well, the ML code is fine and straightforward, but the Java and C versions will seem strange to people who don't write their code in ML and translate it to Java or C. If you want both front-end and back-end, though, pick one of these books. (His earlier, more hardcore Compiling with Continuations is very interesting, but not so practical anymore and only relevant for languages like ML or Lisp.)

    Michael Wolfe's High Performance Compilers for Parallel Computing covers the same turf as Morgan and Muchnick, but with a focus on parallel machines (though the scalar parts of the book are good, too). Definitely the first place to go if you really want to speed up matrix operations on MP or vector hardware.