Live data from Hacker News

Want to write a compiler? Just read these two papers (2008)

prog21.dadgum.com

31–40 of 173 posts

Re: Want to write a compiler? Just read these two papers (2008)

#31
post #7

I wonder if it makes sense to do the nand2tetris course for an absolute beginner since it too has compiler creation in it.

I highly recommend nand2tetris to everyone. For me, nothing ever explained the whole domain from logic gates and inner workings of a CPU to compilers better than this course.

On a side note, why is imrozim's comment dead? What in the world is wrong with it? It's perfectly fine IMO.

Re: Want to write a compiler? Just read these two papers (2008)

#32

Earlier quoted context omitted.

Some of us enjoy intellectual challenges.... The Bornat book looks great. The fact that it is in BCPL is ultra cool.

Liking intellectual challenges on Hacker News is very 2008. It's 2026, the AI will write a compiler in 5 minutes, no headache required. If you're still playing with Rubik's cubes you're going to get left behind.

> you're going to get left behind.

What's wrong with that? Why do you fear getting left behind? This is just fearmongering.

Mind you these are legitimate interests of people and in most of cases probably not related to professional work.

And lol @ "It's 2026, the AI will write a compiler in 5 minutes, no headache required.", no it will not, have you seen Anthropic's post about Claude writing the "C compiler"?

Re: Want to write a compiler? Just read these two papers (2008)

#33
An Incremental Approach to Compiler Construction

Abdulaziz Ghuloum

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

Abstract

Compilers are perceived to be magical artifacts, carefully crafted by the wizards, and unfathomable by the mere mortals. Books on compilers are better described as wizard-talk: written by and for a clique of all-knowing practitioners. Real-life compilers are too complex to serve as an educational tool. And the gap between real-life compilers and the educational toy compilers is too wide. The novice compiler writer stands puzzled facing an impenetrable barrier, “better write an interpreter instead.”

The goal of this paper is to break that barrier. We show that building a compiler can be as easy as building an interpreter. The compiler we construct accepts a large subset of the Scheme programming language and produces assembly code for the Intel-x86 architecture, the dominant architecture of personal computing. The development of the compiler is broken into many small incremental steps. Every step yields a fully working compiler for a progressively expanding subset of Scheme. Every compiler step produces real assembly code that can be assembled then executed directly by the hardware. We assume that the reader is familiar with the basic computer architecture: its components and execution model. Detailed knowledge of the Intel-x86 architecture is not required.

The development of the compiler is described in detail in an extended tutorial. Supporting material for the tutorial such as an automated testing facility coupled with a comprehensive test suite are provided with the tutorial. It is our hope that current and future implementors of Scheme find in this paper the motivation for developing high-performance compilers and the means for achieving that goal.

Re: Want to write a compiler? Just read these two papers (2008)

#34
Compiler writing has progressed a lot. Notably in meta compilers [1] written in a few hundred lines of code and adaptive compilation [3] and just in time compilers. Alan Kay's research group VPRi tackled the problems of complexity (in writing compilers) [4].

[1] Ometa https://tinlizzie.org/VPRIPapers/tr2007003_ometa.pdf

[2] Other ometa papers https://tinlizzie.org/IA/index.php/Papers_from_Viewpoints_Re...

[3] Adaptive compilation https://youtu.be/CfYnzVxdwZE?t=4575

the PhD thesis https://www.researchgate.net/publication/309254446_Adaptive_...

[4] Is it really "Complex"? Or did we just make it "Complicated"? Alan Kay https://youtu.be/ubaX1Smg6pY?t=3605

Re: Want to write a compiler? Just read these two papers (2008)

#35
post #3

fanf2 on Dec 25, 2015 [dead] | parent | prev | next [–] I quite like "understanding and writing compilers" by Richard Bornat - written in the 1970s using BCPL as the implementation language, so rather old-fashioned, but it gives a friendly gentle overview of how to do it, without excessive quantities of parsing theory.

I like that book too, I bought it many decades ago and learned enough to write a transpiler for converting Fortran source code to Turbo Pascal.

Re: Want to write a compiler? Just read these two papers (2008)

#36

It's been about 4 years since I took a compilers course (from OMSCS, graduate program) and still shutter ... it was, hands down, the most difficult (yet rewarding) classes I've taken.

What did you find more painful about compilers than other forms of programming?

Re: Want to write a compiler? Just read these two papers (2008)

#37

Earlier quoted context omitted.

Liking intellectual challenges on Hacker News is very 2008. It's 2026, the AI will write a compiler in 5 minutes, no headache required. If you're still playing with Rubik's cubes you're going to get left behind.

> you're going to get left behind. What's wrong with that? Why do you fear getting left behind? This is just fearmongering. Mind you these are legitimate interests of people and in most of cases probably not related to professional work. And lol @ "It's 2026, the AI will write a compiler in 5 minutes, no headache required.", no it will not, have you seen Anthropic's post about Claude writing the "C compiler"?

I think this chap is just joking.

Re: Want to write a compiler? Just read these two papers (2008)

#39
post #22

*Donald Knute -> Donald Ervin Knuth is the author of the book "The Art of Computer Programming" (in progress for a couple of decades, currently volume 4c is being written). It is quite advanced, and it will likely not cover compilers anymore (Addison-Wesley had commissioned a compiler book from Knuth when he was a doctoral candidate, now he is retired and has stated his goal for the series has changed). I disagree wi…

> "Compilers" by Niklaus Wirth

This one? https://people.inf.ethz.ch/wirth/CompilerConstruction/Compil...

Re: Want to write a compiler? Just read these two papers (2008)

#40

An Incremental Approach to Compiler Construction Abdulaziz Ghuloum http://scheme2006.cs.uchicago.edu/11-ghuloum.pdf Abstract Compilers are perceived to be magical artifacts, carefully crafted by the wizards, and unfathomable by the mere mortals. Books on compilers are better described as wizard-talk: written by and for a clique of all-knowing practitioners. Real-life compilers are too complex to serve as an education…

Inspired by Ghuloum's book is this really nice book by Nora Sandler: Writing a C Compiler https://norasandler.com/book/
Post reply on HN