In development

Systems code,checked before it runs.

Hopper is an experimental systems programming language. Its compiler checks types, paths, moves and borrows, then builds a native program through LLVM, on Linux, macOS and Windows.

terminal

# build the compiler

cargo install --locked --path crates/driver/host --bin hopper

Psst… feed me your cursor.

src/main.hop
fn AddTwo(value: i32) -> i32 {
return value + 2;
}
fn main() -> i32 {
return AddTwo(40);
}
terminal

Running…

You write a program.

Scroll to follow one small program through Hopper. Each band points back to its source.

src/main.hop

Errors

Errors that point at the cause

Hopper reports the conflicting borrow in the browser. The command line can also show the related source locations.

  • The browser points to the second borrow, where the conflict is detected.
  • The command line also labels the original borrow and its last use.
  • The editor uses the same checker as the command line.
src/main.hop
fn main() -> i32 {
let mut count = 1;
let view = &count;
let change = &mut count;
change.* = 2;
return view.*;
}
terminal

hopper check demo src

Running…

What you get

A compiler that has your back

Hopper is young, but its checks are already strict. Here is what the compiler does for every program today.

  1. Moves and borrows, checked

    A struct moves when it is passed, and a &mut borrow cannot overlap a reference still in use. The compiler finds both before the program runs.

  2. Constants at compile time

    const values, and the expressions that use them, are worked out while compiling. The compiler evaluates them with the same MIR interpreter used by the playground.

  3. Checks that stay on

    Runtime array indexes are checked before access. The interpreter and LLVM use the same checked program.

  4. Editor-aware diagnostics

    See diagnostics, type information, definitions, and rename in the language server.

  5. An editor that keeps up

    The language server re-checks only the modules an edit affects, and keeps answering while the code is broken.

  6. Native on three systems

    Native builds and debug-symbol generation are tested on Linux, macOS, and Windows with Clang.

The language

Small, explicit, readable

One loop keyword, values that move, and references you write out. Each example runs in the browser.

src/main.hop
fn main() -> i32 {
let mut total = 0;
for n in 1..=6 {
total = total + n;
}
return total + total;
}
terminal

hopper run demo src

Running…

More in the language tour.

Get started

Build it or try it online

Use the browser playground with no install, or build from source with Rust. Native executables also need Clang.

terminal
  1. # get the source

    git clone https://github.com/HopperLanguage/hopper.git hopper && cd hopper

  2. # build and install the command

    cargo install --locked --path crates/driver/host --bin hopper

  3. # run the sample with the interpreter

    hopper run demo tests/run

  • Linux CI tested
  • macOS CI tested
  • Windows CI tested

Psst… feed me your cursor.

Hopper is young. Help shape it.

The language changes quickly while it is pre-release. Read how the compiler works, try the examples, and open an issue for what you find.