on 1 December 2010
I really enjoyed reading through this book by Terence Parr and started it when only halfway through his other book "The Definitive ANTLR Reference". "Language Implementation Patterns" I would say is a better starting point and makes for easy reading, the writing style is very approachable. It feels very much like a distillation of notes that Professor Parr has collected from years of teaching students computer language topics. Structured in a similar way to the influential Design Patterns: Elements of Reusable Object-Oriented Software book it breaks down Language implementation into discrete but related patterns using Antlr grammar and Java code in the examples. I can not express how well he breaks down this highly technical subject into clearly defined patterns while gently and progressively introducing you to the Antlr language tool.
on 16 August 2012
This book is a good introduction when you want to write your own Domain Specific Language (DSL). I have several books about compiler writing and this has turned out to be the most directly useful. If I were doing this as part of a degree course, I would probably choose the Dragon book. But for my purposes, Language Implementation Patterns is far more useful. If someone wanted to learn how to implement a compiler for an actual project and just wanted nuts and bolts without too much theory, I would choose this book. It is easy to read and it concentrates on actionable programming steps rather than compiler theory. That allows you to get programming early on with small projects to get experience. Then it uses a popular compiler generator tool, ANTLR, to build more comprehensive examples. This made sense to me.
In my experience of writing compilers, the tool you use for the lexer and parser parts is only as important as getting you past those steps in the development. The more difficult part of writing a compiler is usually what you do after your language is parsed and you now have to do something with the parsed tokens. This book describes that stage as well. The book is well written and easy to read, which helps a lot. The book is medium thickness so not too daunting but substantial enough. I would recommend this book for a programmer who needs to implement a compiler or interpreter and doesn't want to get too bogged down in academic theory.
on 17 November 2012
Very useful book for people with a computer science background. Lots of things are taken for granted (Java, grammar definition, data structures, ...).
If you have used flex/bison (yacc/lex) this book will open your eyes to new modern technologies for language implementation
I find the writing style quite refreshing. I never felt bored while reading the book. The way the book is organized into patterns make it very easy to consume. Once you get used to the structure it is very easy to jump back and forth looking for the pattern that will solve your problem.
I'd recommend it to professionals rather than programming hobbyists.
Perfect in combination with the "dragon" book.
on 2 January 2014
More and more software applications these days need to be able to receive data in a variety of weird and wonderful formats. Some are also complex enough that implementing a DSL for configuration is worthwhile. For both of those tasks, you will need to write a parser. Every time I need to do so, my reference of choice is Language Implementation Patterns.
This book is very clear and well written. You will learn how to build a language parser and compiler from first principles in easy steps that build on top of each other. Even though all code examples are in Java, the explanations are clear enough that you should be able to convert any of them to your language of choice: I've written versions of the parsers in the book in both Python and Erlang even though I am far from an expert in either language.
In short: if you have any interest in domain specific computer languages or data parsing, get this book. If you want to go further and create a parser and compiler for a general purpose programming language, get this book too.
on 5 June 2014
The biggest gain from reading this book is that it adds to your toolbox of programming techniques one often not even considered: custom, domain-specific programming language.
Creating a language seems at first like a daunting task that takes a lifespan but this book shows that it is not, especially if you need it just for giving some extra power to configuration scripts, in-application macros and the like.
This book presents in details, one by one, all the algorithms needed to read and execute a source code written in your own language.
You don't need knowledge of formal grammars and the like to use this book but it'd help. Or this book might be an inspiration to learn more.
on 8 April 2010
I have a degree in Computer Science and yet a very confused mind when it was about designing languages for my applications.
I particularly liked the systematic decomposition of problems into patterns. It finally brings clarity to a subject
without resorting to more theoretical texts, leaving to the curious readers the option to deepen their knowledge, but providing all the necessary tools to those interested in
a principled yet immediately applicable solution.