Internals of GCC

During our studies, we have been able to use languages like C and C++, and, in order to compile our programs we used the command ‘gcc’; but do we really know what this command does? Well, at the beginning, when we started coding and learning these languages we did not pay any attention to it, but now, since we are taking the Compiler Design course, it is a must to know what this command is for.

According to Morgan Deters, GCC is a GNU Compiler Collection that is used to compile source files of languages like C,C++, Fortran, ADA, Java, Objetive-C, among others. What makes this compiler special is that it is portable, this means that it runs in almost all platforms that are available nowadays and can produce outputs for different types of processors.


GCC is divided in 3 important parts: Front-End, Middle-End and Back-End. Front-End, the one that is per language, uses a parser that builds an abstract syntax tree and it can be processed without caring about the processor, since it only depends on language and not on the architecture. The Middle-End, is the intermediate step that builds an abstract tree that does not depends on the language. And, finally, we have the Back-End, this part does not depends on the language, but it does depend on the architecture. Confusing, right?


As long as the Compiler Design course goes by, I have been able to understand more about compilers. First of all, I did not know that a compiler collection like GCC was composed of 3 parts and that these parts could be dependent or independent from language and architecture. Also, with this information, even though compilers have been automatized and optimized, now I understand why some programming languages have higher or lower performance rates. It is true that compilers are some kind of magic elements while coding.

Comentarios