Langium (IPA: /ˈlæŋɡiəm/, like language and equilibrium) is a language engineering tool for TypeScript with built-in support for the Language Server Protocol. The framework is an all-in-one solution for building programming languages, domain specific languages, code generators, interpreters and compilers. It serves as a spiritual successor to the Eclipse Xtext framework.
- Semantics First: Building on top of a grammar declaration language, Langium enables you to build the abstract model of your language in parallel to its syntax. Langium parsers are powered by Chevrotain.
- Lean by Default, Customizable by Design: Langium offers the infrastructure you need to build languages purely by defining their grammar. If that is not enough, you can fine tune every detail of your language using our dependency injection system.
- Write Once, Run Everywhere: By leveraging the flexibility of JavaScript and the Language Server Protocol, a language written using Langium can run in all kinds of IDEs and browsers or be embedded in CLIs and server applications.
Build your first language with Langium in our online playground.
Once you're ready to set up a project, you can use yeoman to generate a sample Langium project:
npm i -g yo generator-langium
yo langium
You can find the Langium documentation on the website.
If you're new to building programming language, take a look at our overview to see what Langium offers.
The documentation is divided into several sections:
The documentation website is hosted in this repository.
We host a number of simple examples in our main repo:
- arithmetics: How to create an expression language + interpreter.
- domainmodel: How to create a language with fully qualified name identifiers.
- requirements: How to create a Langium project with multiple languages.
- statemachine: How to create a code generator.
More complex examples are available as separate repositories in our GitHub organization:
- lox: Implementation of the Lox language from the popular book Crafting Interpreters.
- minilogo: Implementation of a logo language dialect. Shows how to integrate Langium in the browser.
If you want to contribute to Langium, please take a look at our contributing guide.
Langium is fully MIT licensed.