Prim is a programming language that values simplicity, safety, and a useful and rich type system. It draws inspiration from both rust and go.
Primitive integer types: u8, i8, u16, i16, u32, i32, u64, i64, usize, isize. Primitive floating point types: f32, f64.
let x: u32 = 0
let x: u32 = 0u32
let x = 0u32
struct Point {
x: f64,
y: f64,
}
fn double(x: u32) -> u32 {
let prod = x*x
prod // return can be omitted
}
impl Point {
fn x(&self) -> f64 {
self.x
}
}
if x == 5 {
println("It is 5")
}
loop {
println(x)
break
}
To enforce formatting, linting, and tests on each commit, this repo includes a pre-commit hook under .githooks/pre-commit that runs:
cargo fmt --all -- --checkcargo clippy --workspace --all-targets --all-features -D warningscargo test --workspace --all-targets
The CLI resolves the standard library and runtime via PRIM_ROOT. For reliable local runs, use ./build.sh to stage a runnable tree under target/{debug,release}/dist and run bin/prim from there (or set PRIM_ROOT yourself to point at the staging root).
Enable it for your local clone:
git config core.hooksPath .githooks
Now git commit will fail if formatting or Clippy checks fail.