News for hackers. Stuff that matters.
Re:How Difficult is it to Write a Compiler? by silentbicycle on Monday December 15, 2008 @05:07PM (#398906)
Graydon Hoare's "One-Day Compilers" (http://www.venge.net/graydon/talks/mkc/html/mgp00001.html) presentation is worth a look. It uses OCaml to build a compiler for basic makefiles (using C as an intermediate language).

Kragen Sitaker has a great collection of links for amateur compiler writers on his Ur-Scheme (http://www.canonical.org/~kragen/sw/urscheme/) page.

This paper (http://scheme2006.cs.uchicago.edu/11-ghuloum.pdf) by Abdulaziz Ghuloum is also very interesting - he shows step-by-step how to write a simple native-code Scheme-like compiler by writing small C functions, compiling them with gcc, and then saving the assembly output. ("Since we don’t know yet how to do that, we ask for some help from another compiler that does know: gcc.") Heavy theory about optimizing? Nope. Demystifying and inspiring? Heck yeah.

Re:How Difficult is it to Write a Compiler? by gjm11 on Tuesday December 16, 2008 @08:07AM (#399440)
Um, that's not what the paper does at all. There's exactly one invocation of gcc in the whole paper, and its only point is to enable the (human) developer to see what the calling convention for a function should look like. A couple of sentences after the one you quote we get: "Let's compile it using gcc [...] Generating this file from Scheme is straightforward." and then comes the very first compiler in the incrementally-improving series, which accepts a small integer and outputs assembler code for a function that returns that integer as its value.
Re:How Difficult is it to Write a Compiler? by silentbicycle on Tuesday December 16, 2008 @08:25AM (#399455)
Right. He uses grabbing assembly output from gcc to demystify the process. (I guess I worded that poorly.)
Re:How Difficult is it to Write a Compiler? by kragen on Tuesday December 16, 2008 @01:03PM (#399748)
Thanks! I'm glad my page was helpful. I'm working on a much simpler compiler than Ur-Scheme now. I call it StoneKnifeForth.
Re:How Difficult is it to Write a Compiler? by silentbicycle on Thursday December 18, 2008 @04:51PM (#402685)
Dude! Keep me posted. :)
Re:How Difficult is it to Write a Compiler? by kragen on Friday December 19, 2008 @09:47AM (#403360)
You can git clone it from http://canonical.org/~kragen/sw/tinybootstrap.git if you like.