Skip to main content

Installation

Add to your Cargo.toml:
[dependencies]
brik64-core = "4.0"
Or via CLI:
cargo add brik64-core

Quick Start

use brik64_core::{mc, eva};

fn main() {
    // Arithmetic — saturating, never panics
    let sum  = mc::arithmetic::add8(200, 100);    // 255
    let diff = mc::arithmetic::sub8(10, 20);      // 0
    let (q, r) = mc::arithmetic::div8(17, 5);     // (3, 2)

    // Logic
    let result  = mc::logic::and8(0xFF, 0x0F);    // 15
    let shifted = mc::logic::shl8(1, 4);          // 16

    // Crypto
    let hash = mc::crypto::sha256(b"hello");
}

All 128 Monomers

mc::arithmetic   // MC_00–MC_07:  add8, sub8, mul8, div8, mod8, neg8, abs8, pow8
mc::logic        // MC_08–MC_15:  and8, or8, xor8, not8, shl8, shr8, rol8, ror8
mc::memory       // MC_16–MC_23:  store, load, push, pop, dup, swap, zero, copy
mc::control      // MC_24–MC_31:  jump, jz, jnz, call, ret, loop_, break_, halt
mc::io           // MC_32–MC_39:  read, write, open, close, seek, flush, stat, sync
mc::string       // MC_40–MC_47:  len, cat, slice, find, replace, upper, lower, trim
mc::crypto       // MC_48–MC_55:  sha256, sha512, hmac, aes_enc, aes_dec, rand, hash, verify
mc::system       // MC_56–MC_63:  clock, sleep, exit, env, spawn, wait, signal, pipe

EVA Composition

use brik64_core::{mc, eva};

// Sequential (⊗)
let pipeline = eva::seq(
    |x| mc::arithmetic::add8(x, 10),
    |x| mc::arithmetic::mul8(x, 2),
);
assert_eq!(pipeline(5), 30);

// Parallel (∥)
let both = eva::par(
    |x| mc::arithmetic::add8(x, 1),
    |x| mc::arithmetic::mul8(x, 2),
);
assert_eq!(both(5), (6, 10));

// Conditional (⊕)
let branch = eva::cond(
    |x| x > 10,
    |x| mc::arithmetic::add8(x, 1),
    |x| mc::arithmetic::sub8(x, 1),
);
assert_eq!(branch(15), 16);
assert_eq!(branch(5), 4);

No-std Support

The core crate supports no_std for embedded use:
[dependencies]
brik64-core = { version = "4.0", default-features = false }
Crypto monomers require the crypto feature flag, which pulls in sha2 and aes crates. Without it, crypto operations return compile-time errors.
[dependencies]
brik64-core = { version = "4.0", features = ["crypto"] }

JavaScript SDK

Use monomers in JavaScript/TypeScript.

Python SDK

Use monomers in Python.