O’Reilly news

Language Implementation Patterns--New from Pragmatic Bookshelf: Create Your Own Domain-Specific and General Programming Languages

February 4, 2010

Raleigh, NC—Developers crave the power of creating their own domain-specific languages. It's a very practical, productive technique that lets developers boost their productivity by building applications that are tailor-made for their unique requirements. However, most books on language development can be a waste of time. They dwell on building compilers and give the impression that language development requires a lot of theoretical computer science.

Terence Parr shatters that impression in his new book, Language Implementation Patterns: Create Your Own Domain-Specific and General Programming Languages (Pragmatic Bookshelf, $34.95). Using detailed descriptions of 31 language patterns—common data structures, algorithms, or strategies—Parr demystifies the universal elements of languages. The patterns aren't presented as language design theory or a library of language implementations, they're presented as tools for developing modest, day-to-day language applications. This is language development put to pragmatic use.

Organized into four parts, the book leads readers to a rich understanding of DSLs and general-purpose programming languages. First, Parr presents the overall architecture of language applications and the key patterns of language recognition (parsing). Next, he uses parsers to build trees that represent language constructs in memory. By "walking the trees," language developers use patterns that check whether input streams make sense. Then, in the third part, Parr reveals patterns for high-level and bytecode interpreters. Last, he shows how to translate languages and generate text using the StringTemplate template engine. Drawing on the architecture of some interesting language applications, readers then launch into building their own languages.

Readers apply the patterns toward building configuration file readers, data readers, model-driven code generators, source-to-source translators, source analyzers, and interpreters. Code snippets and implementations are written in Java and ANTLR (the well-known parser generator that Parr created).

But you're not limited to Java or ANTLR. As Parr points out, "You'll have no problem transferring your knowledge to other tools after you finish the book. It's like learning to fly—you have no choice but to pick a first airplane. Later, you can move easily to another airplane. Gaining piloting skills is the key, not learning the details of a particular aircraft cockpit."

No longer is language development the dark art of computer scientists. Using the patterns shared by programming languages, developers can reap the rewards of building DSLs. Language Implementation Patterns gives developers true power: the power to code in their own language.

Advance Praise
"Throw away your compiler theory book! Terence Parr shows how to write practical parsers, translators, interpreters, and other language applications using modern tools and design patterns. Whether you're designing your own DSL or mining existing code for bugs or gems, you'll find example code and suggested patterns in this clearly written book about all aspects of parsing technology."
—Guido van Rossum, Creator of the Python language

For a review copy or more information please email pragprogpr@oreilly.com. Please include your delivery address and contact information.

Terence Parr is a professor of computer science and graduate program director at the University of San Francisco, where he continues to work on his ANTLR parser generator (http://www.antlr.org) and template engine (http://www.stringtemplate.org).

Additional Resources
For more information about the book, including code, errata, discussions, full table of contents, excerpts from the book and more, see the catalog page for Language Implementation Patterns: Create Your Own Domain-Specific and General Programming Languages.

Language Implementation Patterns
Publisher: Pragmatic Bookshelf
Terence Parr
ISBN: 9781934356456, 350 pages,
Book Price: $34.95 USD, £24.99 GBP

About Pragmatic Bookshelf
Pragmatic Bookshelf is an imprint of the Pragmatic Programmers, LLC. Our titles are distributed to bookstores internationally by O'Reilly Media.

The Pragmatic Bookshelf features books written by developers for developers. The titles continue the well-known Pragmatic Programmer style, and continue to garner awards and rave reviews. As development gets more and more difficult, the Pragmatic Programmers will be there with more titles and products to help programmers stay on top of their game.

About O’Reilly

O’Reilly Media spreads the knowledge of innovators through its books, online services, magazines, and conferences. Since 1978, O’Reilly Media has been a chronicler and catalyst of cutting-edge development, homing in on the technology trends that really matter and spurring their adoption by amplifying “faint signals” from the alpha geeks who are creating the future. An active participant in the technology community, the company has a long history of advocacy, meme-making, and evangelism.

Email a link to this press release