Some time ago I decided I wanted to create a c compiler for the Hack processor in the nand2tetris book. After several dead end attempts that I might describe later I found this book : Writing a C Compiler | No Starch Press
I decided to work my way through it. I plan to do blog posts as I progress through it, probably chapter by chapter.
I have emailed the author a couple of times and have got helpful timely replies! – thank you
What makes the book so good?
Step by step
By the end of chapter 1 you have a working compiler. Each subsequent chapter adds more features. The chapter 1 compiler can only handle
int main(void){ return
But it works producing a complete executable
Chapter 2 adds unary operators so we can now do something like.
int main(void){ return ~3; }
... continue reading