Eclipse Langium is a TypeScript based language engineering tool that enables you to implement Domain-Specific Languages (DSLs) in Eclipse Theia, VSCode, web applications and other surroundings.
In this tutorial for beginners, you will learn why you might want to create your own language and how to use Langium to bring it to life. We will show you a set of out-of-the-box solutions for the complex requirements of building a programming language. Moreover, you will be introduced to the customization of the different aspects.
The tutorial provides a short example-based introduction to DSLs, challenges of language implementation, and Langium. We are going to emphasise the centerpiece of Langium: The grammar language.
Here the hands-on part of the tutorial starts and you will write a Langium grammar for an example language. You can experience all the aspects Langium provides for you: You do not have to care about implementing a parser, a semantic model, cross references and linking, as well as workspace management and editing support, like syntax highlighting and code navigation.
Of course, learning only stops there in case you are satisfied with Langium’s default language support.
We will lead you beyond that with the goal to derive a working web application from the DSL. You can try your hand in implementing a code generator for this task. It will be written in TypeScript using the new Code Generation support for Langium introduced in May 2023. After this step you will be able to execute your DSL.
Next, you can train how to write a custom validator that extends the ready-made Langium validation and provides tailored early feedback for the user.
- node.js - For new installations download and install the current LTS version of node.js (18) from https://nodejs.org/en/download for your preferred operating system. You need at least version 12 in case you want to use an existing installation.
- vscode - Download and install VS Code for your preferred operating system from https://code.visualstudio.com/download
- Install the Langium VS Code extension: Type “Langium” in the Extensions tab of your VSCode installation. You can also get it using this link: https://marketplace.visualstudio.com/items?itemName=langium.langium-vscode
- Checkout tutorial materials from https://github.com/TypeFox/EclipseCon2023-Tutorial
For spontaneous or unprepared participants we will provide USB sticks for Windows, MacOS and Linux with the above mentioned software and materials. Given a stable internet connection is available, a Gitpod workspace pre-configured with the required tools can be used.