Thanks to visit codestin.com
Credit goes to github.com

Skip to content

bvinc/prim

Repository files navigation

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 expressions

let x: u32 = 0
let x: u32 = 0u32
let x = 0u32

Structs

struct Point {
    x: f64,
    y: f64,
}

Functions

fn double(x: u32) -> u32 {
    let prod = x*x
    prod // return can be omitted
}

Methods

impl Point {
    fn x(&self) -> f64 {
        self.x
    }
}

Control Flow

if x == 5 {
    println("It is 5")
}

loop {
    println(x)
    break
}

Git Hooks

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 -- --check
  • cargo clippy --workspace --all-targets --all-features -D warnings
  • cargo test --workspace --all-targets

Running / Staging

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published