Creation Review

Type
Creation
State
Successful
End Date of the Review Period

Reviews run for a minimum of one week. The outcome of the review is decided on this date. This is the last day to make comments or ask questions about this review.

Project
Proposal

Eclipse Langium

Wednesday, May 24, 2023 - 08:23 by Miro Spönemann
This proposal is in the Project Proposal Phase (as defined in the Eclipse Development Process) and is written to declare its intent and scope. We solicit additional participation and input from the community. Please login and add your feedback in the comments section.
Project
Parent Project
Proposal State
Created
Background

Eclipse Xtext was created by the founders of TypeFox and used to be the main focus of our business. In 2017, we started the development of web-based technologies such as Theia and Sprotty, both of which were moved to the Eclipse Foundation. We continued to integrate domain-specific languages (DSLs) in such web-based applications by running Xtext in a Java backend. After a while we realized the huge potential of creating DSLs with a purely web-based technology stack, so we started the Langium project in 2021. It borrows many ideas from Xtext, but everything is reimplemented in TypeScript. We now want to bring this to the Eclipse Foundation to create a coherent ecosystem of tools that can be used in Eclipse Theia, VS Code, or arbitrary web apps.

Scope

Eclipse Langium provides a complete toolkit for implementing formal (domain-specific) languages in a web technology stack. The focus is on lowering the barrier to design, implement and integrate a language. This includes the following areas:

  • Define the concrete syntax and derive a parser for it
  • Define the abstract syntax and generate type definitions for it
  • A default language server according to the Language Server Protocol (LSP) with rich default functionality
  • Customization points to fine-tune all aspects of the language: linking, type system, validation, editor features, etc.
  • A library to interact with the language programmatically, e.g. to implement command line interfaces (CLIs) or automation services
  • Support for generating code and serializing documents
  • Integration with related tools such as diagram visualizations

Eclipse Langium explicitly does not include any text editing functionality, but relies on LSP to provide support for your language in a text editor (e.g. Eclipse Theia, VS Code, Monaco Editor, etc.)

Why Here?

Eclipse Langium fits well into the existing landscape of Eclipse projects, specifically those at the Eclipse Cloud Development top-level project and the Cloud Dev Tools working group. When packaged as a VS Code extension, Langium can be loaded into Eclipse Theia to run the extension in a custom cloud or desktop IDE. The Eclipse Langium project includes an integration with Eclipse Sprotty to derive graphical views from DSL content. By using JSON as an interchange format, Langium models can be transferred to a Java process to be consumed by tools based on the Eclipse Modeling Framework (EMF). More generally, Langium is an alternative to Eclipse Xtext, so consumers of the Eclipse tooling ecosystem can choose between two different platforms for implementing their DSLs. This also brings a clear perspective for migrating a Java-based application to the web.

The main value we expect for the Eclipse Langium project is vendor-neutral governance, enabling collaboration between multiple parties and increasing overall adoption.

Project Scheduling

We are currently at version 1.2.0 and are already working on a 2.0.0 release. We regard the project code as quite mature, so we expect a graduation review soon after the migration to Eclipse is done. The migration should not affect our release plan – there are currently no fixed dates or schedules for that, but the development on new versions is going forward steadily.

Future Work

The core part of the Eclipse Langium framework works well and is being used in production by many. We currently have the following ideas to extend the framework:

  • Develop a library to ease the implementation of type systems, including type inference and assignability checking.
  • Extend the capabilities of the grammar language to further simplify the specification of the language syntax and structure.
  • Implement a generic serializer capable of transforming an in-memory AST representation to a string.

We also want to grow the community both in the Eclipse ecosystem and beyond it. We are going to submit presentations at various conferences, including of course EclipseCon.

Description

Eclipse Langium is a toolkit for domain-specific languages (DSLs) that is fully built with TypeScript. It provides a text parser with integrated cross-reference resolution and a language server for smart editor support. You can use Langium to build custom text languages that can be automatically processed. For example, you can execute user-defined behavior with an interpreter, or generate executable code, documentation, or other output formats. Such a custom language can

  • empower non-technical persons to provide data, logical constraints, executable behavior, or similar concepts,
  • greatly reduce the manual effort to create artifacts such as source code or documentation,
  • strengthen the communication between stakeholders with a formal language.

Eclipse Langium aims to enable DSL development in a web-based technology stack. When used in the context of a desktop app (e.g. VS Code, Eclipse IDE, etc.), Langium runs on the Node.js platform. Additionally, it can run in a web browser to add language support to web applications with embedded text editors (e.g. Monaco Editor). The interface between Langium and the text editor is the Language Server Protocol (LSP).

The entry point of a Langium project is the grammar language – similarly to how Eclipse Xtext works. A grammar file describes the concrete syntax by instructing the parser how to read input text, and also the abstract syntax by defining object types and their properties. The resulting abstract syntax tree (AST) is created by the parser that Langium provides based on the grammar declaration. The AST is the basis for all further operations, including cross-reference resolution, validation, code generation and much more.

In addition to editor support through LSP, a Langium-based language implementation can be used as a library to implement automation processes: interpret (execute) language instances, generate different artifacts, transform into specific modeling formats, and so forth – there are vast possibilities that can be explored depending on your project context and the specific problems you would like to address.

Initial Contribution

The initial contribution will be made with two repositories: langium and langium-website. The copyright is at TypeFox. The license has been MIT from the beginning of the project. There is already a fairly large community of adopters around the project: ~400 stars on GitHub and ~4000 downloads per week on the npm registry. There have been contributions to the project code from the community, but the vast majority of development was made by TypeFox employees.

Source Repository Type