I've recently been very interested in compilers and how they work. Since gcc has it's source available, I figured it would be the best material to study.
The first thing I realized is that it would be pointless to study gcc if I didn't have a basic understand of simple compiler design principles. I have since been diligently reading the "Dragon Book" which, from what I have seen, is the de facto book on compiler implementation.
None-the-less, reading that book has only furthered my desire to learn about compilers such as gcc.
Additionally, I find it pertinent to say that I do have a intermediate understanding of c/c++ (aka, I'm not trying to study gcc without knowing c). I am hoping that studying gcc will help me improve upon that as well.
I have downloaded the latest build I could find; however, I get lost when perusing the source code.
What I'm looking for are suggestions on how to proceed. Is there a similar project, which is not so massive, I could use as a stepping stone to gcc? Is there a particular module of gcc which one would recommend studying first? Are there any books which go into gcc's implementation, rather than it's use? Perhaps I should stop whining and just keep reading the source until it clicks?
Any and all feedback will be greatly appreciated.
EDIT: If you think I should study a different compiler/interpreter, I would greatly appreciate suggestions as to which ones.
If you want to look at a very tiny compiler, I would recommend Fabrice Bellard's Tiny C Compiler.
Also worth mentioning, Fabrice Bellard won the obfuscated c code contest with his Obfuscated Tiny C Compiler. There's a deobfuscated version as well, and it fits in a single c file.
These should be great if you want something small and manageable to learn from.
I think it's good to read the book "ruby under a microscope" and practise with ruby core development, before reading gcc's code. But you should need knowledge on ruby programming. It's about ruby internels.
As I know the best book on gcc is "the definitive guide to gcc" https://www.amazon.com/Definitive-Guide-GCC-Guides-Paperback/dp/1590595858. Although it is little bit old, I think you should read this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With