D is a fairly complex language. I'd start with a simpler one, like a Pascal or Javascript compiler.
For the latter, you can look at:
https://github.com/DigitalMars/DMDScript/tree/master/engine/...
For the latter, you can look at:
https://github.com/DigitalMars/DMDScript/tree/master/engine/...
C is a harder one because the multiple "phases of translation" add quite a bit of complexity. It's easy to get lost in the frustrating and pointless complexity of the preprocesser. C++ layers onto that mixing semantic analysis up with parsing, and an unusually complex semantic analysis. Not for beginners.
I suggest reading the source code to a professional compiler because there are books about how compilers work, and then there's how compilers really work. Pro compilers tend to be built differently from academic or side project compilers.