Implementing Domain-Specific Languages with JetBrains MPS

A Domain-Specific Language (DSL) is a programming language specifically designed for a particular (narrow) domain. DSLs can increase the productivity of programming in many ways: by offering concise programming notations, reducing the number of defects, improving communication between developers and business experts, and so on.

Implementing a DSL traditionally required defining a parser for it, often using a parser generator. What often remains overlooked is a powerful IDE for a language, despite the fact that it is keystone to adoption and success of a DSL. Recently, tools designed to define DSLs together with their IDEs have appeared under the name of language workbenches.

In this introductory tutorial, I will talk about language workbench JetBrains MPS. It supports projectional (structured) editing, an alternative to mainstream text-based editing that allows overcoming the limits of language parsers and enables domain experts to program. JetBrains MPS allows defining editors supporting textual, tabular and graphical notations.

More information about the content of the tutorial can be found here: http://dsl-course.org/abz2020

Outline

The tutorial will take place co-located to ABZ2021 (virtual) on 08.06.2021.

Session 1 (Tuesday, 08.06.21, 9:00 - 10:30 (GMT+2))

We will start with a zoo of domain-specific languages (formatting languages, query languages, Scratch-like languages, business process languages), and discuss advantages and problems connected to DSL use. This will be followed by an overview of features expected from an Integrated Development Environment (IDE) for a successful practical adoption of a language. We will then explore projectional editing and see how user code is represented in JetBrains MPS. A running example (“Entities Language”) will be introduced and partly designed together with the audience.

Session 2 (Tuesday, 08.06.21, 11:00 - 12:30 (GMT+2))

During this hands-on session, we will implement an editor for Entities Language, a simple type checker, and explore how MPS handles code generation as model-to-text and model-to-model transformations. By the end of the session, each participant will have a working IDE for Entities Language that will support editing code, informing language users about type checking results and providing intentions and quickfixes for code.

Requirements

To follow the tutorial, participants are expected to bring their laptops and to have JetBrains MPS installed. MPS can be downloaded via this link: https://www.jetbrains.com/mps

Organiser