The introduction covers a lot of important stuff about implementing the compiler.
Platforms
The book is setup to work on Linux and Mac. I am a primarily Windows dev (ex MSFT employee), I do a fair amount of contributions to rust projects and so do stuff on all three platforms, but Windows is where I do the heavy lifting (except when I am on the road, when I use my awesome first gen M1 mac book air, only 8gb but it never breaks a sweat, plus all day battery life, a true engineering marvel)
The book suggests using WSL if you are on Windows. I use WSL a lot but prefer to run natively on Windows.
I thought “how hard can it be to make it work on windows?”. I will go into details in chapter 1.
The back end of the compiler targets the x64 instruction set. This is fine. I note that my end intent is to at least try to target the hack cpu in nand2tetris.
Implementation language
I love rust and it seems like a good match, Nora mentions it as a possible language because it has pattern matching. I concur.
IDE
I use Visual Studio Code. I also use (I paid for it although I think a limited version is now free) github copilot. I have found that this tool is particulary good for writing things like emulators and compilers where there is repeated code like this
'(' => Token::LeftParen,
')' => Token::RightParen,
'{' => Token::LeftBrace,
'}' => Token::RightBrace,
';' => Token::SemiColon,
Once it has seen what you are doing it correctly works out what you are doing and is very good at extending it.
I also use Visual Studio. It has an excellent assembler level debugger. It needs to be installed in order to get rust working, plus this book needs a c preprocessor, assembler and linker (some tests need a c compiler too). Visual Studio Community Edition is free for hobbyist use.
Now on to chapter 1
Leave a comment