There is a lot of variety when it comes to the different types of programmers. In general, is beneficial for a programmer to learn how to build a compiler? In what cases would
I took two compilers courses in university and found them useful because:
Some people would counter that there are more useful things you could be doing with your time, like learning a popular programming language or library that could help get you a job (this argument is often used as a reason not to learn assembly language). However knowing how compilers work will probably make it easier to learn new programming languages (see point #4).
I recently did an independent study on what we called Language Processing (my final project was no so much a compiler as a c++ file parser/interpreter with compiler-like features). I was required to use the "Dragon" book that was mentioned above. I thought that as a software developer this was one of the more important things that I have done in my college career. I found it not only interesting and rewarding for my own personal benefit but it also allowed me to see deeper into the language. On top of the because the Dragon book is not language specific it helped me to understand the similarities and more importantly the reasons behind the differences in different languages. I do however agree with the fact that not all programmers may find it necessary. Yet in the field of software development I think that if you have an interest in expanding your understanding of language design it can be very helpful to look at compilers.
Compiler programming is an interesting topic and there is some great value to it. At the college I went to it was an elective, Language Design and Implementation. I'm personally grateful to have taken it. We learned the various ways to implement lexers, parsers, and bytecode emitters.
The real value that I've seen is that it illuminated the black box that I depend on to get my program up and running. It gave me a better insight into how the compiler works, and helped me better understand compiler errors.
The process of compiling source into code is actually in a general way what most programs do, take some input, perform some process, and output the result. A compiler has some very well-defined ideas on how this should best be done.
I think in all it was beneficial to me, and currently I work on Java based web apps.
I think, it is better to learn from knowledge point of view. At least you can look into existing compiler source code and understand the typical compilation steps and complexity involved in each phase of compilation.
This is like asking "is it beneficial for a programmer to have more programming knowledge?". The simple is that yes, it is beneficial. How much will it benefit day to day non-compiler-building programing affairs is hard to guess. But it will definitely teach you about how the internals of what you are doing work, how to manipulate strings to dictate logic and possibly help you debug better regardless of what you use.