Skip to main content
Version: 0.9.0

Quickstart

This page gives you the shortest path from a blank file to a running Metel program.

1. Build the interpreter

From the metel repository, build the interpreter first:

cd metel-interpreter
cargo build --release
tip

One-Time Setup

You only need to rebuild after changing the interpreter itself. For ordinary language experiments, reuse the existing build.

2. Write a program

Create a file such as hello.mtl:

fun main() {
println("hello, Metel");
}

3. Run it

Use the interpreter on the file path:

cargo run -- path/to/hello.mtl
note

Fast Iteration

Use cargo run -- ... while you are iterating quickly. Keep the release build from step 1 when you want the fastest repeated runs.

If you are just testing changes, cargo run -- is enough. If you want the fastest repeated run, keep the release build from step 1 and point the interpreter at the file you want to execute.

Multi-file programs

Split your program across files using import. Each file is a module; the :: separator maps directly to / on the filesystem:

src/
main.mtl
utils.mtl
// src/main.mtl
import utils::greet;

fun main() {
greet("world");
}
// src/utils.mtl
pub fun greet(name: String) {
println("hello, " + name);
}

One naming rule to know: the top-level name std is reserved for the standard library. Do not name your own modules std — a file called std.mtl at the project root will cause a compile error. Any other name is fine.

See the Modules reference for the full path syntax.

What next