Guide 01

Getting started

Build the current Lume compiler from source, type-check a file, and run a small program. Lume is experimental, so the repository is currently the distribution.

Prerequisites

You need Git and a current Rust toolchain with Cargo. Java is only required when you use the Java source backend or build one of the Gradle integration examples.

Build Lume

Clone the public repository and build the lume package from its Rust workspace:

git clone https://github.com/sergey5d/lume-lang.git
cd lume-lang
cargo build --manifest-path rust/Cargo.toml -p lume

During development, the examples use cargo run so the local compiler is rebuilt when necessary.

Run your first program

Create hello.lum:

fn main() Unit = {
    language = "Lume"
    println("Hello, $language")
}

Type-check it first, then run it:

cargo run --manifest-path rust/Cargo.toml -p lume -- check ./hello.lum
cargo run --manifest-path rust/Cargo.toml -p lume -- run ./hello.lum

Understand the CLI

CommandPurpose
tokens file.lumPrint lexer tokens and source spans.
parse file.lumParse a file and print its syntax tree.
fmt file.lumValidate and format a source file in place.
definition file.lum --offset bytesReturn a compiler-resolved type definition as JSON for editor tooling.
check file.lumResolve modules and type-check the program.
run file.lumCheck, lower, and execute a Lume entry point.
gen file.lum --out dirValidate Lume and generate Java source.

The compiler reports source snippets and spans for parser, resolution, and type errors. Run check before generation when developing a module.

Explore checked examples

The examples/ directory is both a tour of the language and a regression suite. Successful examples contain expected output; failure examples lock targeted diagnostics.

./run_samples.sh
cargo test --manifest-path rust/Cargo.toml -p lume

Good starting points include classes, shapes, declared unions, and failure handling.

Install VS Code support

The repository includes syntax highlighting, formatting, and type-definition navigation for VS Code. Run the installer from the extension directory:

cd vscode-extension
./install.sh

Restart VS Code after installation, then open a .lum file. See the extension README for manual installation details.