jueves, 24 de noviembre de 2016

The Hitchhiker’s Guide to the Galaxy

The science fiction books generally I like and, my opinion about The Hitchhiker's Guide to the Galaxy book is positive. The book is interesting it have its chapters where it catch you and, others where you bored a little but in general the plot is good.

The part that I liked the most was when they asked the super computer (Thought Deep), "What is the meaning of life, the universe and everything?" And the computer responds "It will take me a long time to answer" and people interested in knowing the answer respond "does not matter". Philosophers are opposed because their careers in the event of get an answer would end and no one would need their knowledge and I think that is what concerns them. At the end the answer is 42 and everyone is left with what??

The computer takes millions of thousands of years to give that absurd answer, but its answers to when the people ask what because it gave this answer "You do not have a question, therefore I gave you any answer. You have to look for the question, and the question that you want to ask me was in the planet Earth, which was destroyed. "What I took from this part of the book is that many times we look for explanations for everything, and I think that from time to time it is good to believe that some things don't have explanation.


Finally, the mice and their craft of creating planets seemed me very cute. The most insignificant beings of the earth turned out to be the owners of the planet and the first inhabitants. I didn't like much to stay with the doubt about what happened later, if they could rebuild the earth, if they found the question for which they already had answer, many questions without answer and in our case we do not have a Deep Thought.

Technical Overview of the CLR

Undoubtedly, human always beings seek to improve, and in matters of code and programming is no exception. In this article we learn about new runtime environments and, is that if you have a super compiler but, the runtime environment is not right our compiler will not work as we hope and the effort to do the best will be in vain.

When we hear or see JVM (Java Virtual Machine) we automatically think that it is only a runtime environment for Java programs or of the Java family, but we would be surprised how many programs use JVM as a runtime engine. To mention some  LISP uses JVM for its execution.

However there is not only JVM, CLI is the direct competition of JVM, but knowing the characteristics of CLI, this has advantages. Suppose JVM and CLI face off for the title fight to best runtime enviroment, let's say CLI wins for Knock Out in the third round and takes the title, however JVM does not give up and will seek revenge.

CLI has been designed from the ground up as a target for multiple languages, and explicitly addresses many of the issues mentioned above that are needed to efficiently compile a wide variety of languages. To ensure this, from early on in the development process of the CLI, Microsoft has worked closely with a large number of language implementers.

CLI has 220 instructions, provides a number of instructions for transferring values to and from the evaluation stack. Instructions that push values on the evaluation stack are called “loads”, and instructions that pop elements from the stack into local variables are called “stores”. Punto para CLI.

A disadvantage of JVM is that it does not indicate overflow during operations on integer data types, which means that the time penalty may be significant for procedures which perform intensive arithmetic in languages that require overflow detection.

Ruby and the Interpreter Pattern

For this occasion the article that we had to read talks about an interpreter Framework developed by our professor Ariel Ortiz using the Ruby language. In a past course we learned to program in Ruby, it seemed to me a friendly and nice language, unfortunately, it was not much time that we was working with this language and, at least me, I have not investigated more about it.

Returning to the subject, Ruby is an interpreted, dynamically typed programming language. Its syntax borrows from Eiffel, Ada, and Perl, and it’s fully object-oriented in the spirit of Smalltalk. I remember that everything in Ruby is an object, including: strings, numbers, arrays (lists), hashes (maps or dictionaries), symbols, procedures (closures), and even classes.

About the syntax: local variables, method parameters, and method names should all start with a lowercase letter or with an underscore. Global variables are prefixed with a dollar sign ($), while instance variables begin with an “at” sign (@). Class variables start with two “at'” signs (@@). Finally, class names, module names, and constants should start with an uppercase letter. I also remember that it is not used semicolon or parentheses as in other languages. To end a function the word "end" is written.

The article mentions that, “The author has used the S-expression Interpreter Framework in his Programming Language course several times since mid 2005”, And that students at the end of the course ensure that, “they enjoyed the SIF approach and that it helped them to have a better understanding of how programming languages work”.


The S-expression Interpreter Framework (SIF) provides the basic building blocks that allow writing interpreters that can easily be studied, extended and modified. Particularly useful is the SIF’s special form definition mechanism, which allows a clear distinction between the syntax and semantics of any language construct.  

miércoles, 23 de noviembre de 2016

Compile-Time Metaprogramming

This blog seemed a little complicated since it explains many terms that I did not fully understand. First of all, I had to investigate what was Metaprogramming and found that: “Metaprogramming is the art of writing of computer programs with the ability to treat programs as their data. It means that a program could be designed to read, generate, analyze or transform other programs, and even modify itself while running. In some cases, this allows programmers to minimize the number of lines of code to express a solution (hence reducing development time), or it gives programs greater flexibility to efficiently handle new situations without recompilation. One of the types of metaprogramming involves only writing their program using generic programming”

When reading all this information I remembered my classes of Programming Languages where we use LISP like programming language. One of the features of LISP is that it is a functional language which allows you to make or use macros, which are precisely programs that write programs, something like writing with code what you want to code. The advantage of this was made the programs more efficient and we reduced the compilation time.

When we talk about Compile-Time we mean to prepare for the future of our program, with this I mean that Compile-Time Metaprogramming allows us to interact with the compiler to allow the construction of arbitrary program fragments by user code. We must always be prepared for growth, and Compile-Time Metaprogramming is a powerful tool that helps us to apply optimizations and new features to our language.

