The article is from a professor from the Department of Computer Science at the University of Arizona and list some points to attempt to make more attractive the course of compiler design. The article starts telling us which was one of the first exercises that the author left to a course of compiler designer, honestly it sounds complicate and the author confirms this when says that the point of the exercise was to give a first approach to the students to the use of lex & yacc. But returning to the main point of the reading, we can highlight that the examples used are simple to understand, but maybe in practice are hard to implement. I wonder what would be the practices that we will be doing at our course.
I liked that the reading let me understand better the translation phases that we discussed the last class. As I understand the steps to do a translation, the order and “output” of each phase is the following:
1. Lexical Analysis and Parsing: Phase that takes a string and divides it into tokens (words, punctuation, etc..) and the parsing is the process to give structure to the tokens
2. Semantic Analysis: Phase that works and then propagates information that is not part of the context-free syntax of the language (this means that the output of phase 1 is processed and distributed to the some "mechanisms" to match some rules
3. Code generation: This phase process the tree representation of the program (starting with child nodes and doing operations with the father nodes “traversing”) and generates machine language
4. Code optimization: This phase attempts to reduce the cost of the generated code which can be energy usage, time consuming or size
I don’t know if I’m missing or misunderstanding something, but I consider this is the more basic explanation and easiest way to understand the translation
No hay comentarios:
Publicar un comentario