Internals of gcc

For this week’s blog, we listened to the podcast about more or less how the gcc compiler works. I find interesting the fact that the compilers has 3 levels, these levels are crucial to the correct functioning of the compiler, because this compiler has to work on different platforms, operating systems and computer architecture. This approach makes the compiler modular, so the front end of the compiler only has to worry about the analysis of the source file and parses it into a tree called the abstract syntax tree.

I’ve always wondered how a compiler get all the information from the code and execute everything in the right manner, specially recursion, that is something that blows my mind when I use it (specifically because it generally takes me more time to debug a recursion in comparison with an iterative approach).

On the podcast they talked about the abstract syntax tree, which is a tree based on the hierarchy of each operation that was once source code. It is very fascinating how everything comes together, specially thinking that me and my mates are going to do that at some point on the semester.

Also there is the “back end” of the compiler, which y have little to zero knowledge about, because that end of the compiles ensures that the front and mid end work on specific hardware and processor architecture, which is beyond my understanding despite one class we took on second semester. I usually don’t enjoy the super low level stuff.

Finally I think that knowing how a compiler works is interesting as we usually tend to use a couple of programming languages but barely know how they work. Probably we never use this information, but I think it is easier to use something that I know how it works.

Comments

Popular posts from this blog

Making compiler design relevant for students

Mother of Compilers

Ruby and the Interpreter Pattern