Skip to content

Latest commit

 

History

History
34 lines (20 loc) · 1.53 KB

README.md

File metadata and controls

34 lines (20 loc) · 1.53 KB

Langium Lox

This repository contains a Langium based implementation of the Lox language.

How to build

Langium requires Node.js >=20 and npm >=10 (we recommend using Volta to ensure your node & npm always match). Once you have those requirements installed, you can build the language using:

npm install

Then either use npm run watch or npm run watch depending on your needs.

This will automatically compile the language and other sources. Afterwards you can run the language using the Run Extension vscode launch config.

The examples/basic.lox file contains a small sample of what the language is capable of. Try it out!

How does it work

The langium grammar contains all of the magic necessary to make the Lox language run in vscode.

It contains a grammar definition of the Lox language which is transformed into a parser for that language. Langium additionally provides advanced editor features, such as code completion, goto reference/find references, folding, and more.

Debugging the CLI

In VSCode open a JavaScript Debug Terminal and then execute the following command:

node ./langium/lib/interpreter/cli.js run ./examples/basic.lox