Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

143 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Osprey logo

Osprey Programming Language

Osprey is a functional language with inferred types, algebraic effects, fiber concurrency, and a choice of brace or ML layout syntax.

Osprey compiles through LLVM to native binaries and can also target WebAssembly. Osprey is alpha software.

Language features

  • One language, two flavors — Default (.osp) uses braces, fn, and parenthesized calls; ML (.ospml) uses layout, currying, and whitespace application. Both lower to the same program representation before type checking and code generation.
  • Inferred types — algebraic data types and pattern matching express state and failure without requiring every type annotation.
  • Algebraic effects — typed operations and lexical handlers separate an operation from its implementation.
  • Isolated fiber concurrency — fibers communicate through typed channels without a separate async fn kind.
  • Selectable memory management — native builds support the default non-reclaiming allocator, tracing garbage collection (--memory=gc) and Perceus reference counting (--memory=arc).
  • Native and WebAssembly output — native builds can call C through the FFI; C code remains outside Osprey's memory-safety guarantee.

Effect operation inputs and outputs are checked statically. Missing-handler and undeclared-row checks are incomplete, so an unhandled effect can produce a runtime diagnostic. Effect resumption is native-only.

Each file selects its flavor by extension, a source marker, or --flavor for a single-file build. Multi-file cross-flavor imports are unsupported.

Example

Default flavor:

type Lookup = Found { value: int } | Missing

fn doubleFound(result) = match result {
  Found { value } => Success((value * 2) ?: value)
  Missing => Error("value not found")
}

match doubleFound(Found { value: 21 }) {
  Success(value) => print("result: ${value}")
  Error(message) => print("error: ${message}")
}

ML flavor:

adder : int -> int -> Result<int, MathError>
adder a b = a + b

addTen = adder 10
answer = addTen 32 ?: 0

Executable language tests live in tests/.

Installation

Osprey invokes clang to compile and link native programs. Install LLVM/clang before installing the compiler.

# macOS
xcode-select --install
brew install nimblesite/tap/osprey

# Debian/Ubuntu; lld is also used for WebAssembly
sudo apt-get install -y clang llvm lld
brew install nimblesite/tap/osprey

# Windows
scoop bucket add nimblesite https://github.com/Nimblesite/scoop-bucket
scoop install osprey

Homebrew's LLVM package is keg-only. If Osprey cannot find clang, add $(brew --prefix llvm)/bin to PATH or set OSPREY_CC=$(brew --prefix llvm)/bin/clang.

See the installation guide for platform-specific verification and troubleshooting.

Build and test

make build
make test
make lint
make ci
make install

The compiler binary is written to target/release/osprey.

osprey program.osp --check
osprey program.osp --compile -o program
osprey program.osp --run
osprey program.osp --target=wasm32 --compile -o program.wasm

The WebAssembly target supports the portable runtime subset. Fibers, HTTP, WebSockets, the C FFI, processes and file I/O are not available on that target. See the WebAssembly specification and examples/wasm/ for details.

Documentation

The specifications define intended behavior. Individual chapters identify implementation gaps. The feature status page summarizes implementation limits.

About

A modern functional programming language designed for elegance, safety, and performance. Written in Rust, outputs to LLVM.

Resources

Contributing

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages