brik64-core 0.1.0-beta.7

BRIK64 Rust SDK beta with monomer helpers and composition utilities for examples, tests, and application prototypes.
Documentation

brik64-core

Crates.io docs.rs

Rust SDK beta for using BRIK64-style monomer helpers and composition utilities in application code.

Current SDK beta: 0.1.0-beta.7 Aligned CLI beta: 0.1.0-beta.7

Installation

[dependencies]
brik64-core = "0.1.0-beta.7"

# With SHA-256 support:
brik64-core = { version = "0.1.0-beta.7", features = ["sha2"] }

This crate is an SDK library. The CLI is installed separately:

curl -fsSL https://brik64.com/cli/install.sh | bash

What The SDK Provides

  • mc: Rust helper functions for BRIK64-style arithmetic, logic, memory, control, string, crypto, and system examples.
  • eva: composition helpers for sequential, parallel, and conditional pipelines in ordinary Rust code.
  • Optional sha2 support for SHA-256 helpers.
  • A small API surface suitable for examples, integration tests, and application prototypes.

The crate does not install or invoke the BRIK64 CLI. Workspace inspection, certificate workflows, and CLI release behavior are handled by the separately installed CLI.

Usage

use brik64_core::{mc, eva};

// Direct monomer use
let sum = mc::add8(200u8, 100u8);      // wrapping: 44
let (q, r) = mc::div8(17u8, 5u8);      // (3, 2) — division by zero safe
let s = mc::concat("hello", " world"); // "hello world"

// EVA sequential composition ⊗
let pipeline = eva::seq(
    |x: (u8, u8)| mc::add8(x.0, x.1),
    |sum| mc::mod8(sum, 10),
);
let result = pipeline((7u8, 8u8)); // add8(7,8)=15 → mod8(15,10)=5
assert_eq!(result, 5);

// EVA parallel composition ∥
let dual = eva::par(mc::add8, mc::xor8);
let (a, b) = dual((10u8, 5u8), (0b1100u8, 0b1010u8));
assert_eq!(a, 15);
assert_eq!(b, 0b0110);

// EVA conditional composition ⊕
let transform = eva::cond(
    |x: &i64| *x % 2 == 0,
    |x| x * 2,
    |x| x / 2,
);
assert_eq!(transform(4i64), 8);
assert_eq!(transform(5i64), 2);

Monomer Families

Family Range Functions
Arithmetic MC_00–07 add8, sub8, mul8, div8, mod8, abs64, neg64, clamp
Logic MC_08–15 and8, or8, xor8, not8, shl8, shr8, bool_and, bool_or
Memory MC_16–23 load, store, push, pop, peek, alloc, free, len_mem
Control MC_24–31 mc_if, mc_loop, nop, halt, cmp_eq, cmp_lt, cmp_gt, mc_call
I/O MC_32–39 read_file, write_file, append_file, read_str, write_stdout, write_stderr, file_exists, file_size
String MC_40–47 concat, substr, trim, len, contains, starts_with, ends_with, char_at
Crypto MC_48–55 hash_sha256*, hash_hex*, xor_bytes, rotate_left, rotate_right, constant_eq, zero_bytes, bytes_to_hex
System MC_56–63 time_unix, time_ms, env_get, env_set, pid, args, exit_code, sleep_ms

* Requires features = ["sha2"]

EVA Algebra

Operator Function Description
eva::seq Sequential: B(A(x))
eva::par Parallel: (A(x), B(y))
eva::cond Conditional: if pred { A(x) } else { B(x) }

Scope

This SDK provides Rust library helpers. It does not install the CLI or perform workspace certification workflows.

Digital Circuitality

License

See LICENSE.