Hacker News new | past | comments | ask | show | jobs | submit login
Writing a Compiler in 24 Small Steps [pdf] (uchicago.edu)
50 points by falsestprophet on Sept 1, 2010 | hide | past | favorite | 16 comments



Here's a link to the actual pdf:

http://scheme2006.cs.uchicago.edu/11-ghuloum.pdf


"Compilers are perceived to be magical artifacts, carefully crafted by the wizards, and unfathomable by the mere mortals."

Then everyone with a cs-degree must be immortal.


i think you're over-estimating the abilities of the average cs grad if you believe they all understand compilers.


Unfortunately, Compilers is no longer a required class to get a CS degree. My (possibly flawed) understanding is that in the heyday, it was.

It's really a shame, because learning about compilers applies all that stuff you're supposed to learn about languages and automata theory, gives you an excellent example of how to design a large software system, gives you insights into programming language design, and above all demystifies the process of what happens when you compile your own code.


My university requires a class called "Languages and Machines." According to the instructor, it used to be two classes, "Languages" and "Computation."

We started doing some language fundamentals and comparative analysis of different languages (how basic data types are implemented, structs, closures, etc.). Then we talked about various function calling conventions, beginning with a simple stack machine language and slowly building on that to support recursive calls, etc. By the end, every passing student had written non-trivial programs in at least 3 different languages, and written very simple yet enlightening implementations of the basic components of compilers (lexer/parser, AST, code generation, basic optimization, etc.).

I would've preferred a full-blown compilers course, but that class was still my favorite CS class.


Unfortunately, Compilers is no longer a required class to get a CS degree.

As with all degrees, that depends entirely on the school.


I meant in the average case.


What about in the worst case?


In the worst case, you can go to a school that doesn't offer compilers. My school offers but doesn't require it.

It would be interesting to discover the earliest CS program at a reputable university without a compilers requirement.


Do you have data?


I think they should? After all it is not that much that justifies the "s" in "cs"..


Compilers was one of the few classes where I thought the S actually met the C in CS. I applied real algorithms I'd learned in Algorithm and data structures I had learned in Data Structures to support the theory of computation I had learned in The Theory of Computation.


really? every cs graduate has a deep understanding of compiler internals? doubtful.


No one said "deep." Even if all CS grads did get "deep understanding" of compiler internals, chances are that would not cover the new paradigm of dynamic languages. My point is that only the most diligent CS grad is going to be able to create or even contribute to a full-blown, widely used modern programming language.


the paper's been discussed at least once before on hn: http://news.ycombinator.com/item?id=1408241


That paper is pretty interesting, but is just an overview of the actual tutorial on writing the compiler, which is here:

http://www.cs.indiana.edu/~aghuloum/compilers-tutorial-2006-...

Unfortunately, the tutorial seems to be in a draft state, with a good amount content still needing to be written ("FIXME"s throughout).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: