Nora Sandler
norasandler.com · Personal blog · on HN since 2017
Nora Sandler writes about building compilers, and is the author of the book Writing a C Compiler.
What HN saysHN commenters recommend her book and tutorial for going straight to generating working assembly, though one notes it does not cover everything needed for a basic compiler.
17HN people shared it
7linked it in comments
15stories submitted
939story points
7 months agolast shared
2017people per year2026
Most-shared posts
- 1Writing a C Compiler, Part 15 people · 373 points · first shared 2017 · 60 comments on HN
- 2Writing a C Compiler4 people · 1 points · first shared 2024 · discussion on HN
- 3Writing a C Compiler, Part 22 people · 241 points · first shared 2017 · 25 comments on HN
- 4Writing a C Compiler is a book2 people · 109 points · first shared 2022 · 7 comments on HN
- 5Around the World With Unicode2 people · 20 points · first shared 2017 · 5 comments on HN
- 6Writing a C Compiler Is Here2 people · 2 points · first shared 2024 · discussion on HN
- 7Writing a C Compiler, Part 51 people · 183 points · first shared 2018 · 5 comments on HN
- 8Writing a C Compiler: Book Update1 people · 3 points · first shared 2023 · discussion on HN
- 9Writing a C compiler – Series1 people · 3 points · first shared 2018 · discussion on HN
- 10Writing a C Compiler, Part 31 people · 2 points · first shared 2017 · discussion on HN
- 11What is a Neural Network?1 people · 2 points · first shared 2018 · discussion on HN
What HN people wrote when they linked it
ernst_klim · 2025-12-10
> Rather than getting stuck in front-end minutiae, the tutorial goes straight to generating working assembly code, from very early on.
I think this is important and for a more sophisticated compiler design I find Ghuloum approach very appealing [1]. I.e. build a very simple subset of the language from top to bottom and then grow the meat gradually.
The really great book following this approach I've discovered recently was [2]. Although I find both C and x86 not the best targets for your first compiler, still a very good book for writing your first compiler.
[1] http://scheme2006.cs.uchicago.edu/11-ghuloum.pdf
[2] https://norasandler.com/2024/08/20/The-Book-Is-Here.html
ceronman · 2025-09-04
Very cool. I think Wasm is a nice instruction set, but I agree that its structured control flow is a bit weird and also the lack of instructions to handle the memory stack. But it's much more cleaner than something like x86_64.
If you are interesting in learning in more detail how to write a C compiler, I highly recommend the book "Writing a C Compiler" by Nora Sandler [0]. This is a super detailed, incremental guide on how to write a C compiler. This also uses the traditional architecture of using multiple passes. It uses its own IR called Tacky and it even includes some optimization passes such as constant folding, copy propagation, dead code elimination, register allocation, etc. The book also implements much more features, including arrays, pointers, structs/unions, static variables, floating point, strings, linking to stdlib via System V ABI, and much more.
[0] https://norasandler.com/book/
asibahi · 2026-04-15
Inspired by Ghuloum's book is this really nice book by Nora Sandler: Writing a C Compiler https://norasandler.com/book/
anta40 · 2025-11-25
I heard that new volume is updated with newer stuffs like data flow analysis, garbage collection, etc. Anyway the book doesn't teach you how to build a basic working compiler, so need to consult another materials.
Try Andrew Appel's "Modern Compiler implementation in Java/C/ML" or Writing a C Compiler (https://norasandler.com/book) which is much more recent.
Eventually, you'd want to hack GCC/LLVM because they are production-grade compilers.
UncleOxidant · 2025-07-12
The author of the book also has a series of blog entries: https://norasandler.com/2017/11/29/Write-a-Compiler.html
stellalo · 2025-07-12
Oh that’s exactly what the book’s author blog mentions: https://norasandler.com/2017/11/29/Write-a-Compiler.html
norax · 2017-12-14
This is a good point, thank you for bringing it up! I added a footnote about it: https://norasandler.com/2017/12/05/Write-a-Compiler-2.html#fn2