Re: Compiler Design in C How about it?

Preston Briggs <>
Fri, 1 Jun 90 19:49:41 GMT

          From comp.compilers

Related articles
Compiler Design in C How about it? (1990-05-30)
Re: Compiler Design in C How about it? (Preston Briggs) (1990-06-01)
Re: Compiler Design in C how about it? rice@DG-RTP.DG.COM (Brian Rice) (1990-06-01)
Re: Compiler Design in C How about it? (Mark Henderson) (1990-06-04)
Re: Compiler Design in C How about it? (1990-06-04)
Re: Compiler Design in C How about it? (1990-06-05)
Re: Compiler Design in C How about it? napi@rangkom.MY (1990-08-07)
| List of all articles for this month |

Newsgroups: comp.compilers
From: Preston Briggs <>
Date: Fri, 1 Jun 90 19:49:41 GMT
Organization: Rice University, Houston
Keywords: books, summary
In-Reply-To: <>

In article <> you write:
>Can anyone give me an unbiased opinion about the book Compiler Design in C
>by A. Holub.

Here's my (certainly biased) review.

It's massive -- more than 900 pages.
Primarily concerned with front-end development; that is, minimal coverage
of optimization or code generation. 450 pages on scanning and parsing,
which apparently includes development of LL and LALR parser generators.
Much source code available. Another 200 pages describing most of
a C front-end. Great figures; the best I've ever seen for the symbol table
layout, etc. 25 (fatal) pages on optimization. 200 pages of
appendices. Weak bibliography; almost exclusively books and ignoring
most of the interesting technical literature (archival journals,
conference proceedings).

Overall, I'd say it magnifies the problem of Aho, Sethi, and Ullman
(the Red Dragon book) in that it over-develops the easy parts of a
compiler and gives short shrift to the interesting areas (I said I was

I complained about the coverage of optimization. The short chapter
is really just a menu and I only skimmed it. Three things stood out:

    1) Discussions of optimization should introduce and emphasize data flow
          analysis. Without it, all is lost.

    2) He propagates the common error that an integer var divided by
          a constant power of 2 (say x/8) can be replaced by a shift right
          (say x >> 3). This gives suprising answers when x is negative.

    3) Near the end of the chapter, he includes this paragraph:

            ``You, as the compiler writer, must decide if it's worth the risk of
doing this kind of optimization. It's difficult for the compiler to
distinguish between the safe and dangerous cases, here.
For example, many C compilers perform risky optimizations
because the compiler writer has assumed the that a C programmer
can understand the problems and take steps to remedy them at the
source code level. It's better to provide the maximum optimization,
even if it's dangerous, than to be conservative at the cost of less
efficient code.''

I was shocked. My optimizer friends were shocked. I didn't show it to
my Scheme or ML friends as it would have confirmed their worst suspicions
about compilers and compiler writers.

Preston Briggs looking for the great leap forward
[I must admit, I'd be awfully reluctant to use a compiler that was written
by somebody who feels that way. There's a computational tradition of
preferring wrong answers quickly to correct answers slowly, but it was never
a good idea. -John]

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.