Engineering of Domain-Specific Languages

3 ECTS

Editions: 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026

Course offered in the following programs:
  • Master in Software and Data Engineering (Core course, 2017-2025)
  • Master in Software Engineering with AI (Core course, from 2026)
  • PhD programme of the Faculty of Informatics (Elective)

Description. Domain-Specific Languages (DSLs) are programming languages that are tailored to a particular application domain. This essential focus of DSLs allows one to write more concise and understandable programs, with tight stakeholder integration, and, when done properly, to improve code quality. The course will feature the current state of the art in both the design and implementation of DSLs. The course will emphasize the different design dimensions of DSLs, the involved language paradigms and features, and the drawbacks with respect to simple API modeling.

Course Topics

The course teaches how to engineer domain-specific languages (DSLs), using Scala 3 as a support language. Throughout the course, the students learn both the concepts behind DSLs and the (functional) programming language techniques typically used to design them.

The course has five parts, each one lasting two to three weeks. The first three parts correspond to the first three assignments of the course:

  • In the first introductory part, we discuss domain data modeling and fluent APIs, in particular by focusing on the contrast with classic command-query APIs;
  • Then, we introduce techniques for designing external DSLs, using parsing expression grammars;
  • After that, we introduce design techniques for internal DSLs, discussing how fluent APIs can be made more effective with specific programming language features that are available in certain languages.

The final two parts are alternatives, meaning that the student can choose to submit an assignment for either one of the two:

  • generative DSLs, where we see how macros and other metaprogramming techniques can be used to support the advanced design of DSLs;
  • IDE features for external DSLs, where we see how to build an extension for Visual Studio Code using Scala.js to give support for DSLs in the IDE.

Student Evaluations

The reported student evaluations for each course are always instructor-specific, so these are always related to me, even if there are other instructors.

6 June 2023 Developer Talk

Teaching Domain Specific Languages in Scala

Scala Days Seattle 2023