DSLs in Action
Debasish Ghosh
Foreword by Jonas Bonér
  • December 2010
  • ISBN 9781935182450
  • 376 pages
  • printed in black & white

"Covers a lot of ground...not only widely but deeply."

Jonas Bonér, Scalable Solutions

Your success—and sanity—are closer at hand when you work at a higher level of abstraction, allowing your attention to be on the business problem rather than the details of the programming platform. Domain Specific Languages—"little languages" implemented on top of conventional programming languages—give you a way to do this because they model the domain of your business problem.

DSLs in Action introduces the concepts you'll need to build high-quality domain-specific languages. It explores DSL implementation based on JVM languages like Java, Scala, Clojure, Ruby, and Groovy and contains fully explained code snippets that implement real-world DSL designs. For experienced developers, the book addresses the intricacies of DSL design without the pain of writing parsers by hand.

Table of Contents show full


preface acknowledgments about the book

Part 1 Introducing domain-specific languages

1. Chapter 1 Learning to speak the language of the domain

1.1. The problem domain and the solution domain

1.2. Domain modeling: establishing a common vocabulary

1.3. Introducing DSLs

1.4. Execution model of a DSL

1.5. Classifying DSLs

1.6. When do you need a DSL?

1.7. DSLs and abstraction design

1.8. Summary

1.9. References

2. Chapter 2 The DSL in the wild

2.1. Building your first Java DSL

2.2. Making friendlier DSLs

2.3. DSL implementation patterns

2.4. Choosing DSL implementations

2.5. Summary

2.6. References

3. Chapter 3 DSL-driven application development

3.1. Exploring DSL integration

3.2. Internal DSL integration patterns

3.3. External DSL integration patterns

3.4. Handling errors and exceptions

3.5. Managing performance

3.6. Summary

3.7. References

Part 2 Implementing DSLs

4. Chapter 4 Internal DSL implementation patterns

4.1. Filling your DSL toolbox

4.2. Embedded DSLs: patterns in metaprogramming

4.3. Embedded DSLs: patterns with typed abstractions

4.4. Generative DSLs: boilerplates for runtime generation

4.5. Generative DSLs: macros for compile-time code generation

4.6. Summary

4.7. References

5. Chapter 5 Internal DSL design in Ruby, Groovy, and Clojure

5.1. Making DSLs concise with dynamic typing

5.2. A trade-processing DSL in Ruby

5.3. The order-processing DSL: the final frontier in Groovy

5.4. Thinking differently in Clojure

5.5. Recommendations to follow

5.6. Summary

5.7. References

6. Chapter 6 Internal DSL design in Scala

6.1. Why Scala?

6.2. Your first step toward a Scala DSL

6.3. Let’s DSL in Scala!

6.4. Building a DSL that creates trades

6.5. Modeling business rules with a DSL

6.6. Stitching ’em all together

6.7. Composing DSLs

6.8. Monadic structures in DSL

6.9. Summary

6.10. References

7. Chapter 7 External DSL implementation artifacts

7.1. Anatomy of an external DSL

7.2. The role of a parser in designing an external DSL

7.3. Classifying parsers

7.4. Tool-based DSL development with Xtext

7.5. Summary

7.6. References

8. Chapter 8 Designing external DSLs using Scala parser combinators

8.1. Parser combinators

8.2. The Scala parser combinator library

8.3. DSL design with parser combinators: step-by-step

8.4. A DSL that needs a packrat parser

8.5. Summary

8.6. References

Part 3 Future trends in Dsl development

9. Chapter 9 DSL design: looking forward

9.1. Growing language support for DSL design

9.2. DSL workbenches

9.3. More tool support

9.4. The mature evolution of a DSL

9.5. Summary

9.6. References

© 2014 Manning Publications Co.

What's inside

  • Tested, real-world examples
  • How to find the right level of abstraction
  • Using language features to build internal DSLs
  • Designing parser/combinator-based little languages

About the reader

This book is written for developers working with JVM languages. Others will find techniques that (generally) work for them too.

About the author

Debasish Ghosh is a senior member of the ACM and an influential blogger. He works with DSLs based on Java, Ruby, Clojure, and Scala.

combo $44.99 pBook + eBook
eBook $35.99 pdf + ePub + kindle

FREE domestic shipping on three or more pBooks

"Thorough, well thought-out, carefully crafted."

Guillaume Laforge, SpringSource

"Covers the what, why, when, and how of DSLs."

David Dossot, Programmer & Author

"Exhaustive, competent, and compelling."

Frederico Tomassetti, Politecnico do Torino

"Five languages, no trivial examples, all in one book."

John S. Griffin, Overstock.com