Skip to content

rl-lang/rl-lang

RL

A statically-typed interpreted language written in Rust with a clean syntax, a TUI REPL, and a growing standard library.

Discord Rust License

Website Website

Last Commit Crates.io Crates.io Downloads GitHub Repo stars

Check CI Release

Quick look

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

Installation

From source

git clone https://github.com/rl-lang/rl-lang
cd rl-lang/crates/rl-cli
cargo build --release
# binary at target/release/rl

Via cargo install

cargo install rl-cli

Via releases

from releases you can choose nightly builds or the latest build

Usage

Firstly i highly suggest using the docs command

rl docs

# for TUI mode
rl docs --tui

for 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.rl

Documentation

Full language reference and stdlib documentation is available on the wiki.

Editor support

VS Code

Tree-sitter

A Tree-sitter grammar is available at rl-lang/tree-sitter-rl for editors that support it (Neovim, Helix, Zed, etc.).

Benchmarks

Criterion benchmarks live in crates/rl-benches. Run with:

cargo bench

Development

cargo test --all-features   # full test suite
cargo clippy -- -D warnings # lints
cargo bench                 # criterion benchmarks

Feature flags:

Flag State Description
run On by default -
eval On by default This flag for actually running the code ( weather in interpreter or `vm )
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-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

Contributors

Mohamed Gonem
Mohamed Gonem

πŸ’» πŸ“– πŸ€” ⚠️ πŸ’‘ πŸš‡ πŸ”§
Flawlesscode
Flawlesscode

πŸ’»
Mustapha Boutoub
Mustapha Boutoub

πŸ’»
RubyPaws39
RubyPaws39

πŸ’»
Anirudh Patwal
Anirudh Patwal

πŸ’»
Naimish
Naimish

πŸ’»

License

Licensed under either of MIT or Apache 2.0 at your option.

About

Fast to write. Simple to read. Built in Rust from the ground up.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages