views:

242

answers:

5

will reading compiler construction increase my programming skills?

A: 

This may help you to know how compiler works,if you writing compiler this will increase you skills.This is hard to understand compiler construction in early state of programming education

SomeUser
we have this sbject in our course .. its necessary to pass this subject
nicky
this is more theory that practice
SomeUser
+6  A: 
Michael E
+1 for yacc. Not sure whats with the downvotes.
JoshJordan
+1 but I'm an antlr dude.
kenny
+1  A: 

I would say no, it probably won't. Compilers are a wonderful topic, and the things you'll learn could be valuable, but there are a lot of excellent programmers out there who haven't written a full-blown compiler.

The Dragon Book would be the book to start with. I haven't read it myself, but I've heard that some of the optimizations included in the first edition would be considered out of date today. There's been a lot of progress made on just in time compilers. I'm not sure that textbooks will include this cutting edge research.

I would say that even if you know about compilers and the optimizations they apply, you shouldn't let that knowledge have a great effect on the way you write code. The person who wrote the compiler is probably smarter than you; let them do their job. You're likely to screw things up for them by trying to outguess the compiler.

I think everyone can benefit from simple simulators that show how grammars, parsers, ASTs, code generation, etc. work. Maybe that's a good place to start. Something simpler than learning how a compiler is written would be a good idea.

duffymo
person who designs compiler .. they are also programmer . or there is anothername for them who construct compilers
nicky
Of course, but you probably aren't going to be writing a compiler. My point is: Would you write code differently if you knew how the compiler worked? I'm betting "no". You'll be a better programmer because of all the things you'll have to understand to write a compiler, but there are lots of programmers who can't write one who are effective.
duffymo
The dragon book (even the latest edition) is dated and verbose. Cooper and Torczon's *Engineering a Compiler* is a good modern survey. For more details on more optimizations, look to Muchnick's *Advanced Compiler Design and Implementation*. For more on parsing, see Grune's *Parsing Techniques: A Practical Guide* (1st ed. is available free online). If you're interested in functional compilation, Peyton-Jones' initial tech report on the Spineless Tagless G-Machine is great, but Davies' *An Introduction to Functional Programming Systems Using Haskell* is a better survey. Both are dated.
Jeremy W. Sherman
Nice, jayw. Thanks for confirming the anecdote about the Dragon Book.
duffymo
A: 

Personally, the thing that made me a better programmer was looking at the code generated by compilers (assembler list). Knowing how a compiler works (I do) and beeing able to write a compiler (I did) is not that useful.

It's interesting to look into an assembler list generated with parameters set to optimisation, and an assembler list of the same source code without optimisation compilation. And to compare the result of different compilers. That way, you'll learn to adapt your code to the compiler (even if you write in C, C++, C#, ...).

Filip P.
+2  A: 

Compiler construction can definitely improve your programming skills even if you never write a production compiler. If nothing else a compiler is a really good real world example of a number of graph algorithms put to use. The other benefits are even more important. You will gain an understanding of why programming languages are structured the way that they are and what the compiler is really doing. If you ever have to troubleshoot compiler or optimizer problems, you will thank yourself for paying attention in class.

If you plan on doing embedded device work, I would highly suggest taking the course and paying close attention. Then try to find a course in operating systems that covers executable loading (i.e., linkers and loaders). Understanding what the compiler is doing, how it structures assembly, and how dynamic library loading works have been extremely helpful in debugging, diagnosing, and reasoning about problems I have encountered in writing and deploying embedded applications.

D.Shawley