Archived

This topic is now archived and is closed to further replies.

sakky

Compiler Design

Recommended Posts

sakky    100
I''m searching around for building compilers and I found with book. Its called Compiler Design in C, by Allen I. Hulub. Have any of you heard of this book. I just started reading it and it has already revealed alot to me. The first few pages in chapter 1 start talking about the compiler structure. This is intresting, This book says that some compilers don''t have preprocessors; others generate ASM code in a second pass, optimize the ASM code directly, and don''t have a forth pass. Others generate binary instructions directly, with out an ASCII intermediate language ( ASM ). I would like to play around and make a goofy little programming language that runs a run time, like Java. Some real simple to have run and learn with.

Share this post


Link to post
Share on other sites
daerid    354
If you''re really interested in Compiler design, get the Dragon Book (Compilers: Principles, Techniques, and Tools). It''s hardback, about $80, but it''s the compiler bible.

Share this post


Link to post
Share on other sites
sakky    100
I''m looking for that book, but I need more information: author, title, and so on. Were I can get it cheap; if not amazon.

Share this post


Link to post
Share on other sites
Oluseyi    2109
Author: Aho and some others. (Aho is the "A" in "Awk"; Kernighan - of K & R fame - is the "K").
Title: Compilers: Principles, Techniques and Tools. Also see Compilers: Principles and Practice (aka Son of the Dragon Book).

You might be able to find it (or them) in the public library, and definitely in a university library (so long as they have a CS program).

Share this post


Link to post
Share on other sites
OctDev    158
Just to reiterate, get the dragon book. It trully is THE reference for compiler design and development.

The Tyr project is coming...

Share this post


Link to post
Share on other sites
Hippokrates    122
I have got a question on the Dragon Book.
Will it teach me how to actually build a working compiler or will it just the general principles and techniques (feturing pseudo code...) ?

Share this post


Link to post
Share on other sites
Oluseyi    2109
There are things called book reviews and publisher websites... And you don''t have to wait until someone feels willing/capable to answer your question.

Anyway, the Son of the Dragon Book contained a lot of code for implementing a Pascal compiler (I last looked at it in ''97 or ''98). I''ve never read the Dragon Book, and choose a more implementation-oriented text from the library a week ago (which, incidentally, also builds a Pascal compiler, among others). The book I borrowed is called Writing Compilers and Interpreters.

Share this post


Link to post
Share on other sites
paulmason    122
Apart from the Dragon Book, I particularly like ''Programming Language Processors in Java: Compilers and Interpreters'' by David A. Watt, Deryck F. Brown, Deryck Brown, ISBN: 0130257869

see: http://www.amazon.com/exec/obidos/ASIN/0130257869/002-8432514-2450437#product-details

It''s a good beginner book that takes a practical approach to compiler development, and is easy to follow even if you aren''t using Java.

Paul

Share this post


Link to post
Share on other sites
sakky    100
After reading into alot of the basic ideas with this book, making a compiler dons''t seam to hard. My book makes frequent references to Flex and Bisonm, with some documentation about them. So all in all, it seams like so far, the book is a good tutorial.

I like Java. But I would realy like to get into computer science. I would like to, if not make, at least come close to inventing my own C/C++ like language.

Share this post


Link to post
Share on other sites
dMDI    122
If you like Java, use SableCC, it is much nicer than most compiler compilers out there, and comes with lots of examples too. http://sablecc.org

Share this post


Link to post
Share on other sites
spock    217
Sounds like you might be interested in A Retargetable C Compiler: Design and Implementation. This book explains the details in the implementation of LCC, a complete ANSI C compiler with back-ends for several platforms including x86. It's a pretty good book if you want to see actual implementation concerns and issues, although some of the methods used are a bit old-fashioned.

But if you only buy one book on compiler design/construction, by all means go for the Dragon book. You need to understand the theory behind this stuff well.

[edited by - spock on October 3, 2002 8:36:28 AM]

Share this post


Link to post
Share on other sites
spock    217
quote:
Original post by daerid
get the Dragon Book (Compilers: Principles, Techniques, and Tools). It's hardback, about $80, but it's the compiler bible.


Actally, a cheaper paperback edition do exist (or at least did when I bought it): the Addison-Wesley "World Student Series Edition". It's an unabridged reprint, but I don't think it is available in the US.

[edited by - spock on October 3, 2002 8:33:47 AM]

Share this post


Link to post
Share on other sites
Redleaf    219
I glanced over "Compiler Design in C" in my library recently when I went to pick up the Dragon book that everyone was recommending. It seems to be focused a bit more on the practical building of a compiler, while the Dragon book focuses heavily on the theoretical aspect. It looked good, however, and is a little more recent than the Dragon book.

Perhaps you should start with one, and then read the other? They''re gigantic books, but this is what I intend to do myself.

"Don''t be afraid to dream, for out of such fragile things come miracles."

Share this post


Link to post
Share on other sites