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

What would be your advice to someone who's about to write a compiler? I'm planning to start by reading the Dragon book.


I never got on with the Dragon Book despite several attempts.


You both should try "Compiler Construction: Principles and Practice" [0]. Theory is interleaved with substantial examples and exercises. You create an entire compiler for a tiny language called TINY (hah.) You write it in C and generate code for a portable virtual machine -- the book also goes into detail on the VM, with source code.

Lastly, the book's appendix has guidance for writing a compiler for a subset of the C language.

[0] https://www.cs.sjsu.edu/~louden/cmptext/


I didn't really read any books on that topic. But did lots of general research about compiler stages. I also posted a few links some comments up, that helped a lot.

For for it! Start small and increase. But seeing a program in your own language output something makes it all worth it :)


http://t3x.org/t3x/index.html#t3x9

If you plan to buy the book, you will have to go to Lulu.com and search for it, as order links seem to be down after a site redesign.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

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

Search: