This week we listened to a podcast with Morgan Deters, which talked about the internals of one of the most famous compilers, GCC (GNU Compiler Collection), which in fact contains several compilers, and other components as we are going to discuss later.
The first thing to note is that GCC is in fact a set of different tools chained smartly together by a “Driver” program that identifies the input, and provide the needed linker, and compiler flags to successfully add all libraries, code, assemblies, and specifications needed to generate a final object program output; also it contains several language-specific frontends to optimally handle C, C++, Java, and other languages.
What I think is most interesting about GCC, is that it has a three level structure that provides a robust way of handling different scenarios through a set of modules. The front-end receives the code, and through language-specific extensions prepares the code to be passes to the middleware, it “de-objectizes” the code for example, easing the creating of a “gcc--“ that can be deployed in other architectures then. The middleware creates a tree-like structure that represents the entire logic oh the program but “extracting” all language-specific implementations, translating everything to an internal common language representation. The final phase translates this common language to specific architecture instructions that can be interpreted natively, but first it detects certain flaws, or caveats that can be improved in the code, reordering the code instructions, adding or deleting loops, and sometimes even replacing known code snippets for well-known equivalent ones known to run faster or better in certain scenarios.
What I liked about this podcast is that the host, and guest have a very good English dictions that eases understating the topic, also the conversations seems well structured and can be followed without much problems, however, at the end of the program it seems like the conversation easily gets confusing as they start commenting about the source tree structure, and what files are important, something that cannot be pictured easily if we are not familiar with the actual codebase of the project, which would be helpful.
As a C.S. student, why should I care about compilers?
Nowadays almost all C.S. courses offer at least one course on compilers design as port of their curricula, although, many students most likely will never design, or implement any compilers, as this tend to be very sophisticated software pieces, and also, so many exist at this time that are quite good.
However, the benefits of studying compilers design is a lot more than meets the eye, since the knowledge learnt and application of the techniques, and tools can be used for another similar tasks that not necessarily relate directly with new languages definition/compilation, also, I think this is a very technical and specific knowledge that must be fully understood to develop more “high-end” tasks, like using a language responsibly, e.g. knowing how some expressions can be optimized or understand the underlying elements used that could lead to enormous memory/battery usage, or processing time.
This week we read an article titled “Making Compiler Design Relevant for students who will (most likely) never design a compiler” by Saumya Debray of the University of Arizona, here, the author states that while many universities teach this course, very few actually care about the impact this can have on most of their students careers.
To be honest, I think is a great thing that some teachers, and un general the academia care about the reasons I, as a student should learn something, and while the general explanation of this might help you in the future, generally is enough, extending the argument thoroughly to meet not just the “just in case” scenario, to also provide a “you can apply this techniques in this other problem” case scenario is incredible, giving a practical and pragmatic approach to all knowledge acquired.
Therefore, having in mind that a compilers course can also provide the knowledge of parsing, translation between high-level languages, and other useful techniques; this is now more relevant to my academic formation.
However, the benefits of studying compilers design is a lot more than meets the eye, since the knowledge learnt and application of the techniques, and tools can be used for another similar tasks that not necessarily relate directly with new languages definition/compilation, also, I think this is a very technical and specific knowledge that must be fully understood to develop more “high-end” tasks, like using a language responsibly, e.g. knowing how some expressions can be optimized or understand the underlying elements used that could lead to enormous memory/battery usage, or processing time.
This week we read an article titled “Making Compiler Design Relevant for students who will (most likely) never design a compiler” by Saumya Debray of the University of Arizona, here, the author states that while many universities teach this course, very few actually care about the impact this can have on most of their students careers.
To be honest, I think is a great thing that some teachers, and un general the academia care about the reasons I, as a student should learn something, and while the general explanation of this might help you in the future, generally is enough, extending the argument thoroughly to meet not just the “just in case” scenario, to also provide a “you can apply this techniques in this other problem” case scenario is incredible, giving a practical and pragmatic approach to all knowledge acquired.
Therefore, having in mind that a compilers course can also provide the knowledge of parsing, translation between high-level languages, and other useful techniques; this is now more relevant to my academic formation.
This is the end
The Tao gave birth to machine language. Machine language gave birth to the assembler.
The assembler gave birth to the compiler. Now there are ten thousand languages.
Each language has its purpose, however humble. Each language expresses the Yin and Yang of software. Each language has its place within the Tao.
My name is Andres Duran, I'm 22 years old from Mexico and currently studying B.S. Computer Systems Engineering.
I expect to learn how to create new language definitions over CLR (.Net's Common Language Runtime).
I'm really into programming for fun, IA, reading, and watching tv shows, movies and talks (TED).
Recently I have been watching Doctor Who, Suits, Revenge, and Undateable. I'm currently reading Aldous Huxley's "The island", and cloud-related books.
Suscribirse a:
Entradas (Atom)