Table of Contents

Copyright

Brief Table of Contents

Table of Contents

List of Figures

List of Tables

List of Listings

Preface

Acknowledgments

About this Book

About the Author

About the Cover Illustration

Chapter 1. What are domain-specific languages?

1.1. Striving for simplicity

1.1.1. Creating simple code

1.1.2. Creating clear code

1.1.3. Creating intention-revealing code

1.2. Understanding domain-specific languages

1.2.1. Expressing intent

1.2.2. Creating your own languages

1.3. Distinguishing between DSL types

1.3.1. External DSLs

1.3.2. Graphical DSLs

1.3.3. Fluent interfaces

1.3.4. Internal or embedded DSLs

1.4. Why write DSLs?

1.4.1. Technical DSLs

1.4.2. Business DSLs

1.4.3. Automatic or extensible DSLs

1.5. Boo’s DSL capabilities

1.6. Examining DSL examples

1.6.1. Brail

1.6.2. Rhino ETL

1.6.3. Bake (Boo Build System)

1.6.4. Specter

1.7. Summary

Chapter 2. An overview of the Boo language

2.1. Why use Boo?

2.2. Exploring compiler extensibility

2.3. Basic Boo syntax

2.4. Boo’s built-in language-oriented features

2.4.1. String interpolation

2.4.2. Is, and, not, and or

2.4.3. Optional parentheses

2.4.4. Anonymous blocks

2.4.5. Statement modifiers

2.4.6. Naming conventions

2.4.7. Extension methods

2.4.8. Extension properties

2.4.9. The IQuackFu interface

2.5. Summary

Chapter 3. The drive toward DSLs

3.1. Choosing the DSL type to build

3.1.1. The difference between fluent interfaces and DSLs

3.1.2. Choosing between a fluent interface and a DSL

3.2. Building different types of DSLs

3.2.1. Building technical DSLs

3.2.2. Building business DSLs

3.2.3. Building Extensibility DSLs

3.3. Fleshing out the syntax

3.4. Choosing between imperative and declarative DSLs

3.5. Taking a DSL apart—what makes it tick?

3.6. Combining domain-driven design and DSLs

3.6.1. Language-oriented programming in DDD

3.6.2. Applying a DSL in a DDD application

3.7. Implementing the Scheduling DSL

3.8. Running the Scheduling DSL

3.9. Summary

Chapter 4. Building DSLs

4.1. Designing a system with DSLs

4.2. Creating the Message-Routing DSL

4.2.1. Designing the Message-Routing DSL

4.3. Creating the Authorization DSL

4.3.1. Exploring the Authorization DSL design

4.3.2. Building the Authorization DSL

4.4. The “dark side” of using a DSL

4.5. The Quote-Generation DSL

4.5.1. Building business-facing DSLs

4.5.2. Selecting the appropriate medium

4.6. Summary

Chapter 5. Integrating DSLs into your applications

5.1. Exploring DSL integration

5.2. Naming conventions

5.3. Ordering the execution of scripts

5.3.1. Handling ordering without order

5.3.2. Ordering by name

5.3.3. Prioritizing scripts

5.3.4. Ordering using external configuration

5.4. Managing reuse and dependencies

5.5. Performance considerations when using a DSL

5.5.1. Script compilation

5.5.2. Script execution

5.5.3. Script management

5.5.4. Memory pressure

5.6. Segregating the DSL from the application

5.6.1. Building your own security infrastructure

5.6.2. Segregating the DSL

5.6.3. Considerations for securing a DSL in your application

5.7. Handling DSL errors

5.7.1. Handling runtime errors

5.7.2. Handling compilation errors

5.7.3. Error-handling strategies

5.8. Administrating DSL integration

5.9. Summary

Chapter 6. Advanced complier extensibility approaches

6.1. The compiler pipeline

6.2. Meta-methods

6.3. Quasi-quotation

6.4. AST macros

6.4.1. The unroll macro

6.4.2. Building macros with the MacroMacro

6.4.3. Analyzing the using macro

6.4.4. Building an SLA macro

6.4.5. Using nested macros

6.5. AST attributes

6.6. Compiler steps

6.6.1. Compiler structure

6.6.2. Building the implicit base class compiler step

6.7. Summary

Chapter 7. DSL infrastructure with Rhino DSL

7.1. Understanding a DSL infrastructure

7.2. The structure of Rhino DSL

7.2.1. The DslFactory

7.2.2. The DslEngine

7.2.3. Creating a custom IDslEngineStorage

7.3. Codifying DSL idioms

7.3.1. ImplicitBaseClassCompilerStep

7.3.2. AutoReferenceFilesCompilerStep

7.3.3. AutoImportCompilerStep

7.3.4. UseSymbolsStep

7.3.5. UnderscoreNamingConventionsToPascalCaseCompilerStep

7.3.6. GeneratePropertyMacro

7.4. Batch compilation and compilation caches

7.5. Supplying external dependencies to our DSL

7.6. Summary

Chapter 8. Testing DSLs

8.1. Building testable DSLs

8.2. Creating tests for a DSL

