Home > Store

Software Language Engineering: Creating Domain-Specific Languages Using Metamodels

Register your product to gain access to bonus material or receive a coupon.

Software Language Engineering: Creating Domain-Specific Languages Using Metamodels


  • Sorry, this book is no longer in print.
Not for Sale


  • Copyright 2009
  • Edition: 1st
  • Book
  • ISBN-10: 0-321-55345-4
  • ISBN-13: 978-0-321-55345-4

Software practitioners are rapidly discovering the immense value of Domain-Specific Languages (DSLs) in solving problems within clearly definable problem domains. Developers are applying DSLs to improve productivity and quality in a wide range of areas, such as finance, combat simulation, macro scripting, image generation, and more. But until now, there have been few practical resources that explain how DSLs work and how to construct them for optimal use.

Software Language Engineering fills that need. Written by expert DSL consultant Anneke Kleppe, this is the first comprehensive guide to successful DSL design. Kleppe systematically introduces and explains every ingredient of an effective

language specification, including its description of concepts, how those concepts are denoted, and what those concepts mean in relation to the problem domain. Kleppe carefully illuminates good design strategy, showing how to maximize the flexibility of the languages you create. She also demonstrates powerful techniques for creating new DSLs that cooperate well with general-purpose languages and leverage their power.

Completely tool-independent, this book can serve as the primary resource for readers using Microsoft DSL tools, the Eclipse Modeling Framework, openArchitectureWare, or any other DSL toolset. It contains multiple examples, an illustrative running case study, and insights and background information drawn from Kleppe’s leading-edge work as a DSL researcher.

Specific topics covered include

  • Discovering the types of problems that DSLs can solve, and when to use them
  • Comparing DSLs with general-purpose languages, frameworks, APIs, and other approaches
  • Understanding the roles and tools available to language users and engineers
  • Creating each component of a DSL specification
  • Modeling both concrete and abstract syntax
  • Understanding and describing language semantics
  • Defining textual and visual languages based on object-oriented metamodeling and graph transformations
  • Using metamodels and associated tools to generate grammars
  • Integrating object-oriented modeling with graph theory
  • Building code generators for new languages
  • Supporting multilanguage models and programs

This book provides software engineers with all the guidance they need to create DSLs that solve real problems more rapidly, and with higher-quality code.

Sample Content

Online Sample Chapter

Why Software Language Engineering?

Sample Pages

Download the sample pages

Table of Contents

Background Information  xvii

Preface    xix

Foreword  xxvii

Chapter 1: Why Software Language Engineering?   1

1.1 An Increasing Number of Languages 1

1.2 Software Languages  3

1.3 The Changing Nature of Software Languages   4

1.3.1 Graphical versus Textual Languages   5

1.3.2 Multiple Syntaxes 6

1.4 The Complexity Crisis    7

1.5 What We Can Learn From ...    8

1.5.1 Natural-Language Studies    9

1.5.2 Traditional Language Theory 10

1.5.3 Graph Theory 10

1.6 Summary   12

Chapter 2: Roles in Language Engineering   15


2.1 Different Processes, Different Actors  15

2.2 The Language User   16

2.2.1 Tool Set of the Language User   17

2.3 The Language Engineer    19

2.3.1 Tool Set for the Language Engineer   19

2.3.2 Tool Generators   20

2.4 Summary   21

Chapter 3: Languages and Mograms  23


3.1 What Is a Language? 23

3.1.1 Mogram, or Linguistic Utterance 24

3.1.2 Primitive Language Elements and Libraries 26

3.2 Abstraction Levels and Expressiveness  27

3.2.1 Abstract versus Incomplete  29

3.2.2 Raising the Level of Abstraction 29

3.2.3 Growing Business Expectations   31

3.2.4 Languages and Abstraction Levels 32

3.3 Domain-Specific Languages     33

3.3.1 Domain-Specific versus General Languages  33

3.3.2 Domain Experts versus Computer Experts    33

3.3.3 Large User Group versus Small User Group  34

3.3.4 Horizontal DSLs versus Vertical DSLs 35

3.3.5 DSLs versus Frameworks and APIs 37

3.3.6 DSLs as Software Languages  37

3.4 Summary   38

Chapter 4: Elements of a Language Specification 39

4.1 Language Specification   39

4.1.1 Forms of a Mogram 40

4.1.2 Parts   41

4.1.3 Creation Process  42

4.1.4 An Example   43

4.2 Formalisms to Specify Languages   47

4.2.1 Context-Free Grammars  47

4.2.2 Attributed Grammars    49

4.2.3 Graph Grammars    51

4.2.4 UML Profiling 52

4.2.5 Metamodeling 53

4.2.6 Formalism of Choice    53

4.3 Summary   54

Chapter 5: Metamodeling      57


5.1 Foundations of Metamodeling   57

5.1.1 Graphs  58

5.1.2 Models and Instances   61

5.1.3 Constraint Types  62

