GCC

In this entry, I'll take a dive into the internals of GCC, by way of a podcast from Software Engineering radio.

In this podcast, Morgan Deters begins by explaining his work experience, his work with compilers and Java, as well as the JVM, and he explains how compilers work and why they are relevant. At the beginning, he begins by discussing how compilers are required to work well with the hardware it's meant to run on. Deters then gives us a rundown of how a compiler's internals work, and the steps it takes to convert a programming language into something a machine can understand. It is what I expected, from reading the source, understanding the text, analyzing the variables and the semantic. I think that, no matter the tools you use, the bases for designing a compiler are always the same.

Later on, Deters explains the GCC (GNU Compiler Collection). Essentially it is a software that is used to compile multiple different languages. It is considered quite flexible, portable, reliable and it is used to compile languages such as C++ and ADA.

The functionality of GCC is something that I find quite compelling. It must certainly follow really good practices and standards, as shown by the adaptability it has to compile multiple languages. I'm sure that adapting a language to work with GCC shouldn't be all that diffult, or at least not as difficult as coding one from scratch.

So an interesting approach that I didn't really think of but makes total sense is the use of trees to parse a language. It's a pretty clever representation, to have simple operations like an addition consist of a branch with two children branches, being the numbers you'll add together.

Overall, it's a pretty fascinating description of a tool that, even if we don't get to use it, will certainly be a standard to strive towards in the development of our compiler.


Podcast link:
http://www.se-radio.net/2007/07/episode-61-internals-of-gcc/

Comments