Skip to content
horacehoffPublic

About

Fast, statically-typed interpreted language that blends Rust-like syntax with Python's ease of use. 2-20x faster than Python, with type inference, monomorphization, and constant folding.

Topics

Resources

Contributing

Stars

106 stars

Watchers

3 watching

Forks

Repository files navigation

Keel logo Keel logo

Warning

Keel is under active development; there might be bugs!

Keel is an interpreted programming language whose goal is to provide a faster alternative to Python that sits closer to low-level languages while remaining accessible to a wide audience.

Keel is very fast: across the benchmarks, on average, Keel is ~8x faster than Python, and ~2.7x faster than LuaJIT (-joff).

Keel is statically-typed. It has full-type inference, supports optional annotations, and supports ad-hoc polymorphism through monomorphization.

Keel can call functions from dynamic libraries easily by declaring their signatures in a dylib block. Per-call overhead is ~3.5x lower than LuaJIT (-joff) and ~22x lower than Python.

Keel can be embedded in other programs through a C ABI. To do this, download the libkeel- artifacts in the release.

Website Documentation Install Keel Try Keel in your browser

Keel also has a VS Code extension that provides syntax highlighting.

Browse examples

Short example

struct Point { x: int, y: int }

fn add(a, b) {
    return a + b;
}

fn main() {
    let p = Point { x: 3, y: 4 };
    print(add(p.x, p.y)); // 7
    print(add("Hello, ", "world!")); // Hello, world!

    let nums = [4, 2, 6, 1, 7];
    if nums[0] == 4 {
        nums.sort();
        print(if nums[0] == 1 { nums[0..3] } else { -1 }); // [1,2,4]
    } else {
        throw("Error!");
    }
}

Installation

You can install Keel manually by downloading the desired version from the releases page, or use one of the following installation commands.

macOS / Linux

curl -fsSL https://raw.githubusercontent.com/horacehoff/keel/main/install.sh | sh

Windows

irm https://raw.githubusercontent.com/horacehoff/keel/main/install.ps1 | iex

Usage

keel program.kl    # Run a file
keel               # Start the REPL
keel -v/--version  # Print version
keel -h/--help     # Print help

Benchmarks

Benchmarks

Build from source (without PGO)

Make sure Rust is installed.

git clone https://github.com/horacehoff/keel && cd keel && rustup toolchain install && cargo build --release
./target/release/keel myfile.kl

Near-future roadmap

The roadmap can be found here.

Ad astra per aspera!

About

Fast, statically-typed interpreted language that blends Rust-like syntax with Python's ease of use. 2-20x faster than Python, with type inference, monomorphization, and constant folding.

Topics

Resources

Contributing

Stars

106 stars

Watchers

3 watching

Forks

Releases

Used by

Contributors

Languages