5.1.4 UML Diagrams as Notation    66

5.1.5 Metamodels   68

5.2 Relation with Model-Driven Approaches  69

5.2.1 How to Understand the Term Platform  69

5.2.1 Transformations and Language Specifications    70

5.3 Summary   73

Chapter 6: Abstract Syntax   75


6.1 The Pivotal Role of Abstract Syntax    75

6.1.1 The Hidden, Underlying, Unifying Structure     75

6.1.2 The Gateway to Semantics    76

6.2 Mogram/Language Relationship  77

6.2.1 Abstract Form of a Mogram   78

6.2.2 Concrete form of a Mogram   78

6.2.3 Syntactically, Not Semantically, Correct  79

6.2.4 Syntactically Incorrect Mograms 80

6.3 How to Create an Abstract Syntax Model 80

6.3.1 Domain Modeling for Vertical DSLs    81

6.3.2 Pattern Finding for Horizontal DSLs  82

6.4 Alan: An Example Language     83

6.4.1 Introducing Alan  83

6.4.2 The Observer Pattern in Alan    84

6.4.3 Generic Types in Alan  85

6.4.4 Alan’s Standard Library     86

6.5 Alan’s Abstract Syntax Model  86

6.5.1 Types   86

6.5.2 Expressions  87

6.5.3 The Observer Pattern   89

6.5.4 The Library  90

6.6 Summary   90

Chapter 7: Concrete Syntax    93

7.1 Concrete Syntax and Tool Support  93

7.1.1 Phases in the Recognition Process    94

7.1.2 Two Types of Editors   100

7.1.3 The Textual-Graphical Mismatch, or Blind Spots 101

7.2 Concrete Syntax Model    104

7.2.1 Guidelines for Creating a Concrete Syntax Model     105

7.2.2 Alan’s Graphical Syntax Model   106

7.3 Summary   110

Chapter 8: Generating Textual Concrete Syntax   113


8.1 The Grasland Generator   113

8.2 The Abstract-to-Concrete Transformation 117

8.2.1 Handling References    117

8.2.2 Alan’s Textual Concrete Syntax Model 118

8.2.3 Designer Input to the asm2tcsm  Transformation 120

8.3 The Model-to-BNF Grammar Algorithm 121

8.3.1 Generation of the BNFset    121

8.3.2 Designer Input to the tcsm2bnf   Transformation     122

8.4 The Static Semantic Analyzer  126

8.4.1 Binding 126

8.4.2 Checking 128

8.5 Summary   129

Chapter 9: Semantics: The Meaning of Language   131


9.1 Semantics Defined   131

9.1.1 Understanding Is Personal   131

9.1.2 The Nature of a Semantics Description 133

9.2 Semantics of Software Languages   134

9.2.1 Ways to Describe Semantics  135

9.2.2 The “Best” Semantics   138

9.3 Operational Semantics Using Graphs 138

9.3.1 Modeling Semantics     139

9.3.2 Consequences of the Von Neumann Architecture   140

9.3.3 States in the Abstract Machine  142

9.3.4 The Rules of Execution: Transitions  143

9.3.5 Example: Simple Semantics   144

9.4 Summary   148

Chapter 10: Translational Semantics: Code Generation 149


10.1 Code Generation and Language Design   149

10.1.1 Abstraction Levels    150

10.1.2 Multiple Semantics    150

10.2 Building a Code Generator    151

10.2.1 Hard-Coded or Model-Transformation Rules 151

10.2.2 Source-Driven or Target-Driven Translation    153

10.2.3 Concrete or Abstract Form Target    154

10.2.4 A Template Language Targeting Abstract Form   157

10.3 Code-Generation Patterns     158

10.3.1 Treewalkers, or the Visitor Pattern 158

10.3.2 CreateOrFind 159

10.3.3 Mappers 160

10.4 Extension Points in the Generated Code 161

10.5 Other Issues in Code Generation  163

10.5.1 Bidirectionality 163

10.5.2 Target Platform with or without Framework     164

10.5.3 Modularization of the Generation    167

10.5.4 Built-in Flexibility  167

10.6 Summary  169

Chapter 11: Combining Multiple Languages   171


11.1 Multiple Mograms for One Application  171

11.1.1 Advantages of Multiple Mograms 172

11.1.2 Multiple Mograms: One or More Languages  172

11.2 Intermogram References  173

11.2.1 Hard and Soft References   173

11.2.2 Passive and Active Languages   174

11.2.3 Information Hiding    175

11.3 Language Interfaces     176

11.3/1 Offered or Required Language Interface   177

11.4 Consequences for Language User Tool Set    179

11.4.1 Resolving and Checking References   179

11.4.2 Handling Changes 180

11.4.3 Code Generation  181

11.5 Support for Language Evolution   182

11.6 Conclusion    183

11.7 Summary  183

Appendix A Glossary     185

Appendix B References   189

Index     197


Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020