Skip to content

Repository files navigation

models-2026-langium-demo

Demo DSL for the Tools&Demo track @ MODELS'26

Workspace overview

This project contains the implementation of the demo DSL for the demo of "Langium: A TypeScript-Based Language Workbench for Domain-Specific Languages" by Johannes Meier, Steven Smyth, Benjamin F. Wilson, and Insa Fuhrmann at the "Tools and Demonstrations" track at the MODELS 2026.

The TypeScript code for the example is structured into these packages:

Some files are contained in the root directory as well:

Langium grammar

The grammar for the demo DSL is written in the Langium grammar language in the packages/language/src/hello-world.langium file:

grammar ExampleDSL

entry Model: statements+=(Variable | Assignment | Struct)*;

Variable: (isInteger='int' | structType=[Struct:ID]) name=ID ';';

Assignment: access=VariableAccess '=' value=Addition ';';
VariableAccess: variable=[Variable:ID] ('.' property=[Property:ID])?;

Addition:
	Multiplication ({infer BinaryExpr.left=current}
    operator=('+' | '-') right=Multiplication)*;

Multiplication:
	Exponentiation ({infer BinaryExpr.left=current}
    operator=('*' | '/') right=Exponentiation)*;

Exponentiation:
	Primary ({infer BinaryExpr.left=current}
    operator='^' right=Exponentiation)?;

Primary: Parentheses | IntegerLiteral | VariableAccess;
Parentheses: '(' expr=Addition ')';
IntegerLiteral: value=INTEGER;

Struct: 'struct' name=ID '{' properties+=Property* '}';
Property: name=ID ';';

terminal INTEGER returns number: /[0-9]+(\.[0-9]+)?/;
terminal ID: /[_a-zA-Z][\w_]*/;

hidden terminal WS: /\s+/;
hidden terminal ML_COMMENT: /\/\*[\s\S]*?\*\//;
hidden terminal SL_COMMENT: /\/\/[^\n\r]*/;

Run the example

Read this guide how to start the editor for the demo DSL. It is started as VS Code extension and should look like this:

VS Code screenshot

About

Demo DSL for the Tools&Demo track @ MODELS'26

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages