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.
# build the compiler
cargo install --locked --path crates/driver/host --bin hopper
Psst… feed me your cursor.
fn AddTwo(value: i32) -> i32 { return value + 2;}fn main() -> i32 { return AddTwo(40);}Running…
You write a program.
Scroll to follow one small program through Hopper. Each band points back to its source.
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.
fn main() -> i32 { let mut count = 1; let view = &count; let change = &mut count; change.* = 2; return view.*;}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.
Moves and borrows, checked
A struct moves when it is passed, and a
&mutborrow cannot overlap a reference still in use. The compiler finds both before the program runs.Constants at compile time
constvalues, and the expressions that use them, are worked out while compiling. The compiler evaluates them with the same MIR interpreter used by the playground.Checks that stay on
Runtime array indexes are checked before access. The interpreter and LLVM use the same checked program.
Editor-aware diagnostics
See diagnostics, type information, definitions, and rename in the language server.
An editor that keeps up
The language server re-checks only the modules an edit affects, and keeps answering while the code is broken.
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.
fn main() -> i32 { let mut total = 0; for n in 1..=6 { total = total + n; } return total + total;}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.
# get the source
git clone https://github.com/HopperLanguage/hopper.git hopper && cd hopper
# build and install the command
cargo install --locked --path crates/driver/host --bin hopper
# 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.