For those who were surprised when using macros, this tool will leave them with the mouth open. It is good that we learn ways to improve the code because, that our program works does not mean that it does on the best way, we should always seek to improve and make our code as optimal as possible and prepare it for the future.

Mother of Compilers

This blog has seemed to me the most interesting of all blogs that I've read, find out how women have had a presence in the computer industry along the years is a lot of pride (without sounding feminist) for the women which we study engineering and more knowing that she was a good programmer.

I suppose that at that time, she faced very complicated situations, since the machismo was much more present and the opportunities of the women were scarce and worse still in majors that were said to be for man and where the women did not have opportunity because it was heavy tasks And difficult (intellectually speaking) that women could not perform.

In my short experience, I have suffered a bit of discrimination against women who decide to study careers that are said of men. Often the discrimination comes from the classmates, other times has been by teachers, and finally and where is more present is in the workplace or work area.

However thanks to the times have changed, now women we have more opportunity because many of the big companies are focused at workforce equity, so for the women that we are studying a career where there are almost no women, you are more probably that we get a good job (I heard a woman teacher say this) since there's a law or I do not know what it is, but establishes that large companies must have a certain percentage of women working and another percentage of men.


It would be interesting if stories such as these were told at career fairs to motivate more women to do what they really like and, to identify with women like Grace Brewster.  We have to set us strong goals, challenges that allow us to know what we really are able. It could be that the next programming language is also developed by a woman.

martes, 22 de noviembre de 2016

Internals of GCC

For this blog we had to listen to a potcast where they talk about how the GCC compiler works. The presenter discussed relevant things of the compiler and related details about how it is that the compiler translates the code, analyzes the information and generates results once the process is completed. I remember that in the operating systems class we used GCC to compile our lab activities but, at that time, I did not know how it works, and to be honest it was not something that would interest me very much.

Researching a little about the history of the GCC compiler, I read that belongs to the GNU project whose syllables are a recursive acronym for "GNU's is not Unix" and it is backed by the Free Software Foundation. Free Software Foundation is an organization that removes restrictions on copying, redistributing, understanding and modifying computer programs. It's like the Stack Overflow of our times, but with employees dedicated to writing free distribution programs.

The GCC compiler received this name because at first it was only designed to compile programs written in C language but, with the passage of time it was able to compile programs in C++, FORTRAN, Ada and other more. What really makes the GCC compiler nice is that it has multiple front-ends, which allows you to parse different programming languages. GCC also implements cross-compilation, which means that for example a C program can be compiled for a micro-controller.

As mentioned before, adding a new front-end to GCC enables the use of this language in different architectures and also provides useful libraries during runtime. GCC is a compiler that does not stop evolving,  even you can add improvements or use improvements made by other people, which I think is great because it is a collaboration system that works for the benefit of all users.

The Hundred-Year Language

Without a doubt, technology is one of the things that have evolved more rapidly over the years. Simply connecting to the internet 10 years ago was a laborious task and not everyone had access since to be able to connect, first you had to connect the phone cable to the CPU and then endure a horrible sound in which the connection was established, and finally pray for that a phone call will not enter, otherwise goodbye internet.

Nowadays things have improved, but also programming languages. Some have completely disappeared as the case of COBOL, I have understand that only prevails in some banking institutions and the reason is that for these companies it is very expensive to migrate their entire system to a new language so they prefer to preserve their Neanderthal system.

No wonder Java has no future to last a hundred more years. When starting the major and being Java one of the first programming languages we learn, it is common for us that consider it great and with a lot of potential (for those who know more languages I do not think this happens to them). But with the passage of time you realize that it is not as wonderful as you thought, it is like seeing how they recorded the fantastic scene of your favorite movie and realize that it is not so fantastic like you thought.


Everything in life changes for good or for bad, but we, when belonging to a technological area, see the changes much more drastic. For this reason we must always be updated and not only be satisfied with what has been learned during the major, we can explore new alternatives of programming languages and look for that which, as the article mentions, is in the highest branch of the evolution tree, and also see those little twigs that come out of it giving life to a new and improved language.

lunes, 21 de noviembre de 2016

Making Compiler Design Relevant for Students

The design of compilers seems a complicated task, but after reading the article I think it is something we do often, not with code but with things from everyday life. For example, when started in conversation with other people even though the language is the same, what our brains do when we hear each word is to translate it and find its own meaning and that is how we understand words, by their meaning, and basically thus is how a compiler works.

On the other hand, as the title of the article mentions, it must be make the design compilers more relevant for students who have never designed a compiler. For my part (as embarrassing as it sounds) I have not very clear what a compiler does, I understand the basics things about code translation but learning something else about the subject seems me so interesting.

Designing a compiler is a complicated process, it is like learning to read and write (or at least that's how I understood each of the phases to design a compiler). For example, the phase of lexical analysis and parser reminds me when we begin to recognize the vowels and consonants and we separated them into groups, we separated each letter, and we relate each of them to a different sound. Then comes the part in which we begin to form words and ours teachers begun to teach us grammar rules of punctuation, accents, and orthographic rules; this phase would be semantic analysis.

Finally, after all we had learned, we began to interpret each of the sentences in a context and, we identified the meaning of most of the words we heard (over time we learned more), we related each one to its own meaning. This phase would be Code Generation. The optimization phase would be to perfect our language day by day with new words or to learn new languages.