8.2.1. Testing the syntax

8.2.2. Testing the DSL API

8.2.3. Testing the DSL engine

8.3. Testing the DSL scripts

8.3.1. Testing DSL scripts using standard unit testing

8.3.2. Creating the Testing DSL

8.4. Integrating with a testing framework

8.5. Taking testing further

8.5.1. Building an application-testing DSL

8.5.2. Mandatory testing

8.6. Summary

Chapter 9. Versioning DSLs

9.1. Starting from a stable origin

9.2. Planning a DSL versioning story

9.2.1. Implications of modifying the DSL engine

9.2.2. Implications of modifying the DSL API and model

9.2.3. Implications of modifying the DSL syntax

9.2.4. Implications of modifying the DSL environment

9.3. Building a regression test suite

9.4. Choosing a versioning strategy

9.4.1. Abandon-ship strategy

9.4.2. Single-shot strategy

9.4.3. Additive-change strategy

9.4.4. Tower of Babel strategy

9.4.5. Adapter strategy

9.4.6. The great-migration strategy

9.5. Applying versioning strategies

9.5.1. Managing safe, additive changes

9.5.2. Handling required breaking change

9.6. DSL versioning in the real world

9.6.1. Versioning Brail

9.6.2. Versioning Binsor

9.6.3. Versioning Rhino ETL

9.7. When to version

9.8. Summary

Chapter 10. Creating a professional UI for a DSL

10.1. Creating an IDE for a DSL

10.1.1. Using Visual Studio as your DSL IDE

10.1.2. Using #develop as your DSL IDE

10.2. Integrating an IDE with a DSL application

10.2.1. Extending #develop highlighting for our DSLs

10.2.2. Adding code completion to our DSL

10.2.3. Adding contextual code completion support for our DSL

10.3. Creating a graphical representation for a textual DSL

10.3.1. Displaying DSL execution

10.3.2. Creating a UI dialect

10.3.3. Treating code as data

10.4. DSL code generation

10.4.1. The CodeDOM provider for Boo

10.4.2. Specific DSL writers

10.5. Handling errors and warnings

10.6. Summary

Chapter 11. DSLs and documentation

11.1. Types of documentation

11.2. Writing the Getting Started Guide

11.2.1. Begin with an introduction

11.2.2. Provide examples

11.3. Writing the User Guide

11.3.1. Explain the domain and model

11.3.2. Document the language syntax

11.3.3. Create the language reference

11.3.4. Explain debugging to business users

11.4. Creating the Developer Guide

11.4.1. Outline the prerequisites

11.4.2. Explore the DSL’s implementation

11.4.3. Document the syntax implementation

11.4.4. Documenting AST transformations

11.5. Creating executable documentation

11.6. Summary

Chapter 12. DSL implementation challenges

12.1. Scaling DSL usage

12.1.1. Technical—managing large numbers of scripts

12.1.2. Performing precompilation

12.1.3. Compiling in the background

12.1.4. Managing assembly leaks

12.2. Deployment—strategies for editing DSL scripts in production

12.3. Ensuring system transparency

12.3.1. Introducing transparency to the Order-Processing DSL

12.3.2. Capturing the script filename

12.3.3. Accessing the code at runtime

12.3.4. Processing the AST at runtime

12.4. Changing runtime behavior based on AST information

12.5. Data mining your scripts

12.6. Creating DSLs that span multiple files

12.7. Creating DSLs that span multiple languages

12.8. Creating user-extensible languages

12.8.1. The basics of user-extensible languages

12.8.2. Creating the Business-Condition DSL

12.9. Summary

Chapter 13. A real-world DSL implementation

13.1. Exploring the scenario

13.2. Designing the order-processing system

13.3. Thinking in tongues

13.4. Moving from an acceptable to an excellent language

13.5. Implementing the language

13.5.1. Exploring the treatment of statement’s implementation

13.5.2. Implementing the upon and when keywords

13.5.3. Tracking which file is the source of a policy

13.5.4. Bringing it all together

13.6. Using the language

13.7. Looking beyond the code

13.7.1. Testing our DSL

13.7.2. Integrating with the user interface

13.7.3. Limited DSL scope

13.8. Going beyond the limits of the language

13.9. Summary

Appendix A. Boo basic reference

A.1. Prerequisites

A.2. The Boo interactive shell, interpreter, and compiler

A.2.1. Expressions

A.2.2. Boolean values and Boolean expressions

A.3. Comments

A.4. Control statements

A.4.1. If statement

A.4.2. While statement

A.4.3. For statement

A.5. Types

A.5.1. Lists

A.5.2. Range

A.5.3. Arrays

A.5.4. Hashes

A.5.5. Strings

A.5.6. Slicing

A.5.7. Declaring types explicitly

A.6. Creating real programs

A.6.1. Methods

A.6.2. Classes and objects

A.6.3. Imports

A.7. Generators

Appendix B. Boo language syntax

B.1. Interesting keywords

B.2. Conditionals

B.3. Loops and iterations

B.4. Type declarations

B.5. Methods, properties, and control structures

B.6. Useful macros

Index

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.214.215