Compilers / Language Design (Programming)

Background

  • Compilers are basically the way you build new programming languages on top of the old ones.
  • So, for example, Python was built with C.
  • My understanding is that you could theoretically use these principles to design a programming language that would take everyday English and turn it into a computer program. Obviously you would have a lot of issues with the ambiguity of everyday English.

 

Articles / Videos



 

Books

  • Books that looks like they're easy-to-read:
    • Compiler Design in C
      • I bought this book after reading the Dragon Book (Aho,Sethi,Ullman). While Dragon Book is more on theory and less on practical compiler design, this book will take you to the very foundation of compilers both theory and practical in a very simple and easy to understand language and with lots of examples.
    • Introduction to Compiler Construction
      • I'm a computer science professor and have taught compiler construction for several years. Parsons teaches the material the way it ought to be. He is clear and concise without leaving out any of the essential material.
      • I think Parsons had an intelligent idea in writing this book. Without originality claims (as he point out in the preface) the book is intended to the audience of novices, with the clear target of explaining in great details compilers principles. As he says in the preface, the objective is to prepare the reader for more advanced lectures, and he explicitly mention the reference book as an example: Aho-Sethi-Ullman's "Compilers: Principles, Techniques and Tools", a.k.a the Dragon book.
        The approach is quite theoretical and principles-centered, just as the Dragon book is. But Parsons departs from this in the writing style: It is definitely straightforward. He sacrifices the scope of the book in favor of clarity: he took the core of books like the Dragon, and expanded this core to a well appreaciable extent. It comes over and over again on more awkward concepts with detailed examples.

    • Language Implementation Patterns: Create Your Own Domain-Specific and General Programming Languages
      • 4.5 stars, 26 reviews
      • Guido van Rossum, creator of Python (Python forever!), commented: Throw away your compiler theory book! So I knew. I also found out that professor Parr has been teaching language applications programming for years. Then I knew. The book itself came from the famous Pragmatic Bookshelf. And I knew: LIP would be a good read.
  • Other books
    • Compilers: Principles, Techniques, and Tools
      • 4 stars, 97 reviews
      • I spent some serious quality time with the first edition (the "red dragon book"), in three main episodes over the past dozen years: 1) undergraduate compilers class, 2) industry project, and 3) parser generator implementation. During all three episodes, I was disappointed in various ways, though there is no denying that the book contains a wealth of information. As an undergraduate, I found the book somewhat impenetrable. When in industry, I found the book too abstract. When implementing a parser generator, I discovered that the book excludes important research results with regard to LR parser generation.
    • Principles of Compiler Design
      • 5 stars, 9 reviews
    • Engineering a Compiler
      • 4.5 stars, 12 reviews
    • Domain-Specific Languages
      • 4 stars, 14 reviews
      • Written by Martin Fowler, who also wrote "Refactoring"
      • As usual, Fowler delivers a very well structured book, easy to both read and use as reference material. He is a very able and pragmatic writer and that shows in this book.

        However, I can't consider this book a good text because of the things it omits. This is a book about designing DSLs and this task is one of the things functional languages excel at, but Fowler establishes in the introduction that he is going to happily ignore all things related to functional programming and never looks back. Anyone interested in designing DSLs owes it to himself to research Haskell, Scala and F# as they are vastly superior to Java in this respect.