sábado, 7 de septiembre de 2019

Internals of GCC

Podcast overview: Internals of GCC

  an interview with Morgan Deters

 

In this post we will take a look of what I have understood in this podcast recorded in the Software Engineering radio website. 
A couple of semesters ago I had my Advanced Programming course which focuses on some of the low level appliances that are provided by the language C. In the first few lectures, I was taught that libraries needed to be linked manually in console. Also I learnt that I could write a couple of instructions to the compiler so that it comes up with a couple of optimizations at run time.
I'm still unsure about the functionality of all of the layers that my C program has to go through in order to be transformed into machine code. In this podcast I have got a nice insight of how a tool such as GCC manages to do such optimizations.

From what I understood, first of all it seems that GCC transforms code into a standardized tree of instructions that is architecture independent. So every language supported by GCC converges into a same set of instructions, depending of the architecture that is being used. A "front end" compiler needs to be built for each of the languages, since high level expressions are treated differently. Additionally, this language-specific front-end needs to be attached with the so called "middle-end" to the architecture specific developments at the back-end. Through the podcast, there is a question about the optimization support for multi-core architectures in the GCC collection. My friend and classmate Rodrigo Garcia made some speculation about the lack of support from GCC to for this kind of architectures in his very own post. Personally I believe that there will be support at some point, however the amount of variables to be considered to build a safe compiler scales up the difficulty of building such optimizations as resource sharing, as far as I know, is one of the fundamentals of multi-core processing. It is also quite risky and difficult to implement.
 One thing I have found to be interesting is the assignation of registers at the assembly level. It seems that this needs to be done by GCC since a processor actually assigns few of them for the execution of a program. I believe that this process might play a role in making multi-processor optimization as limited as it is.




viernes, 23 de agosto de 2019

Making Compiler Design Relevant for Students

In this entry I will briefly share my thoughts about the lecture "Making Compiler Design Relevant for Students who will (Most Likely) Never Design a Compiler" by Saumya Debray. 

At the very beginning of my undergraduate degree, I took my introductory programming course with Ariel, the same lecturer of this course itself. At some point he mentioned that he was also the teacher of the Compiler Design course. At that time I had a very vague idea of what a compiler was, and I thought that creating a compiler was all about writing in assembly language, making some black magic and suddenly you would have a compiler for your very own programming language. At this moment, after several years of gaining knowledge and experience on the computational sciences, I don't longer think it is all black magic, however I believe that I will never build a compiler for other than recreational purposes. And this why this reading suits me.

The main argument of the author is that there are several translation problems that a student can solve by using some knowledge and techniques they have learnt in a compiler design course. His main example is a task that consists in translating LaTeX components into HTML, which it seems to be something very useful by itself. One other argument is the mastery of lex and yacc, a set of tools that as far as I know are the ones to be used during this course. I believe it will always be good to get to know a new tool. In my very small experience as a software developer at the industry label, managers a lot of time gives you tasks without having in mind what is your experience or expertise. For example I had to learn very quickly the principles of cross framing and scripting security in a NodeJS application, and I swear if I had minimal experience in anything that had to do with the bare theory of those principles, such task would have taken perhaps a couple of hours instead of a couple weeks as it was the case. Maybe someday, even if I don't become a compiler designer myself, I will find some of the knowledge and theory behind it to be handy, and I think that's enough of a reason to give it a shot and get some value out of the course. After all, I believe that I won't we working with eighty percent of the topics that have been given to me during my undergraduate degree.

martes, 13 de agosto de 2019

Personal Introduction

First entry: A personal introduction

Hello reader, this is my first entry for my Compiler Design's course blog. My name is Valentín Ochoa, I am currently 23 years old and I am an aspiring computer scientist.
I have programmed since my late days of high school and I have always found it to be something that is quite thrilling. I had the luck to be a CS student at the University of Toronto for a year.

Some of my hobbies include playing the piano, scuba diving, rapid chess and video games.
I picked off the piano since I was a little kid, my parents kind of pressured me into it, but I really love that they did so. I nearly turned into the National Conservatory to pursue a career as a pianist when I was 16, but I thought that piano would be in a better place as my hobby. 
I picked off scuba diving because my father is a big ocean lover and we frequently do fishing trips together, I brought up scuba diving and he decided to pick up a course for us so we get a license. Even though we don't do it as frequently, as a diver you get to see some views that are out of this world.

I frequently watch horror movies with my best friend. At the beginning we did it to have a laugh as she solely screamed for the cheapest jump-scare in the movie theater. However, we have found a couple of films that are worth watching for more than making fun of my friend. 

As for the course, I'd like to learn how to build a compiler so I can make some silly or creative programming language for entertainment. Lately I have had some interest in a couple esoteric languages such as Piet, ArnoldC or Emojicode. Maybe after taking the course I can try to build something alike.

Common Language Runtime

This article compares the runtime environment of two languages that seem to be similar Java and C#. As far as I know, both are designed to b...