News for hackers. Stuff that matters.
Re:If I ever design a first course in compilers, I'll do it ... by rayiner on Thursday August 07, 2014 @10:06AM (#8147758)
Morgan's "Building an Optimizing Compiler" recommends doing a "spike" method: http://www.amazon.com/Building-Optimizing-Compiler-Bob-Morga.... The idea is that you should write enough of each stage, from the front-end to the back-end, to get one feature working. Then do the same for the next feature, and so on. That way, you have very early insight into how the stages fit together.

Ghuloum's scheme compiler tutorial essentially follows this method: http://scheme2006.cs.uchicago.edu/11-ghuloum.pdf. It starts with emitting x86 machine code for constants, then unary and binary primitives, local variables, conditionals, heap allocation, procedure calls, and finally closures. It helps that Scheme has little to no parser to speak of, but it is straightforward to extend the technique to a language that does.

Re:If I ever design a first course in compilers, I'll do it ... by mattgreenrocks on Thursday August 07, 2014 @10:40AM (#8147922)
I'm convinced this is the only sane method when you are self-teaching. If you try to write an entire LALR grammar at once and then you screw up, you're in a world of hurt trying to figure out what went wrong.