if anyone knows any good guides for writing a compiler (specifically for a C-like language) that is actually human-readable i'd really appreciate a link :3

23 - script kitty (ΞΈβ¨Ί) & actual real life vampire
wife: @evie-src
![]() | ![]() | ![]() |
![]() | ![]() | ![]() |
π΅πΈπ΅πΈπ΅πΈπ΅πΈπ΅πΈπ΅πΈπ΅πΈπ΅πΈπ΅πΈπ΅πΈπ΅πΈπ΅πΈπ΅πΈπ΅πΈπ΅πΈπ΅πΈπ΅πΈπ΅πΈπ΅πΈπ΅πΈπ΅πΈπ΅πΈπ΅πΈπ΅πΈπ΅πΈπ΅πΈπ΅πΈπ΅πΈπ΅πΈπ΅πΈπ΅πΈπ΅πΈπ΅πΈπ΅πΈ
if anyone knows any good guides for writing a compiler (specifically for a C-like language) that is actually human-readable i'd really appreciate a link :3
I'm currently playing shapez and I'm getting toward the end. Sequencing all the piping between, gathering, cutting, stacking & coloring for these more difficult shapes is stretching my brain.
Hmm I wonder if I still have my compilers textbook. Writing a C or C-like compiler sounds like a fun projectβ¦
i personally found engineering a compiler pretty readable. before that i tried reading the dragon book, but it was waaay too theoretical for me.
crafting interpreters is even more readable at the cost of a lot of theory being ignored but that's not even for compilers so ig that's besides the point
It's been decades since I gave "real" compilers much thought, and this was old and obscure even then, but the most (and only) approachable book that I've seen (other than size) was Holub's Compiler Design in C. I don't know if it survived "the dragon book" (Compilers, Aho, Sethi, and Ullman, last I checked) becoming the graduate and undergraduate standard text, and then the weird "just pretend that you're compiling to a stack machine and figure out the translation later" trend that showed up in a lot of writing in the late '90s/early 2000s.
I have to imagine that somebody since has written a book about LLVM's architecture, which might also be useful, but I don't know of any.
we learned from an old edition of the famous "dragon book" (Compilers: Principles, Tools, and Techniques by Aho, Sethi, and Ullman) but it's also famously opaque and badly structured and uses key concepts without introducing them
we usually recommend Andrew Appel's Modern Compiler Implementation in ML - specifically that one and not the Java version of the book, because the type system stuff matters. we don't yet know anyone who's tried to write a working compiler based solely on it though, compiler design is a rare bug to be bit by, so please let us know how you like it if you give it a try.
you might also enjoy the OSDev Wiki; its focus is lower in the stack but there's stuff it will help with, especially around binary generation and so on.
cohost just eat my comment so i'm making it brief, apologies
apart from that, the most "hands on" implementing a compiler books i know of are these ones: https://www.cs.princeton.edu/~appel/modern/
jordan rose, who worked with me on swift, has a great list of resources here https://belkadan.com/blog/2016/05/So-You-Want-To-Be-A-Compiler-Wizard/