miércoles, 7 de septiembre de 2016

Internals of GCC

This week podcast by Software Engineering Radio with Morgan Deters as guest discuses how AST are used in orden to build a compiler.

He explains that to be able to have a general purpose compiler, it was decided to divide it into various layers, the front, middle and back layer.

The front layer is language dependent, but architecture independent, so at this point the compiler doesn't worry about the specific architecture of the computer compiling the code, but it does worry about the language in which the code is written, so it takes some code and generates new code that represents logically the same in both cases.

The middle layer takes that generated code and does some optimizations and generates code that the back layer understands. These are in charge of optimizing the already given code and translating into lower-level structures. It is very curious how even in such pieces of software, like compilers, workarounds might be needed. Deters described as such the fact that compilers written in C Language need to use Unions to simulate object-oriented programming, as C does not support the concept.

Later, on the back-end, the code is optimized even more by replacing certain blocks and then is finally translated to Assembly Language or the like. Then, the linker phases come into play to finish generating the final executable file.

If you are interested in listening this podcast here's the link: Internals of GCC.

No hay comentarios:

Publicar un comentario