14

I'm preparing for an exam concerning languages, grammars, parsing and compilers. It's not really my cup of tea and most resources I find use the language of mathematics to define the different terms of the trade and explain the different concepts I need to know rather than stick with English or French, which I would very much prefer. Therefore, I'm having some trouble both with finding the motivation to continue studying and with simply understanding the theory. So here is my question: Do any of you know where I could find a "fun" way of learning all this? Or at the very least, maybe a more "concrete" and less "mathematical" way of handling this subject.

I need to cover the following so anything on these subjects is welcome!

  • Parsing (LR, LL, ...)
  • Grammars (Context-free, deterministic, ...)
  • Syntax analysis Static flow analysis
  • Impact analysis concerning software maintenance and dependency to user interfaces
  • Dynamic analysis

Here are some resources which could be considered "fun" (with an emphasis on the quotation marks) ways to learn about a technical subject, just to get a sense of what I'm looking for.

Joel Coehoorn
  • 399,467
  • 113
  • 570
  • 794
Shawn
  • 10,931
  • 18
  • 81
  • 126
  • If you only have a week left, you'll have to read the Dragon book straight through to cover most of these topics. That won't be fun. – Ira Baxter Apr 21 '11 at 03:59
  • If I have only a week left, I doubt I could get my hands on the dragon book quickly enough.. – Shawn Apr 22 '11 at 02:31

2 Answers2

16

If you want to learn a lot in a short time, go learn about meta compilers from Val Schorre's 1964 (yes, you read it right) Meta II paper on how to build self-compiling metacompilers. As a freebie, they can compile conventional lanuages, too! The paper is 10 pages, describes meta compilers (as a virtual machine beleive it or not), and contains two complete compilers.

There's a mind-blowing moment you eventually arrive at when you grok how the compiler can compile itself... I learned compilers this way back in the early 70s and it is the most memorable compiler lesson I ever had. This is fun.

There is an online tutorial here which implements all the ideas in JavaScript..

The author of the tutorial is Dr. James Neighbors, the guy who invented the term "domain analysis". He used the MetaII ideas for a spectacular domain-specific code generator named Draco. Draco was a key inspiration to compiler-like tools I've been building for the last 30 years.

jmlane
  • 2,109
  • 1
  • 16
  • 24
Ira Baxter
  • 93,541
  • 22
  • 172
  • 341
0

How long do you have to prepare? The "best" way to learn compilers is to dig into them and the best way to do that is to use the best book on compilers EVER WRITTEN: The Dragon Book It's old, but awesome. It's not cheap but it is, quite possibly, the most concrete and least mathematical way to learn about the magical compiler.

It doesn't have any flashing lights and it won't be in an awesome font like the Ruby guide, but it's in the top 10 Books Every Programmer Should Read

Community
  • 1
  • 1
Nate Noonen
  • 1,371
  • 9
  • 19
  • Yeah, no money and no time (I've got a week left) but thanks a lot for the recommendation! – Shawn Apr 21 '11 at 03:50
  • 3
    I didn't really like Compilers when I took it in college, but going back and seeing how much I learned, it was really worth it. It seems lame, but there were 4 classes in CS that I still reference today. Compilers is one of them. Found these on SO: http://stackoverflow.com/questions/424796/are-there-any-compiler-lectures-available-via-video – Nate Noonen Apr 21 '11 at 03:52