Fog Creek Software
Discussion Board




Ronald Mak's compiler book

For the last several years I've been working mostly with VB with a smattering of C++ used for time critical or specialized operations where VB is inappropriate. In general I have no problem with this since, unlike many, I have no problem with VB as a language despite its limitations and I actually prefer verbose languages.

But I have started becoming annoyed, lately, at how much of my C/C++ and assembly I have forgotten. So I decided to start looking into compilers as a way of refreshing my memory and giving me some interesting projects to do over the next several months.

I know very little about compiler theory so I was looking for a good, practical introduction using C++. The number one recomendation for an introductory compiler book was Ronald Mak's book and as a bonus several people strongly recomended it as a source of high quality C++ code.

So I bought the book and I've been going through it over the last several days. So far I've found that it is too practical - it's too light on theory and context. But that isn't a big problem. Worse is that I find the C++ code is actually quite poor quality - poorly designed, poorly commented and only adequate technically. So much so that I find the compiler information hard to extract because the code gets in the way.

Am I totally out to lunch on this and as I slog through the book more I will grow to appreciate it? Or is it really not that good and if so what are the good compiler books (introductory and then more advanced)?

Stephen Martin
Thursday, May 29, 2003

If you want to brush up on C/C++, get a C/C++ book, not a compiler book.

But if you want to brush up on a broad range of language topics and theory, then finish the compiler book.  Compilers and Programming Languages were two of my favorite classes in college, and it really gives you a new way to look at languages.  I find myself thinking "How did they do that?" and "Why did they do it that way, its not hard to make it a little more ..." when writing code in different languages (the languages I'm referencing are perl and VB respectively, with those comments ;)

I stay stick with the compiler book, finish it, then get a C/C++ book.  They'll both benefit you quite a bit.

Andrew Hurst
Thursday, May 29, 2003

Ronald Mak's book is IMO a perfectly fine book for learning about recursive descent compiler construction.  Take the source code for what it's worth.  It's meant to show you how a compiler is constructed.  Personally, I think it is clean and easily understood.  It is standard code for creating a recursive descent compiler.  Use it as a starting point for your own code and if you can think of a better way to write a recursive descent compiler then maybe you should write a book.

Dave B.
Thursday, May 29, 2003

It's a common problem.  They all have dodgy source, but then it's supposed to fit on the pages of a book...

Colin Newell
Friday, May 30, 2003

I think even though there are tools like flex and bison (and equivalents for various other languages) which are fairly easy to use, compiler construction is still a black art. Or at least pretty esoteric. That can't be said about many things in computer programming.

Warren
Saturday, May 31, 2003

*  Recent Topics

*  Fog Creek Home