Jul 212013
 

Language Implementation Patterns: Create Your Own Domain-Specific and General Programming Languages (Pragmatic Programmers)

Language Implementation Patterns: Create Your Own Domain-Specific and General Programming Languages (Pragmatic Programmers)

Learn to build configuration file readers, data readers, model-driven code generators, source-to-source translators, source analyzers, and interpreters. You don’t need a background in computer science–ANTLR creator Terence Parr demystifies language implementation by breaking it down into the most common design patterns. Pattern by pattern, you’ll learn the key skills you need to implement your own computer languages.

Knowing how to create domain-specific languages (DSLs) can gi

Price:

Find More Language Translators Products

  3 Responses to “Language Implementation Patterns: Create Your Own Domain-Specific and General Programming Languages (Pragmatic Programmers) Reviews”

  1. 28 of 31 people found the following review helpful
    5.0 out of 5 stars
    A must have for developers, June 4, 2010
    By 
    German Viscuso “German” (Madrid, Spain) –

    I was terribly interested in getting my hands on this book since I’m taking a formal course on Compilers and Interpreters at university and I really wanted to know: What’s the difference between what we (as computer scientists) are taught in a compilers’ course and the more practical approach presented in the book?

    As it turns out there’s a big difference. If you want to be the ultimate guru of compilers (eg. contributing an even more efficient compiling technique for language X or creating a language that forces us all to reconsider what we know about compilers) you need both, the theory the practice (because without the theory you wouldn’t know how to improve or make obsolete an existing technique, and without the practice you wouldn’t be able to put that knowledge to work inside a language compiler). Now if you just want to be able to deal with your DSL (domain specific language), create data readers, code generators, source-to-source translators, source analyzers, etc. you’ll love the hands on information presented in this book.

    Let’s be honest, how many of us developers are required or willing to create a language from scratch together with its compiler or interpreter versus the ones that just need to parse an XML file, process a DSL or create a configuration file reader? I would say that there are much more developers in the later group. But fortunately we all (or almost all) share one thing in common: we know software patterns! This is how the author structured the book, offering patterns (ala Gamma et al) that you can use when creating your language processors (an excellent approach in my opinion since each pattern focuses on different stages of language processing which helps the developer modularize the solution and understand how the different parts of the “machine” work without loosing sight of the big picture).

    So, in case you’re wondering “what is this guy talking about?”. A compiler is a program that transforms code created in one language into another (eg. C source code into executable code). Normally the transformation goes from a higher level language to a lower level language (eg. to machine code)(if it’s the other way round we have a “decompiler”). When the transformation happens between languanges on the same level we’re dealing with a language translator or converter (normally called “source-to-source translator”)(eg. Sharpen, an open source framework created by the db4o team that converts Java code to C#). A compiler is likely to perform several operations such as lexical analysis, preprocessing, parsing, semantic analysis, code generation, and code optimization (which are directly or indirectly covered in the patterns offered in the book). The ultimate tool for developers interested in building compilers is a compiler-compiler or parser generator which, as you might have already guessed, provides a high level description language to help you build your own compiler (this usually involves the creation of a lexer and a parser).

    However, I feel I should mention that there’s a whole lot of complexity in handling and maintaining all the intermediate information when you’re creating your own compiler for your own language which is covered only indirectly in this book. There’s also no detailed explanation of the final steps of a compiler implementation such as machine code generation and optimization, register allocation, etc. Overall this is an excellent book for day-to-day language applications (involving parsing, translations, etc).

    Now I find pretty important to mention who the author is. Terence Parr created the ANTLR parser generator (antlr.org) and the StringTemplate engine (stringtemplate.org). He’s a professor of computer science that’s no theorist (this guys has real practical experience!). He has so much experience that he started to see these patterns when developing language processors coming again and again. The end result is this book that presents a compilation of those patterns.

    The structure of the book is pretty straight forward. Four general parts:

    * Getting Started with Parsing: where you’ll learn about the general architecture of language applications and review the patterns that involve parsing.
    * Analyzing Languages: where you’ll see how to use the parsing techniques described in the previous section to build trees that hold language constructs in memory, how to walk those trees to track and identify various symbols (such as variables and functions) and how to determine the type of the expressions. Overall you’ll learn how to check whether an input stream makes sense.
    * Building Interpreters: four interpreter patterns are presented that vary in terms of implementation difficulty and run-time efficiency. In the two previous parts the focus was on patterns that verify the syntax of an input sentence and make sure that it follows a set of semantic rules. In this part the focus…

    Read more

    Help other customers find the most helpful reviews 

    Was this review helpful to you? Yes
    No

  2. 16 of 18 people found the following review helpful
    4.0 out of 5 stars
    Way better than sifting through textbooks, March 17, 2010
    By 
    Adam Keys (Dallas, TX) –
    (REAL NAME)
      

    I had to read the classic Dragon book in college. I’m glad I did and feel that all software developers should go through the mental process of learning to build a compiler. Doing so ties together all the classes that come before it, from data structures to theory of computation. But, the texts on those subjects are quite dense and not quite practical for the working developer.

    This book fills that gap quite nicely. It is free of excess jargon and gets right to the point of creating new languages. Each chapter builds up the reader’s repertoire of techniques and tools for writing programs that create programs. For a relatively short book, the author does a fine job of covering scanning, parsing, type checking, interpreters, virtual machines and code generation.

    If you’ve ever wanted to build your own language but fell short when it came to the theory behind it, this book is the one to check out.

    Help other customers find the most helpful reviews 

    Was this review helpful to you? Yes
    No

  3. 26 of 32 people found the following review helpful
    5.0 out of 5 stars
    Language Design for the rest of us, January 6, 2010
    By 
    K. Ferrio (TUCSON, AZ United States) –
    (REAL NAME)
      

    This is my favorite kind of book: the harder I work, the more I get. So be prepared to work hard. And if you do, you will be rewarded with gems of insight. If you’re looking for a “cookbook” I respectfully suggest that you examine your reasons for being interested in language design. All the ingredients and kitchen implements are here, clearly labeled and explained. There are even examples of how you might consider mixing them. But it’s up to you to write the recipe you need, and a key objective of this book is getting you to that magical moment when you see how everything comes together.

    Plenty of people much more educated and experienced in the art and science of language design than I am will surely write insightful reviews about the merits of this book from the perspective of specialists. I’m writing this review for the rest of us.

    Terence Parr continues his campaign to make superb language-development tools accessible. Have you ever wondered how your compiler really works? Maybe you’ve dreamed about creating your own scripting language — the one that works the way *you* want — but you’re not Larry Wall. Well, take heart. Professor Parr’s second ANTLR book is here. Maybe you never took a course in compiler design (I haven’t.) or maybe you have and are still wondering how to do anything practical with it. This book is for you. You very well might not become the next Guido van Rossum, but you will come away with a deeper appreciation of language implementation — probably enough to create your personal dream language.

    I call this the “second ANTLR book,” but that’s a gross oversimplification. If you already know that ANTLR stands for ANother Tool for Language Recognition, then the next thing you need to know is that this book is about much more than ANTLR. You also may know that ANTLR is written in Java. But you don’t need to know Java to get value from this book. (In fact ANTLR itself can target C, C# and several other languages besides Java.) Although the book uses ANTLR to describe example languages, and Java to implement them, the author very cleanly separates concepts from tools and implementation details, in a way which is consistently pragmatic and never drifts off into the clouds. There is no pedagogic hand-waving here. This is the real stuff. And when you grasp it, you too will be able to create everything from “simple” data format translators to script interpreters and maybe even some non-optimizing compilers. Really.

    Help other customers find the most helpful reviews 

    Was this review helpful to you? Yes
    No

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>