I'm a undergraduate in my 3rd year of a Software Engineering degree. From this year on, my university has introduced a new course called 'Compiler Constructions', which teaches you the basics of the theory of building a compiler.

What would be the real world advantage for a Software Engineer of learning about compiler construction?

Although I absolutely don't regret taking the compilers course, it was the toughest I ever had. Most CSci courses either had significant theory that had to be learned, or lots of programming, not both. Compilers had both.
–
David ThornleyJan 26 '11 at 14:33

I did it at uni in my 3rd year too. - Was the 2nd best module I took in the entire course (After AI).
–
TWith2SugarsJan 27 '11 at 12:05

@TWith2Sugars: Why would you say CC is one of the best?
–
NipsJan 27 '11 at 12:15

1

the penny dropped several times for me in the class - plus an engaging lecturer and decent fellow students made it something I really enjoyed. One of them moments I remember was we started doing grammar expressions in the beginning and the lecturer said "This won't make sense until the second term" - The second term is when we started to build the rest of the compiler (1'st term we built a parser/tokeniser). That for me made it a great module.
–
TWith2SugarsJan 27 '11 at 14:02

6 Answers
6

There is a practical side to learning compiler construction. There have been several occasions where I've needed to build parsers to implement some app-specific command language. It allowed me to create flexible, scriptable interfaces to the app.

It also gives you greater insight into why some languages are designed the way they are, and why no language is perfect.

It's a tough course, one of the tougher ones in the curriculum. I made the mistake of taking it during a summer session; never take a compilers course in a summer session, your brain will explode.

You get insight into the magic of programming languages, their comparative characteristics, transformation of high-level code into its executable form. You'll better understand many language features, will have a broader view of what is possible and how those things are done. You'll just see it all with different eyes.

It is wise to spend time at university to learn fundamental things of CS. Concrete programming languages, tools and libraries they all come and go, but the foundation stays.

Also if you survive the course (provided it will be serious) you may then congratulate yourself of having the right brain for programming. Get some practical project done with this theory, mention it in your resume and you will very much raise interest with good employers.

Yes! The course will give you a much deeper understanding about parsing programming language, data types and functions and how to translate it into machine code for specific CPU:s.

This, by itself, may not be of much practical daily use, but it will give you confidence that you actually know how stuff works. This is very helpful (speaking with experience here) when you have to do low-level optimization and finding those really nasty bugs, which has everyone else stumped.

There is a lot of buzz about Domain Specific Languages nowdays. And they really worth all the buzz, their true potential is yet to be explored. So, compilers construction skills will become not just important but essential in the future. I spend about 60% of my development time implementing eDSL compilers, even if the current problem is not directly related to compilers at all.

As I'm using languages that support metaprogramming, each embedded domain specific language I implement is practically a compiler macro. Some are fairly complicated, with their own type system and numerous translation passes, some are trivial, but all are compilers. No point in interpreters unless they're really needed.
–
SK-logicJan 26 '11 at 13:24

My undergrad OS course was the first place I had to really understand concurrency. It was hugely practical. My undergrad programming languages course was best when we were writing parsers.
–
justktJan 26 '11 at 14:30

For some reason in my 3rd year the removed the OS module :( Really wanted to do it as well.
–
TWith2SugarsJan 27 '11 at 12:08

Its worthwhile to take a course to understand how the tools you will be using for the entirety of a programming career (e.g. compilers, interpreters, parsers) are built, and what there limitations are.

Its also worth doing this in an academic context, as that exposes the interesting fundamentals and not the many complexities of the real world, which is messy and mired in dealing with legacy languages and architectures i.e. lots of complexity. Its also more likely that you will get to work on all the aspects of a compiler in building a whole one for a course, than in working on one in industry.