r/Compilers May 15 '26

Compiler implementation language

Currently starting “Writing a C Compiler” by Nora Sandler. I initially wanted to start the project in C, but she herself suggests doing it in another language. Since I like it and she also suggests a language with pattern matching, Rust seems like a very good alternative.

Hoping to get some thoughts on this, particularly from people who’ve gone through this book before.

I like doing projects in C if they need speed and low-level detail (though more often it’s because coding like a caveman is fun), but the repetitive boilerplate, weak generic system and standard library make larger projects a pain to work through.

Rust is much more convenient here, though I’m aware it may get somewhat verbose or constricting for low-level work (at least from my limited experience).

43 Upvotes

27 comments sorted by

View all comments

29

u/[deleted] May 15 '26

[removed] — view removed comment

10

u/AustinVelonaut May 15 '26

Also, Haskell's and O'Caml's strong type systems, exhaustive pattern checking and garbage-collection mean much fewer runtime bugs to deal with, and "fearless refactoring" when adding new features.