🚀 DAY 5 OF LAUNCH WEEK:Introducing Webhook Events for Alert Changes.Learn more →
Socket
Book a DemoInstallSign in
Socket

langium-statemachine-dsl

Package Overview
Dependencies
Maintainers
3
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

langium-statemachine-dsl

Example language built with Langium

latest
Source
npmnpm
Version
4.1.0
Version published
Maintainers
3
Created
Source

State Machine Example

Generator CLI

The State Machine Example features a generator that you can run via cli.

  • Ensure the complete project was properly built, otherwise run npm install once in the root of the Langium project. That is enough, since we use npm workspaces to manage all of our npm projects as one monorepo.
  • Run npm run build (again in the root directly) to actually generate the JavaScript code from the TypeScript sources.
  • Use node ./bin/cli from the statemachine directory to run the cli. Follow the instructions or use node ./bin/cli generate <full-path-to-statemachine-file>, e.g.
cd examples/statemachine
node ./bin/cli generate example/trafficlight.statemachine

produces this result:

C++ code generated successfully: generated/trafficlight.cpp

The generator produces a C++ cli to walk over the statemachine's states.

  • Run gcc <full-path-to-generated-cpp-cli> -lstdc++ -o cli to get the executable file cli.o.
  • Use ./cli to run the cli. Enter an event name to pass to the next state.

You also can use statemachine-cli as a replacement for node ./bin/cli, if you install the cli globally.

  • Run npm install -g ./ from the statemachine directory.
  • Use statemachine-cli to run the cli. Follow the instructions or use statemachine-cli generate <full-path-to-statemachine-file>.

VSCode Extension

Please use the VSCode run configuration "Run Statemachine Extension" to launch a new VSCode instance including the extension for this language. Afterwards, use the run configuration "Attach" to attach the debugger to the running language server.

FAQs

Package last updated on 19 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts