Skip to main content

Installation

pip install brik64
# uv add brik64
# poetry add brik64
Python 3.10+ required. No external dependencies.

Quick Start

from brik64 import mc, eva

# Arithmetic — saturating, never raises
total = mc.arithmetic.add8(200, 100)     # 255
diff  = mc.arithmetic.sub8(10, 20)       # 0
q, r  = mc.arithmetic.div8(17, 5)        # (3, 2)

# Logic
result  = mc.logic.and8(0xFF, 0x0F)      # 15
shifted = mc.logic.shl8(1, 4)            # 16

# Crypto
digest = 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

from brik64 import mc, eva

# Sequential (⊗)
pipeline = eva.pipeline(
    lambda x: mc.arithmetic.add8(x, 10),
    lambda x: mc.arithmetic.mul8(x, 2),
)
pipeline(5)  # 30

# Parallel (∥)
both = eva.parallel(
    lambda x: mc.arithmetic.add8(x, 1),
    lambda x: mc.arithmetic.mul8(x, 2),
)
both(5)  # (6, 10)

# Conditional (⊕)
branch = eva.cond(
    lambda x: x > 10,
    lambda x: mc.arithmetic.add8(x, 1),
    lambda x: mc.arithmetic.sub8(x, 1),
)
branch(15)  # 16
branch(5)   # 4

Type Hints

The SDK includes full type stubs for IDE support:
from brik64 import mc

reveal_type(mc.arithmetic.add8)  # (int, int) -> int
reveal_type(mc.arithmetic.div8)  # (int, int) -> tuple[int, int]

JavaScript SDK

Use monomers in JavaScript/TypeScript.

Rust SDK

Use monomers in Rust.