www.digitalmars.com         C & C++   DMDScript  

D - Compiler Design Book

reply John Reimer <jjreimer telus.net> writes:
A little off topic...my apologies.

I came across a book entitled,

The Art of Compiler Design Theory and Practice
by Thomas Pittman/James Peters
1992

Is anybody familiar with this book?  Is it a good book for a serious 
introduction to compiler design theory?  So far it seems to read well, 
but it would be nice to have some experienced recommendations.

Any other books for recommended reading?  I've heard about the dragon 
book, but I keep hearing people say that it is outdated.  Perhaps it is 
still good as an introduction.

Thanks!

John
Nov 21 2003
next sibling parent reply "Charles Sanders" <sanders-consulting comcast.net> writes:
Havent read that one, some ones I liked are

A Retargetable C Compiler : Design and Implementation
Writing Compilers and Interpreters

Although the last one , the code doesnt actually work, it was still
interesting to see how it was implemeneted.

Let me know how that book is :).

C


"John Reimer" <jjreimer telus.net> wrote in message
news:bplv3b$1pq$1 digitaldaemon.com...
 A little off topic...my apologies.

 I came across a book entitled,

 The Art of Compiler Design Theory and Practice
 by Thomas Pittman/James Peters
 1992

 Is anybody familiar with this book?  Is it a good book for a serious
 introduction to compiler design theory?  So far it seems to read well,
 but it would be nice to have some experienced recommendations.

 Any other books for recommended reading?  I've heard about the dragon
 book, but I keep hearing people say that it is outdated.  Perhaps it is
 still good as an introduction.

 Thanks!

 John
Nov 21 2003
parent John Reimer <jjreimer telus.net> writes:
Charles Sanders wrote:
 Havent read that one, some ones I liked are
 
 A Retargetable C Compiler : Design and Implementation
 Writing Compilers and Interpreters
 
 Although the last one , the code doesnt actually work, it was still
 interesting to see how it was implemeneted.
 
 Let me know how that book is :).
 
 C
 
