[comp.edu] Wanted - A First Compiler Text?

peterd@opus.cs.mcgill.ca (Peter Deutsch) (10/26/90)

g'day,

I have inherited the first undergraduate compiler course
taught here at McGill university am currently evaluating
textbooks for the winter semester (starting in January).

Traditionally we have used the Aho, Sethi and Ulman
"dragon" book, and each year we have received complaints
from students that it is too theoretically oriented for a
first ugrad course. The prof who has traditionally taught
the course has passed me a few sample texts and suggested
that now would be a good time to look at changing the
text.

Soooo, I am looking over what I've acquired and trying to
decide which text to use. This will be the first time I
have taught a compilers course and I'm turning to the net
for advice on how the various available books function in
a ugrad environment. Pointers and suggestions for a
teaching approach are also welcomed.

I have not been following this group to date, but of
course I hope this starts a thread and will be following
along. Email is also welcomed if it turns out this subject
has been done to death here and the articles have long
expired at my site.

So what do I think? I have a few books already. the ones
I'm looking closely at right now are the ones by
Alan Holub (Compiler Design in C), Fischer and LeBlanc
(Crafting a Compiler) and of course I'm still considering
the Aho et al.

To pick a book, I think I need to decide on a basic
teaching approach first. A traditional approach to
compilers seems to be "theory first", with students
extrapolating out what is needed to actually craft a
compiler almost as an aside. I would hazard to suggest
that this is the approach implicit in the dragon book.
This has certainly see,s to have been the approach taken
here at McGill in the past while using this text.
Implicit in this approach appears to be a reliance on
compiler generating tools, such as lex and yacc, to remove
the mundane coding.

When I took my first compiler course (in grad school) the
instructor took a more "constructionist" approach, having
us do far more of the "nitty gritty" than appears to be
usual in ugrad courses. In fact, we were required to build
a top-down recursive descent compiler for a subset of
Modula-2, without benefit of automatic tools.  The
text we used was by Richard Bornat (Understanding and
Writing Compilers). At the time I questioned the need to
actually build a lexical analyser by hand, but have since
come to appreciate what this pain and torture did to me. I
certainly appreciate what the tools allow us to do!

Whatever approach I choose, I intend to centre the course
around a significant compiler construction project.
Traditionally this has been broken into several pieces,
graded separately, but it invariably turns into a single
huge programming push during the last few weeks of class.
Comments on this from other sites, and tips on avoiding
it, are also welcome.

So what approach do I prefer? I am leaning towards a
constructionist, software engineering oriented approach. I
think I would allow the automatic tools, with an emphasis
on getting started as soon as possible in the semester.
I also think I could require the inclusion of a
significant debugger (I believe it is Holub who includes
code to show the stack, etc as parsing progresses).

I feel this approach would be of benefit to students not
just in understanding the construction of a compiler, but
in approaching any large software project in the future.

With this as a background, I think I am leaning towards
the Holub book. I do have a nagging doubt that it is "too
practical" and the students need more fundamental theory
than is included. I also don't want students to just
acquire and compile his code, so would come up with a
different grammer and otherwise modify the project. I like
the presentation in the Fischer book, but feel all the
sample code in Holub will help students in their projects
and want to avoid the "killer project syndrome".

Am I going off the rails here? Should I stick with the
theory or can I include other lessons here? Are there
texts I haven't considered I should be looking at? I have
seen the book by Schreiner and Friedman (Introduction to
Compiler Construction with UNIX) but feel it just doesn't
cut it. I personally find Bornat's exposition a little
tedious, although I did get my own compiler working...

Sorry for the length. Pointers, suggestions, etc welcome.
I have to order the textbook ASAP and welcome feedback,
especially from those who have taught a first compiler
course to undergraduates.

thanks to all in advance.


			- peterd

------------------------------------------------------------------------------

 " Although botanically speaking a fruit, in 1893 the U.S. Supreme Court 
 unanimously ruled that tomatoes are a vegetable (and thus taxable under 
 the Tariff Act of 1883) because of the way they are usually served. "

                                          ref:  Smithsonian, August, 1990.
------------------------------------------------------------------------------