Olive is an indentation-based systems programming language. It compiles directly to native code via Cranelift, manages memory through compile-time inferred ownership without a garbage collector or lifetime annotations, and provides direct interop with C, Rust, and Python.
Every heap value has a single owner. Storing a value moves it when finished, or creates an independent copy when still in use. No hidden sharing, no lifetime annotations.
fn main():
let mut a = [1, 2]
let b = [a] // b stores its own copy of a
a[0] = 99
print(a[0]) // 99
print(b[0][0]) // 1, unchangedFunctions return values or error enums with |. The ? operator propagates errors, and match handles variants.
enum ParseError:
Invalid(str)
fn parse_port(s: str) -> int | ParseError:
let n = int(s)
if n <= 0 or n > 65535:
return Invalid(s)
return n
fn main():
let inputs = ["8080", "99999"]
for raw in inputs:
match parse_port(raw):
port:
print(f"Valid port: {port}")
Invalid(bad):
print(f"Invalid port: {bad}")Asynchronous tasks run on a cooperative event loop with share-nothing task boundaries.
async fn fetch_count(id: int) -> int:
return id * 10
fn main():
let task = async:
await fetch_count(42)
let result = await task
print(f"Result: {result}")Import Python modules directly with automatic .pyi type introspection and zero-copy collection proxies.
fn main():
import py "math" as math
let val = math.sqrt(64.0)
print(f"Square root: {val}")Call native C and Rust shared libraries directly through the C ABI within unsafe blocks.
import "libc.so.6" as libc:
fn puts(s: str) -> int
fn main():
unsafe:
libc.puts("Hello from libc!")Errors pinpoint source locations with carets and built-in remediation via pit explain.
[E0503] Error: cannot borrow `list` as immutable
╭─[ src/main.ol:4:14 ]
│
4 │ let r2 = &list
│ ──┬──
│ ╰──── already borrowed as mutable here
│
│ Help 1: end the mutable borrow before taking a shared borrow
│ Help 2: run `pit explain E0503` for a detailed explanation
───╯Linux and macOS:
curl -sSL https://raw.githubusercontent.com/ecnivslabs/olive/master/install.sh | shWindows: download from the releases page.
Then:
pit new my_app
cd my_app
pit run- Introduction: Philosophy and goals.
- Basics: Variables, types, and control flow.
- Functions: Grouping code into reusable blocks.
- Ownership: How memory safety works.
- Generics: Writing reusable code.
- Traits: Defining shared behavior between types.
- C / Rust Interop (FFI): Calling C or Rust code and using
unsafe. - Python Interop: Typed Python integration with automatic
.pyistub introspection. - Standard Library: What's in the box.
- Full Index: Everything in one place.
Contributions are welcome! Fork the repo, make a branch, and open a PR. Keep it simple, keep it clean.