The internals of GCC

After listening to the Software engineering podcast about the internals of GCC, I found myself in great pleasure of knowing that what I was learning in my compilers course, was good and effective. One of my gripes with the interview is that it wasn't that clear with the host being a little bit pushy about certain aspects. I feel that if you are the lead engineer in a part of GCC you should get some de-facto respect just for being you.

The description for the episode is as follows:

This show takes a behind-the-scenes look at compilers and their inner workings, using the Gnu compiler collection (GCC) as an example. Arno interview Morgan Deters, covering all steps from the parsing of different programming languages to machine independent optimizations and generating processor specific binary code.

I loved how Morgan Deters expressed himself, it was quite clear, and really expressfull.

One of my biggest revelations was that thre was a relationship with what GCC engineers were doing, to my Compiler’s course. Sometimes when I’m in school, it feels like you are just a part of a “little delve” into architecture and creation of a programming language, but what I found is that actually, we are way way way more ingrained into designing a compiler than I thought.

For example:

We saw the construction of an AST, and GCC uses AST to build and construct the compilation of ADA, C, C++ etc. 

This always leaves me wondering how many of us will actually build a compiler eventually. I’d be super interesting to see what we can build with this tools.

What about you dear reader? If you had the chance and the tools to build a compiler, what would you create? Would you create a beautiful language? Static or dynamicly typed? What are the goals you want to achieve?


“Internals of GCC” (53 minutes long). Software Engineering Radio with Morgan Deters. Consulted February 4th 2018

The evolution and death of programming languages.

On one of my archive readings, I stumbled upon Paul's Graham articles, "The hundred year language". We all know paul graham is a massive fan of functional programming, so as I started reading his post, I initially forecasted: "this is going to be another tirade about functional" But I was pleasantly surprised, I like how he exposes the two branches that eventually programs are going to be developed for. Especially, because in 2018, it has become partially true.

This year, we have seen the born of Rust, a language, similar to C++ that promises speed and memory safety. This allows people who want to fiddle with concurrency and low latency, to program effortlessly compared to the memory antics you have to do in C++. Furthermore, there is also another subset of the language (as mentioned by paul graham) which is entirely to make the programmer more comfortable with the code itself. THEN he does refer to Lisp, his old friend.

What is more insightful about the article is that he is accurately predicting the two main branches of computers, nevertheless I would add another property that is making languages evolve. The ability of a language to stop the user from making mistakes. Specially, in the language which I have observed this property, is in C#. In order to screw up references, you have to use the unsafe keyword. Just looking at unsafe, makes you uneasy, so you really have to know what you are doing to do the corresponding task. I'll pose an example. Imagine you have an organization of a 100 developers. You could either choose for them to code in C++, or for them to code in C#. Now, they are going to be making mistakes. Let's say that 5 out of a 100 times, you introduce a memory leak in C++. Now, lets say that only in 1 of a 100 you introduce a memory leak in C#. The amount of debugging you've saved your developers is incredible.


[1] Graham, Paul. “The Hundred-Year Language”. Retrieved from: http://www.paulgraham.com/hundred.html April 2003
Retrival Date: Feb 1st, 2018


Why the **** am I designing a compiler?

I went to a job interview last week, I was asked why would I design my own compiler. On anwsering this question, I was a bit perplexed myself. Why would I do that? When I answered, I replied that the main idea is to learn compiler specific skills. There are some skills that are applied to specific problem. When trying to explain what those skills were, I was on a loss of words.

So after pondering a bit, I decided that it was neat to read something that would explain why building a compiler would be useful for me. After some time, this text provided by our teacher seems to nail it in the head. Let's dive into it.

The first skill I've ALREADY learned is the way of the Regex Master. Using Regex for separating different kinds of tokens is really Important to use. You can build small transpilers for languages using the find and replace section in different text editors. Nevertheless, It is one skill I’m eager to learn and exploit in the way of compiler design. In the article we get the examples of making a LaTex transpiler to HTML, which also adds the novelty of validating the syntax of a particular language to transpile.

Going one step further, natural language processing could be another way of using compilers tools to generate computer instructions, so it is interesting to notice that even trivial stuff like natural language processing can be learned from learning how to do compilers.

Last, but not least, we can see some different uses in having code generation as part of our toolchain, Imagine a situation where we have to generate a meta-compiler which allows you to generate code from code. A good way to do it is to generate an AST, and then trasverse it backwards, but you can only know that when learning compilers. I encourage you all to try it out sometime now.

 

[1]  Debray, Samuya. Making Compiler Design Relevant for Students who will (Most Likely) Never Design a Compiler“. Retrieved from http://webcem01.cem.itesm.mx:8005/s201811/tc3048/making_compiler_design_relevant_for_students.pdf

 

About me again

This is my introduction for yet another course.

Ideally I'll be publishing things from this blog to my main blog, the best pieces in here will make a part of my main blog.

- My expectations:

One of my expectations for this course is to be able to roll out my own programming language. and have it coded in github. Let's see how that goes.

· Your hobbies and personal interests.

I love playing video games, specifically Rocket League, but I also exercise almost daily, and I try to read at least 30 minutes a day. Lately I am very interested in psychology, so I am reading and studying a lot of this.

  Books, music, movies, TV shows, etc. Which you have recently enjoyed.

Books you've enjoyed a lot lately: Influence by Robert B. Ciadini. Rework, by Jason Fried. Think Like a Freak, by Freakonomics, and Paul Allen's Idea Man. Also, the series that I liked the most is Black Mirror.