Live data from Hacker News

How to Write Your Own Compiler (2009)

staff.polito.it

41–43 of 43 posts

Re: How to Write Your Own Compiler (2009)

#41
post #37
post #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.

This looks cool, thanks for pointing it out. I'm somewhat familiar witih SSA, but I don't know anything about polyhedral compilation. What does it buy you? Is there a concise intro you could point to? (I thought I had heard someone say it makes your compiler slower for marginal benefit, but they/I could be wrong about that.) FWIW I found this introduction to the new Go SSA back end pretty useful as an overview: https…

In fact, LLVM does use polyhedral compilation :) it's just disabled by default. There's a module called Polly in LLVM which performs polyhedral optimisations!

Yep, tableGen is nice but would be overkill for this tutorial project.

Re: How to Write Your Own Compiler (2009)

#42
post #37
post #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.

This looks cool, thanks for pointing it out. I'm somewhat familiar witih SSA, but I don't know anything about polyhedral compilation. What does it buy you? Is there a concise intro you could point to? (I thought I had heard someone say it makes your compiler slower for marginal benefit, but they/I could be wrong about that.) FWIW I found this introduction to the new Go SSA back end pretty useful as an overview: https…

See:

https://en.m.wikipedia.org/wiki/Polytope_model https://www.cs.indiana.edu/~achauhan/Teaching/B629/2010-Fall... http://web.cs.ucla.edu/~pouchet/lectures/doc/888.11.5.pdf

Re: How to Write Your Own Compiler (2009)

#43
post #28

Earlier quoted context omitted.

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 macr…

A reminder to others, and a note-to-self that readable-lisp exists:

http://wiki.c2.com/?SweetExpressions

The wiki page makes a valid point; seemingly heavy lisp users will argue against non-s-expression syntax, but happily use prefix notation for quote, and infix for pairs...

Post reply on HN