views:

74

answers:

4

I'm taking several classes this fall for my masters and one of them is Compiler Design and Construction. I am pretty well versed in most things related to computer technology, but I have not had much experience with how compilers do the dirty, I just use them when I need to. I am not usually nervous about classes, but I kind of feel like I am walking into this one naked. If anyone can recommend some good reading or provide a short list of basic principles that I can research to bring me up to speed quickly I would be most grateful.

+2  A: 

The dragon book is usually highly recommended.

jer
I don't think this is the basic background he needs. If he can understand the Dragon book, he doesn't need to take the class :-}
Ira Baxter
Downloading it now. I am a fast learner so I'll give it a look anyhow.
typoknig
@Ira, there are many ways of learning. Those truly interested in subjects can learn from intermediate materials. Being excited or interested in something usually means you want to learn about that thing. If you come up upon things that you don't know, and aren't well explained in your document, you generally seek the answers out. That said, there's not much in that book which should be unfamiliar to anyone who is "well versed in most things related to computer technology" if that implies knowledge and understanding in computer science.
jer
@Jer: Its a fine book, I've had it on my shelf since the first edition. Yes, you can look through it, and the serious can study it. But getting some foundation ideas and a bit of experience makes that book far, far more interesting and approachable.
Ira Baxter
The preface of that book suggest the first half of the book should be covered in an undergrad course and the second half should be covered in a grad course. Classes start in 10 day so I should get reading :)
typoknig
+2  A: 

Compilers are a bit of a head-spinning exercise. However, if you have solid grasp of data structures, algorithms, and assembly code, and a penchant for thinking through the details, you'll probabaly find the class fascinating because it is so different than most of conventional business data processing and/or embedded computing.

I'd make sure you had the assembly code background down pretty well. Most procedural coders aren't used to machine instructions, registers, address modes and pointers. If you get those, the instructor will likely explain the rest pretty well.

If you aren't used to pointers, then run don't walk, to your nearest C compiler and write a bunch of programs that use them.

For some background on what compilers are not, see http://stackoverflow.com/questions/1685148/writing-compilers-whats-right-and-whats-wrong

If you want a really interesting exercise, you can learn about MetaII, which is how to build a compiler that builds a compiler with an insanely small amount of effort. There is a 10 page paper on how to do this that has a mind-blowing moment in the middle where you suddenly see how the compiler can compile itself. There's a MetaII tutorial (with the paper) at:

http://www.bayfronttechnologies.com/mc_tutorial.html

Ira Baxter
While everything you say has value, some of it is seriously limited to having a particular class of languages in mind. Compilers exist for many different types of languages, those that involve knowledge of assembly, and many more that do not. I believe what you're trying to say is that you should know what it is you want to do, and what you want to end up with.
jer
@Jer: yes, it is, but I doubt he's going to compile to a Prolog target as the starting place. Most traditional compiler classes target some kind of simplified assembler, so its a good bet that knowing that will be helpful.
Ira Baxter
Not what I meant. Look at all the systems that exist today, even just in programming languages, you have far more interpreters which themselves, contain a compiler coupled with the read-eval loop. Plus there are other systems, like syntax highlighting engines, all the way down to configuration files.
jer
@Jer, agreed, you can use "compiler technology" for an incredible variety of tasks. (See my bio...). He's still taking an *intro* to-compilers class :-}
Ira Baxter
+2  A: 

Check the Dragon Book

stacker
I'm elbow deep in the first chapter and I think this is exactly what I was looking for. From my reading I can already see that I also need to brush up on my assembly skills, but I feel better about the class already. Thanks!
typoknig
A: 

The first time someone explained compilation to me, I was surprised how rooted in convention it all was. There were always the same high-level stages in compilation, with the same divisions in sub-tasks.

Looking back, some of it is a little arbitrary. Writing a compiler is difficult and re-applying techniques that have worked for countless others in the past is indeed a good idea. But depending on your background, you may at first be surprised that everything does not flow naturally from basic principles as much as in other areas of Computer Science.

Pascal Cuoq