Thanks Charles. I think I've heard of the book you mention. I haven't got it yet. I try to collect different textbooks now and again. I'll have to keep a lookout for that one too. Once I get further into it, I'll let you know how this book turns out. So far, I consider the theory to be pretty thick and heavy. It treats mathematical set theory and grammar definitons as important topics. I have to kind of rack my brain to get familiar with some of this new concepts. Later, John
Nov 25 2003
prev sibling parent reply jjreimer telus.net writes:
For those interested, I noticed that an updated "Dragon Book" is to be released
early next year (it's about time -- last one was 1986).  It's now called:  21st
Century Compilers.  It appears much updated with discussions on garbage
colletion and other modern compiler design topics.  It doesn't sell cheap,
though!

Maybe I should have posted this in chat, but considering how chatty it is in
here, I think it's still on topic ;-).

Later,

John
Dec 20 2003
parent reply "Walter" <walter digitalmars.com> writes:
<jjreimer telus.net> wrote in message news:bs2d0n$f7m$1 digitaldaemon.com...
 For those interested, I noticed that an updated "Dragon Book" is to be
released
 early next year (it's about time -- last one was 1986).
Too late, I already wrote the compiler <g>.
Dec 21 2003
parent reply John Reimer <John_member pathlink.com> writes:
Too late, I already wrote the compiler <g>.
Darn, you're too fast. :-D But for the rest of us... I assume you would still recommend this book, right?
Dec 21 2003
next sibling parent reply "Charles" <sanders-consulting comcast.net> writes:
I actually heard the dragon book was abit outdated and disorganized.  I more
of a hands-on person then theory, hopefully the new book will contain alot
of examples.  Next year is along time away though :/

C

"John Reimer" <John_member pathlink.com> wrote in message
news:bs4fa9$lau$1 digitaldaemon.com...
Too late, I already wrote the compiler <g>.
Darn, you're too fast. :-D But for the rest of us... I assume you would still recommend this book, right?
Dec 21 2003
next sibling parent Ant <Ant_member pathlink.com> writes:
In article <bs4kuc$u1f$1 digitaldaemon.com>, Charles says...
I actually heard the dragon book was abit outdated and disorganized.  I more
of a hands-on person then theory, hopefully the new book will contain alot
of examples.  Next year is along time away though :/

C
I have to say. On my commodore amiga years (almost 20 years ago) I bought a book called somothing like Design your own C compiler on C. So I follow the thing and end up with my own language. I couldn't realy make a compiler so it was interpreted. The source code was compiled into a byte code that was fast to parse and contain calls to a lib. Those things are very easy to build. (This statment makes this post On Topic;) I made it in assembler not C (Motorola 68K macro assembler is a much better language then some I used professionally since) The language was a mix of the features I liked better from C and Pascal. So this contradicts my first post. I didnt' remember! The same thing happend when 2 years ago I bought a violin and started teaching myself. I was saying that it was my first violin when I had inherited one from a great-uncle when I was 13!... Ant
Dec 21 2003
prev sibling next sibling parent John Reimer <John_member pathlink.com> writes:
In article <bs4kuc$u1f$1 digitaldaemon.com>, Charles says...
I actually heard the dragon book was abit outdated and disorganized.  I more
of a hands-on person then theory, hopefully the new book will contain alot
of examples.  Next year is along time away though :/
Yes, I heard the same of the old book. I was hoping the new book would change that reputation somewhat. And actually it is due to be released in January of 2004, so that's not to long from now. :) As for theory verses practice, I believe the book is a combination of both, and provides some implementation details. I too am not interested in pure theory, though I understand the need for it in the complicated field of compiler design. Hopefully the new book is an improvement on the original. I may get it later. I'm using the ancient version of the book (1979 :-p -- don't laugh, picked it up for cheap) so anything's got to be better than that :-). Later, John Reimer
Dec 21 2003
prev sibling next sibling parent reply John Reimer <John_member pathlink.com> writes:
In article <bs4kuc$u1f$1 digitaldaemon.com>, Charles says...
I actually heard the dragon book was abit outdated and disorganized.  I more
of a hands-on person then theory, hopefully the new book will contain alot
of examples.  Next year is along time away though :/
I heard the same about the original and am hoping the new book will fix these issues. I also prefer implementation examples to back up theory, so it would beneficial if the new book provided a small language implementation. I know other books that do. At the same time I understand the need for a good theoretical base to comprehend complicated compiler design. The book I have is the old dragon book (1979 -- believe it or not; hey, it was cheap!). So I'm kind of interested to see what the new book has to offer. Lots of examples in it would indeed be welcome!
Dec 21 2003
parent reply "Walter" <walter digitalmars.com> writes:
"John Reimer" <John_member pathlink.com> wrote in message
news:bs4o1f$12n8$1 digitaldaemon.com...
 In article <bs4kuc$u1f$1 digitaldaemon.com>, Charles says...
I actually heard the dragon book was abit outdated and disorganized.  I
more
of a hands-on person then theory, hopefully the new book will contain
alot
of examples.  Next year is along time away though :/
I heard the same about the original and am hoping the new book will fix
these
 issues. I also prefer implementation examples to back up theory, so it
would
 beneficial if the new book provided a small language implementation.  I
know
 other books that do. At the same time I understand the need for a good
 theoretical base to comprehend complicated compiler design. The book I
have is
 the old dragon book (1979 -- believe it or not; hey, it was cheap!).  So
I'm
 kind of interested to see what the new book has to offer.  Lots of
examples in
 it would indeed be welcome!
Writing a good compiler means sweating the details and getting the basics right. Those basics are the same now as they have been for 40 years. DMC++ is the fastest C++ compiler out there, and its based on 1982 technology. Object-orienting the guts of the compiler has made it better (see the DMD front end source for example), but that isn't really a new *compiler* technology.
Dec 26 2003
parent reply John Reimer <John_member pathlink.com> writes:
Writing a good compiler means sweating the details and getting the basics
right. 
You're telling me! It's no easy topic from the stuff I've been reading so far! But I guess a hard study effort will pay off eventually.
Those basics are the same now as they have been for 40 years. DMC++
is the fastest C++ compiler out there, and its based on 1982 technology.
Not to blow your own horn or anything ;-D. It is pretty darn fast, though.
Object-orienting the guts of the compiler has made it better (see the DMD
front end source for example), but that isn't really a new *compiler*
technology.
Thanks for the suggestions! I've glanced at the D front end source at one point and noticed that you used some OOP in that. I'll definitely have a good reference for real-world compiler lexical analysis and parsing technology. Thanks for making this source open. It's sure better than trying to study something like say... gcc ...lol. Later, John
Dec 26 2003
parent "Walter" <walter digitalmars.com> writes:
"John Reimer" <John_member pathlink.com> wrote in message
news:bsiikr$m4f$1 digitaldaemon.com...
Object-orienting the guts of the compiler has made it better (see the DMD
front end source for example), but that isn't really a new *compiler*
technology.
Thanks for the suggestions! I've glanced at the D front end source at one
point
 and noticed that you used some OOP in that.  I'll definitely have a good
 reference for real-world compiler lexical analysis and parsing technology.
 Thanks for making this source open.  It's sure better than trying to study
 something like say... gcc ...lol.
You're welcome. The fastest way to learn how to write a compiler is to study an existing one.
Dec 27 2003
prev sibling parent John Reimer <John_member pathlink.com> writes:
Sorry for double post... the web interface has lag. I thought my last one didn't
get through, so I rewrote the message.
Dec 21 2003
prev sibling parent reply "Walter" <walter digitalmars.com> writes:
"John Reimer" <John_member pathlink.com> wrote in message
news:bs4fa9$lau$1 digitaldaemon.com...
 I assume you would still recommend this book, right?
I have read the earlier two editions of it, and they are excellent introductions to compiler writing. I've also taken a compiler course instructed by Profs. Ullman & Hennessey, and I learned a great deal from that course that went far beyond their book. I hope the new edition will have that extra info in it!
Dec 26 2003
parent reply John Reimer <John_member pathlink.com> writes:
I have read the earlier two editions of it, and they are excellent
introductions to compiler writing. I've also taken a compiler course
instructed by Profs. Ullman & Hennessey, and I learned a great deal from
that course that went far beyond their book. I hope the new edition will
have that extra info in it!
That's encouraging because the basics are all I need at this point, so the old book will be a great starting point. I will likely grab the new book at some point because intro describes "new" or "more indepth" chapters on: "syntax-directed translation, data-flow analysis, code optimization, just-in-time compiling, and garbage collection" among other things. I didn't think those topics were too new though...but perhaps "new" to the book. JIT and garbage collection were around pre-Smalltalk days from what I recall. Perhaps the techniques taught are modernized. It's quite an opportunity you had learning under those professors. I imagine information covered in those classes might not readily make it into any textbook. I'd like to be pleasantly surprised to the contrary, though :-). Later, John
Dec 26 2003
parent "Walter" <walter digitalmars.com> writes:
"John Reimer" <John_member pathlink.com> wrote in message
news:bsig6j$i1u$1 digitaldaemon.com...
I have read the earlier two editions of it, and they are excellent
introductions to compiler writing. I've also taken a compiler course
instructed by Profs. Ullman & Hennessey, and I learned a great deal from
that course that went far beyond their book. I hope the new edition will
have that extra info in it!
That's encouraging because the basics are all I need at this point, so the
old
 book will be a great starting point.  I will likely grab the new book at
some
 point because intro describes "new" or "more indepth" chapters on:
 "syntax-directed translation, data-flow analysis, code optimization,
 just-in-time compiling, and garbage collection" among other things.  I
didn't
 think those topics were too new though...but perhaps "new" to the book.
JIT and
 garbage collection were around pre-Smalltalk days from what I recall.
Perhaps
 the techniques taught are modernized.
None of those are new, except perhaps just in time compiling (a technology I believe was invented by Steve Russell of Symantec).
 It's quite an opportunity you had learning under those professors.
What they offered was their full year compiler course compressed into two weeks one summer. It was a lot of fun to attend.
 I imagine
 information covered in those classes might not readily make it into any
 textbook.  I'd like to be pleasantly surprised to the contrary, though
:-). I think it could be, I don't know why they haven't put it in long ago.
Dec 27 2003