Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

For modern compiler and a more direct approach I recommend https://www.cs.cornell.edu/~asampson/blog/llvm.html


LLVM makes it so much easier to build a compiler - it's not even funny. Whenever I use it, I feel like I'm just arranging some rocks on a top of a pyramid.


A trend started with tools like the Amsterdam Compiler Toolkit, LLVM happens to be the more famous one.

https://en.wikipedia.org/wiki/Amsterdam_Compiler_Kit


Yet if only it wasnt that huge, so compilation takes this much time :/


Using LLVM is an indirect approach that will limit the quality of your compiler.

When one looks at languages that use LLVM as a backend, there is one consistent property: slow compilation. Because of how widespread LLVM is, we often seem to accept this as a fact of life and that we are forced to make a choice between fast runtime code and a fast compiler. This is a false choice.

Look at two somewhat recent languages that use LLVM as a backend: zig and rust. The former has acknowledged that LLVM is an albatross and are in the process of writing their own backends to escape its limitations. The latter is burdened with ridiculous compilation times that will never get meaningfully better so long as they avoid writing their own backend.

Personally, I find LLVM a quite disempowering technology. It creates the impression that its complexity is necessary for quality and performance and makes people dependent on it instead of developing their own skills. This is not entirely dissimilar to another hot technology with almost the same initials.


Adrian Sampson (the author of that now 10-year old blog post) has a online course for actually teaching compilers:

<https://web.archive.org/web/20210208162458/https://www.cs.co...>

Discussed several times on HN: <https://hn.algolia.com/?query=cs6120%20advanced%20compilers>

(And discussion about the blog post from last year about the IL used in the course: <https://news.ycombinator.com/item?id=41084318>.)




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

Search: