contents

foreword
preface
acknowledgments
about the book

Part 1 Introducing domain-specific languages

Chapter 1 Learning to speak the language of the domain
The problem domain and the solution domain
Domain modeling: establishing a common vocabulary
Introducing DSLs
Execution model of a DSL
Classifying DSLs
When do you need a DSL?
DSLs and abstraction design
Summary
References
Chapter 2 The DSL in the wild
Building your first Java DSL
Making friendlier DSLs
DSL implementation patterns
Choosing DSL implementations
Summary
References
Chapter 3 DSL-driven application development
Exploring DSL integration
Internal DSL integration patterns
External DSL integration patterns
Handling errors and exceptions
Managing performance
Summary
References

Part 2 Implementing DSLs

Chapter 4 Internal DSL implementation patterns
Filling your DSL toolbox
Embedded DSLs: patterns in metaprogramming
Embedded DSLs: patterns with typed abstractions
Generative DSLs: boilerplates for runtime generation
Generative DSLs: macros for compile-time code generation
Summary
References
Chapter 5 Internal DSL design in Ruby, Groovy, and Clojure
Making DSLs concise with dynamic typing
A trade-processing DSL in Ruby
The order-processing DSL: the final frontier in Groovy
Thinking differently in Clojure
Recommendations to follow
Summary
References
Chapter 6 Internal DSL design in Scala
Why Scala?
Your first step toward a Scala DSL
Let’s DSL in Scala!
Building a DSL that creates trades
Modeling business rules with a DSL
Stitching ’em all together
Composing DSLs
Monadic structures in DSL
Summary
References
Chapter 7 External DSL implementation artifacts
Anatomy of an external DSL
The role of a parser in designing an external DSL
Classifying parsers
Tool-based DSL development with Xtext
Summary
References
Chapter 8 Designing external DSLs using Scala parser combinators
Parser combinators
The Scala parser combinator library
DSL design with parser combinators: step-by-step
A DSL that needs a packrat parser
Summary
References

Part 3 Future trends in Dsl development

Chapter 9 DSL design: looking forward
Growing language support for DSL design
DSL workbenches
More tool support
The mature evolution of a DSL
Summary
References
appendix A: Role of abstractions in domain modeling
appendix B: Metaprogramming and DSL design
appendix C: A cheat sheet for Ruby’s DSL-friendly features
appendix D: A cheat sheet for Scala’s DSL-friendly features
appendix E: A cheat sheet for Groovy’s DSL-friendly features
appendix F: A cheat sheet for Clojure’s DSL-friendly features
appendix G: Polyglot development
                     index