Raven¶
Raven is a statically typed, compiled language. You write high level code with traits, generics, and pattern matching, and the compiler turns it into a native binary through Cranelift. A small garbage collector handles memory, so there are no manual free calls and no borrow checker to argue with, and a C FFI is there for the moments you need to drop down to a native library.
The short version: the readability of Python, the type system and sum types of Rust, the simplicity of Go, and real C interop, in one compiled language.
What you get¶
- Native compilation. Cranelift backend, single static binary, no VM and no interpreter.
- A real type system. Generics with trait bounds, traits for polymorphism, and sum types (
enumwith payloads) checked by an exhaustivematch. - Errors in the open.
Result<T, E>andOption<T>with the?operator instead of exceptions ornull. There is nonullin the language. - Garbage collected. A tracing collector manages the heap. You allocate freely and never write a destructor.
- Concurrency. Lightweight goroutines with
spawnand channels for passing values between them. - C FFI. Declare
extern "C"functions and call into native libraries, with C numeric types, pointers, callbacks, and small structs by value. - Metaprogramming.
@derivefor the common traits and JSON, declarative macros, and compile time plus runtime reflection. - Tooling that ships with the language.
rvpmscaffolds, resolves, builds, runs, tests, documents, formats, and packages applications; a VS Code extension provides editor support.
A fuller taste¶
import std/io { println }
trait Shape {
fun area(self) -> Float
}
struct Circle { radius: Float }
struct Rect { width: Float, height: Float }
impl Shape for Circle {
fun area(self) -> Float = 3.14159 * self.radius * self.radius
}
impl Shape for Rect {
fun area(self) -> Float = self.width * self.height
}
enum Expr {
Lit(Int),
Add(List<Expr>),
}
impl Expr {
fun eval(self) -> Int {
return match self {
Lit(n) -> n,
Add(parts) -> {
let total = 0
for p in parts {
total = total + p.eval()
}
total
},
}
}
}
fun main() {
let c = Circle { radius: 2.0 }
println("area = ${c.area()}")
let tree = Expr.Add([Expr.Lit(2), Expr.Lit(3), Expr.Lit(5)])
println("eval = ${tree.eval()}")
}
Get started¶
- New here? Start with Getting Started. It takes you from a single file to a managed project.
- Want the whole surface of the language? See the Language Reference.
- Looking for what the standard library gives you? The Standard Library page walks through every module.
- Managing dependencies and builds? Read the rvpm guide.
- Shipping an application? See rvpm dist for archives and native Linux and Windows packages.
Install¶
Download the installer or archive for your platform from the releases page: .deb/.rpm/.tar.gz for Linux and .msi/.zip for Windows. Each one installs the raven compiler and the rvpm package manager and adds them to your PATH. Compiling a program also needs a C linker (the MSVC build tools on Windows, cc or clang on Linux).
If you would rather build from source, or want to track the latest commit:
The raven and rvpm binaries land in target/release/.
The VS Code extension adds syntax highlighting and snippets.
A note on versions¶
This site documents Raven v2, the compiled language. Raven v1 was the original tree walking interpreter with a different syntax; it is no longer developed and its source is kept only on the v1.x-maintenance branch for anyone still maintaining old code.