Compiler really matters in CS
Like the chicken/egg problem, what came first, the compiler or the operating system? You may think it’s an easy question. Because computer science starts from 1900s, it’s not difficult to check its history and answer this question. Here, let’s temporally put it off, and learn Compilers from Stanford together, then we can reasonably infer the answer.
In the Turing Award’s fifty years history, there are four recipients who gain the award for their contributions in compilers. Some famous compilers, like GCC, have almost thirty years history. And the compiler is becoming smarter and smarter. It can make high level code even faster than manually optimized C code.
Learning something about compilers will show you the interplay of theory and practice in computer science, especially how powerful general ideas combined with engineering insight can lead to practical solutions to very hard problems. Knowing how a compiler works will also make you a better programmer and increase your ability to learn new programming languages quickly.
The theoretical stuff of this course includes lexical analysis, parsing, syntax-directed translation, abstract syntax trees, types and type checking, intermediate languages, dataflow analysis, program optimization, code generation, and runtime systems.
Because not every programmers work to build compilers, but sometimes creating and parsing their own domain-specific programming language is quite necessary. Besides the course material, this chapter will also take the book, Language Implementation Patterns as a reference to introduce some technology which you can use in your programming life.
The course project is to write a complete compiler for COOL, the Classroom Object Oriented Language. As supplementary, this chapter will also try to analysis the implementation of LOOP language in common lisp. How the loop marco is translated into common lisp do S-expression? I deeply believe that the loop macro is one of the most impressive part of common lisp for many lisp programmers. Let’s figure out how it works!