Live data from Hacker News

How to Write Your Own Compiler (2009)

staff.polito.it

21–30 of 43 posts

Re: How to Write Your Own Compiler (2009)

#21
post #3

One of the best resources I've seen on this is Capon and Jinks 'Compiler Engineering Using Pascal' (1988; ISBN 0-333-47155-5) if you can get hold of it http://www.cs.man.ac.uk/~pjj/book.html

Does no one refer to the dragon book anymore?

https://en.wikipedia.org/wiki/Compilers:_Principles,_Techniq...

Re: How to Write Your Own Compiler (2009)

#22
post #21
post #3

One of the best resources I've seen on this is Capon and Jinks 'Compiler Engineering Using Pascal' (1988; ISBN 0-333-47155-5) if you can get hold of it http://www.cs.man.ac.uk/~pjj/book.html

Does no one refer to the dragon book anymore? https://en.wikipedia.org/wiki/Compilers:_Principles,_Techniq...

The dragon book is very informative but is harder to parse (ha) than many other compiler books. People should definitely read it, it just might be hard to read as a "My First Compiler" book.

Re: How to Write Your Own Compiler (2009)

#23
post #9

If you're wondering why that page looks the way it does, well: > " rel="nofollow">http://www.w3.org/TR/REC-html40">

It's short, informative, and up to the point.

To give some context, I have studied with that professor and I can say that the guy is not super up to date with presentation technology: at the time (its was 2004) he was still using hand-written transparencies projected with an overhead projector. The readability was close to zero.

Re: How to Write Your Own Compiler (2009)

#24
post #21

Earlier quoted context omitted.

Does no one refer to the dragon book anymore? https://en.wikipedia.org/wiki/Compilers:_Principles,_Techniq...

The dragon book is very informative but is harder to parse (ha) than many other compiler books. People should definitely read it, it just might be hard to read as a "My First Compiler" book.

I started reading it a while ago when I wanted to properly learn compilers. I actually thought it was very readable.

Re: How to Write Your Own Compiler (2009)

#25
post #21
post #3

One of the best resources I've seen on this is Capon and Jinks 'Compiler Engineering Using Pascal' (1988; ISBN 0-333-47155-5) if you can get hold of it http://www.cs.man.ac.uk/~pjj/book.html

Does no one refer to the dragon book anymore? https://en.wikipedia.org/wiki/Compilers:_Principles,_Techniq...

While there are some good bits in the dragon book, some of its advice on the engineering of a compiler is pretty dated. For example, most of the parsing chapter(s) seem to have the notion that there is a single (global?) symbol table to which tokens and various other things refer, and which is gradually refined and updated throughout compilation. I think that may have been a widespread design once, but it's a bizarre anachronism now. Nowadays, information is often embedded directly into the AST, and compiler passes often create and destroy multiple ad-hoc symbol tables as necessary.

I would primarily trust the dragon book for its theoretical content, although even that likely no longer represents the state of the art. I'm not all that knowledgeable about the state of the art in parsers, but I know that compiler optimisations have certainly moved beyond what is in the dragon book.

In short, while the dragon book still contains useful information, I don't think its notion of how a compiler is constructed is close to how compilers are actually constructed today.

Re: How to Write Your Own Compiler (2009)

#26
Shameless plug: I've been writing a series that's WIP about writing a tiny optimising compiler - https://github.com/bollu/tiny-optimising-compiler. It tries to model as much as possible, and the aim is to show off the power that modern compiler ideas bring: SSA and polyhedral compilation.

Re: How to Write Your Own Compiler (2009)

#27
post #3

One of the best resources I've seen on this is Capon and Jinks 'Compiler Engineering Using Pascal' (1988; ISBN 0-333-47155-5) if you can get hold of it http://www.cs.man.ac.uk/~pjj/book.html

There's also "Let's Build A Compiler" by Jack Crenshaw:

https://compilers.iecc.com/crenshaw/

This page links to that and another, "A Nanopass Framework for Compiler Education" by Sarkar, Waddell, and Dybvig:

http://prog21.dadgum.com/30.html

http://www.cs.indiana.edu/~dyb/pubs/nano-jfp.pdf

Re: How to Write Your Own Compiler (2009)

#28
post #13

Earlier quoted context omitted.

Forth is one of those things that always fascinates me but ultimately always ends up feeling too hard to read. Snabel looks like an interesting experiment in that regard..

Lisp and Forth, everyone gets that reaction on first contact; the real problem is that most popular languages look the same these days. Popularity has very little to do with earning it. And it's getting worse with more and more crapscript lately. I'm not very much into dogmatics and orthodoxy, Forth wasn't the final answer to anything. Nothing ever is. Implementing the same thing over and over again doesn't make sens…

I like both lisp and forth, but also think more syntax is useful for humans - both lisp and forth essentially demand that you program in ASTs directly, rather than some higher level abstraction/more pleasant.... Typography? Advanced semantic grammar?

I'm not sure the ease of macro implementation is worth it. I'd love to see more efforts like Dylan. Or different kind of simplicity, like Smalltalk.

Re: How to Write Your Own Compiler (2009)

#29
post #28

Earlier quoted context omitted.

Lisp and Forth, everyone gets that reaction on first contact; the real problem is that most popular languages look the same these days. Popularity has very little to do with earning it. And it's getting worse with more and more crapscript lately. I'm not very much into dogmatics and orthodoxy, Forth wasn't the final answer to anything. Nothing ever is. Implementing the same thing over and over again doesn't make sens…

I like both lisp and forth, but also think more syntax is useful for humans - both lisp and forth essentially demand that you program in ASTs directly, rather than some higher level abstraction/more pleasant.... Typography? Advanced semantic grammar? I'm not sure the ease of macro implementation is worth it. I'd love to see more efforts like Dylan. Or different kind of simplicity, like Smalltalk.

You're not alone in still mourning Dylan...

But the more code I write, the more I appreciate languages that stay out of my way until I ask for help; besides Lisp & Forth that basically means C/C++. Elaborate syntax, no matter how convenient; will always become an obstacle at some point. You might think it's funny to see C++ in that list, but these days its possible to use it as a static Common Lisp with crippled macros; Snabels implementation is a testament to that.

I was deeply in love with the idea of Smalltalk for a long time, but big pieces of code turn spongy on me as soon as I pass a certain level of complexity. I need more types than that, which is why Snabel had parameterized types from day one.

Re: How to Write Your Own Compiler (2009)

#30
post #25
post #21

Earlier quoted context omitted.

Does no one refer to the dragon book anymore? https://en.wikipedia.org/wiki/Compilers:_Principles,_Techniq...

While there are some good bits in the dragon book, some of its advice on the engineering of a compiler is pretty dated. For example, most of the parsing chapter(s) seem to have the notion that there is a single (global?) symbol table to which tokens and various other things refer, and which is gradually refined and updated throughout compilation. I think that may have been a widespread design once, but it's a bizarre…

Thank you for the detailed reply. It's been years since my compilers class. I gather no one still uses lex and yacc either? To give you an idea how out of date I am in this area, when I took my compilers class we used http://www.cs.princeton.edu/~appel/modern/java/CUP/manual.ht... for much of the course work. And I've had surprisngly little need during my career for this subject area.
Post reply on HN