A statically-typed interpreted language written in Rust with a clean syntax, a TUI REPL, and a growing standard library.
get println, len from std::io
get pow, mod, factorial, fibonacci, is_prime from std::math
get PI from std::math::consts
fn collatz(int n) {
dec int steps = 0
while (n != 1) {
if (mod(n, 2) == 0) {
n = n / 2
} else {
n = n * 3 + 1
}
steps += 1
}
return steps
}
println(factorial(10)) // 3628800
println(fibonacci(15)) // 610
println(is_prime(97)) // true
println(collatz(27)) // 111
dec float r = 5.0
println(PI() * pow(r, 2.0)) // 78.53981633974483
Prebuilt binaries are published for every release. The install script downloads the build you pick (or the latest stable) and puts it on your PATH.
Linux / WSL (installs to $HOME/.local/bin; set RL_INSTALL_DIR to override):
curl -fsSL https://raw.githubusercontent.com/rl-lang/rl-lang/main/install.sh -o install.sh
bash install.shAndroid (Termux) - works the same way on aarch64 devices (install script detects Termux and downloads the Android build):
curl -fsSL https://raw.githubusercontent.com/rl-lang/rl-lang/main/install.sh -o install.sh
bash install.shNon-interactively (install the standard rl build of v1.0.0):
RL_VARIANT=rl bash install.sh v1.0.0Windows (PowerShell) (installs to %LOCALAPPDATA%\rl-lang\bin and adds it to your user PATH - restart your terminal afterwards):
Invoke-WebRequest https://raw.githubusercontent.com/rl-lang/rl-lang/main/install.ps1 -OutFile install.ps1
.\install.ps1Available builds include rl (treewalker + VM), rlc (VM-only), rlp (treewalker-only), and rlsp (language server). Debug variants are suffixed with d (e.g. rld).
git clone https://github.com/rl-lang/rl-lang
cd rl-lang/crates/rl-cli
cargo build --release
# binary at target/release/rlcargo install rl-clifrom releases you can choose nightly builds or the latest build
Firstly i highly suggest using the docs command
rl docs
# for TUI mode
rl docs --tuifor using the compiled rl binary
# to check available commands
rl -h
# or
rl --help
# to start a new project
rl new example-project
# in project root you can run it via
rl dev
# or run the file directly
rl run src/main.rlFull language reference and stdlib documentation is available on the wiki.
- Install the rl-lang extension for syntax highlighting in
.rlfiles. - Install the rl-lang runner extension to run and check files from the editor.
- Install the rl-lang LSP extension for diagnostics and hover.
A Tree-sitter grammar is available at rl-lang/tree-sitter-rl for editors that support it (Neovim, Helix, Zed, etc.).
Criterion benchmarks live in crates/rl-benches. Run with:
cargo benchcargo test --all-features # full test suite
cargo clippy -- -D warnings # lints
cargo bench # criterion benchmarksFeature flags:
| Flag | State | Description |
|---|---|---|
run |
Off by default |
- |
eval |
Off by default |
Deprecated alias for treewalker |
treewalker |
Off by default |
This flag for the treewalker backend (enabled in release builds) |
vm |
On by default |
This flag for vm backend |
cranelift |
Off experimental |
This flag for cranelift backend used for native compilations |
repl |
On by default |
This flag for the interactive TUI shell REPL |
docs |
On by default |
This flag for the rl-docs documentation tooling |
docs-tui |
On by default |
This flag for the interactive TUI mode for browsing rl-docs |
debug |
Off by default |
This flag for logging and debugging purposes |
lsp |
Off by default |
This flag for language server protocol used by IDEs and other editors |
Licensed under either of MIT or Apache 2.0 at your option.