If you'd like a gentle introduction to something like gcc itself before diving in to writing your own, then you may want to read through:
https://siddhesh.in/posts/gcc-under-the-hood.html
which gives some introduction into how a modern compiler like gcc is designed/structured. For context, the author, siddhesh is a current glibc maintainer.