10

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?

6
  • 2
    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. Commented Jan 26, 2011 at 14:33
  • This one seems too theoretical: ocw.mit.edu/courses/electrical-engineering-and-computer-science/…
    – Job
    Commented Jan 26, 2011 at 17:01
  • 1
    I did it at uni in my 3rd year too. - Was the 2nd best module I took in the entire course (After AI). Commented Jan 27, 2011 at 12:05
  • @TWith2Sugars: Why would you say CC is one of the best?
    – Nipuna
    Commented Jan 27, 2011 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. Commented Jan 27, 2011 at 14:02

6 Answers 6

13

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.

1
  • 7
    +1 for exploding brain. Also, never put off writing your compiler until the end of the semester! I know from experience...
    – Jeremy
    Commented Jan 26, 2011 at 20:06
21

Oh it's a good one. Take it you won't regret it.

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.

1
  • 2
    Plus it gives you insight into whats' a good/bad language, which is a regular topic around here. Commented Jan 26, 2011 at 14:20
8

Definitely!

It may not be a topic you would use daily like a databases class for example, understanding compilers will give you a great foundation.

A similar example would be an Operating Systems class. You might be a programmer and not think about how an OS works every day, but having the grounding in it will help you in the long run.

2
  • 3
    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.
    – justkt
    Commented Jan 26, 2011 at 14:30
  • For some reason in my 3rd year the removed the OS module :( Really wanted to do it as well. Commented Jan 27, 2011 at 12:08
6

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.

0
4

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.

2
  • what you mean by eDSL compilers?
    – Nipuna
    Commented Jan 26, 2011 at 13:19
  • 1
    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-logic
    Commented Jan 26, 2011 at 13:24
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.