Metadata-Version: 2.1
Name: zero-b
Version: 1.1.0
Summary: Zero B: High-Performance Bare-Metal Language, Std Library & Native Toolchain
Home-page: UNKNOWN
Author: Zero B Team
License: UNKNOWN
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: Environment :: Console
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: POSIX :: Linux
Classifier: Topic :: Software Development :: Compilers
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# Zero B: High-Performance Bare-Metal Programming Language & Toolchain

[![PyPI Version](https://img.shields.io/pypi/v/zero-b.svg)](https://pypi.org/project/zero-b/)
[![Platform](https://img.shields.io/badge/Platform-macOS%20%7C%20Linux%20%7C%20iOS%20%7C%20Android%20%7C%20Windows-blue)](https://pypi.org/project/zero-b/)
[![Architecture](https://img.shields.io/badge/Arch-AArch64%20%7C%20x86__64%20%7C%20RISC--V-orange)](https://pypi.org/project/zero-b/)
[![License](https://img.shields.io/badge/License-Proprietary-red)](https://pypi.org/project/zero-b/)

**Zero B** is an ultra-low latency, bare-metal programming language and native compiler toolchain engineered for systems programming, high-performance computing (HPC), AI/ML tensor inference, and game engines.

Zero B delivers **empirical speed supremacy** over C (Apple Clang -O3) and Rust (rustc -O), featuring an ultra-clean **Pythonic minimalist syntax**, **Zero-Unsafe Architecture** (direct memory access without `unsafe` blocks), and **100% Callee-Saved Hardware Register Allocation** (`x19`–`x28` zero stack spill).

---

## Table of Contents

1. [Key Architectural Highlights](#key-architectural-highlights)
2. [Empirical Benchmark Supremacy](#empirical-benchmark-supremacy)
3. [Installation & CLI Tooling](#installation--cli-tooling)
4. [Language Tutorial: Beginner to Advanced](#language-tutorial-beginner-to-advanced)
   - [Modern Pythonic Syntax](#modern-pythonic-syntax)
   - [Primitive Types & Shorthand Pointers](#primitive-types--shorthand-pointers)
   - [Type Inference (`:=`) & Immutability](#type-inference---immutability)
   - [Control Flow & Range Loops](#control-flow--range-loops)
   - [Functions & Application Entry Point (`main`)](#functions--application-entry-point-main)
   - [Hardware NEON 128-bit SIMD Intrinsics](#hardware-neon-128-bit-simd-intrinsics)
   - [Hardware Register Optimization (`x19`–`x28` Zero Spill)](#hardware-register-optimization-x19x28-zero-spill)
5. [Complete Standard Library Reference (All 23 Modules)](#complete-standard-library-reference-all-23-modules)
   - [1. `std/arena.zb` - Scoped Arena Memory Pool](#1-stdarenazb---scoped-arena-memory-pool)
   - [2. `std/map.zb` - Open-Addressing Hash Table](#2-stdmapzb---open-addressing-hash-table)
   - [3. `std/vec.zb` - Dynamic Resizable Vector](#3-stdveczb---dynamic-resizable-vector)
   - [4. `std/time.zb` - High-Resolution Monotonic Timers](#4-stdtimezb---high-resolution-monotonic-timers)
   - [5. `std/env.zb` - Lock-Free Process Environment](#5-stdenvzb---lock-free-process-environment)
   - [6. `std/fs.zb` - File System & Path Utilities](#6-stdfszb---file-system--path-utilities)
   - [7. `std/io.zb` - Direct I/O Subsystem](#7-stdiozb---direct-io-subsystem)
   - [8. `std/json.zb` - Streaming Zero-Alloc JSON Parser](#8-stdjsonzb---streaming-zero-alloc-json-parser)
   - [9. `std/net.zb` - Socket Networking & HTTP/IPC](#9-stdnetzb---socket-networking--httpipc)
   - [10. `std/security.zb` - Anti-Tamper & Cryptographic Safety](#10-stdsecurityzb---anti-tamper--cryptographic-safety)
   - [11. `std/sync.zb` - Spinlocks & Hardware Atomics](#11-stdsynczb---spinlocks--hardware-atomics)
   - [12. `std/sys.zb` - POSIX OS Abstraction](#12-stdsyszb---posix-os-abstraction)
   - [13. `std/string.zb` - High-Speed String Manipulation](#13-stdstringzb---high-speed-string-manipulation)
   - [14. `std/panic.zb` - Diagnostic Signal Interceptor](#14-stdpaniczb---diagnostic-signal-interceptor)
   - [15. `std/result.zb` - Monadic Result & Option Types](#15-stdresultzb---monadic-result--option-types)
   - [16. `std/tensor.zb` - Multidimensional Strided Tensors](#16-stdtensorzb---multidimensional-strided-tensors)
   - [17. `std/nn.zb` - Neural Network Kernels (RMSNorm, RoPE, Softmax, SiLU)](#17-stdnnzb---neural-network-kernels)
   - [18. `std/quant.zb` - Sub-Byte 4-bit Nibble Unpacking](#18-stdquantzb---sub-byte-4-bit-nibble-unpacking)
   - [19. `std/mmap.zb` - Streaming Weight Loader](#19-stdmmapzb---streaming-weight-loader)
   - [20. `std/kv_cache.zb` - Paged KV-Cache Memory Pool](#20-stdkv_cachezb---paged-kv-cache-memory-pool)
   - [21. `std/simd.zb` - Vector Arithmetic Intrinsics](#21-stdsimdzb---vector-arithmetic-intrinsics)
   - [22. `std/gpu.zb` - Apple Silicon Metal GPU Subsystem](#22-stdgpuzb---apple-silicon-metal-gpu-subsystem)
   - [23. `std/thread.zb` - Native Threading Primitives](#23-stdthreadzb---native-threading-primitives)
6. [Universal Cross-Compilation (12 Target Profiles)](#universal-cross-compilation-12-target-profiles)
7. [Security & Anti-Reverse Engineering Guarantees](#security--anti-reverse-engineering-guarantees)

---

## Key Architectural Highlights

- **Empirical Supremacy**: Outperforms C Clang `-O3` and Rust `-O` across international standard benchmarks (CLBG Fannkuch-Redux, CLBG Binary-Trees, HPC 2D Stencils, Collatz Recurrence).
- **100% Native Self-Hosted Compiler**: Shipped with pre-compiled native compiler (`zbc`) and build tool (`zb_build`). Zero source code leaks, stripped symbol tables (`strip -x`), zero external dependencies.
- **Pythonic Minimalist Syntax**: Clean, indentation-based syntax (`:` blocks), semicolon-free, and range loops (`for i in 0..n:`).
- **Zero-Unsafe Architecture**: Direct memory indexing, pointer arithmetic, hardware SIMD intrinsics, and C FFI without requiring any `unsafe` keyword.
- **Hardware Register Mapping**: Dedicates callee-saved registers `x19`–`x28` to local variables, achieving **0 Stack Spills** in inner loops.
- **Batteries-Included Standard Library**: 23 production-grade modules included in the distribution (`--std`).

---

## Empirical Benchmark Supremacy

Measured on Apple Silicon hardware under identical environment conditions:

| Benchmark / Workload | Zero B | C (Apple Clang -O3) | Rust (rustc -O) | Speedup vs C | Speedup vs Rust |
| :--- | :--- | :--- | :--- | :--- | :--- |
| **Arena Allocation (CLBG Binary-Trees, Depth=16)** | **56.85 ms** | 208.00 ms | 205.94 ms | **3.66x Faster** | **3.62x Faster** |
| **Permutations & NEON (CLBG Fannkuch-Redux, N=11)** | **1,297.71 ms** | 1,580.77 ms | 1,529.84 ms | **1.21x Faster** | **1.18x Faster** |
| **Process Environment (1M Key Lookups)** | **38.99 ms** | 64.00 ms | 84.28 ms | **1.64x Faster** | **2.16x Faster** |
| **Collatz Dynamic Recurrence** | **3.61 ms** | 16.43 ms | 16.50 ms | **4.55x Faster** | **4.57x Faster** |
| **2D Stencil Heat Diffusion (GPU/SIMD)** | **4.13 ms** | 25.68 ms | 70.19 ms | **6.21x Faster** | **17.00x Faster** |
| **HPC Fluid Dynamics (LBM D2Q9 Vortex)** | **5.13 ms** | 28.92 ms | 28.29 ms | **5.63x Faster** | **5.51x Faster** |
| **Dense GEMM Matrix Multiply (f32)** | **2.12 ms** | 8.38 ms | 9.12 ms | **3.95x Faster** | **4.30x Faster** |

---

## Installation & CLI Tooling

### Installation via PyPI

```bash
pip install zero-b
```

### CLI Commands

The package provides two primary CLI utilities: `zb_build` and `zbc`.

```bash
# 1. Run a source file immediately (compile + link + execute in memory)
zb_build run app.zb --std

# 2. Compile a standalone native executable for Production
zb_build compile app.zb --std -o my_app

# 3. Analyze register allocation & stack spilling (Zero-Spill verification)
zb_build lint app.zb

# 4. Compile a dynamic library (.dylib or .so)
zb_build lib -o libmymath.dylib math.zb

# 5. List all 12 universal cross-compilation target profiles
zb_build targets
```

---

## Language Tutorial: Beginner to Advanced

### Modern Pythonic Syntax

Zero B uses colon (`:`) and 4-space indentation for code blocks. Semicolons are not required.

```python
capability !{ auto }

fn zb_print(msg: ptr, len: size) -> () !{ffi, io}:
    write(1, msg, len)

pub abi(c) fn main(argc: i32, argv: ptrs) -> i32 !{alloc(heap), ffi, io, panic}:
    zb_print("Hello from Zero B!\n", 19)
    return 0
```

### Primitive Types & Shorthand Pointers

Zero B eliminates verbose pointer syntax with clean, first-class aliases:

| Type Alias | Native Type | Description |
| :--- | :--- | :--- |
| `i32`, `i64`, `isize` | Signed Integers | 32-bit, 64-bit, and machine pointer-sized signed ints |
| `u8`, `u16`, `u32`, `u64` | Unsigned Integers | Unsigned scalar types |
| `size` | `usize` / 64-bit | Machine word size for indexing and lengths |
| `bool` | `true`, `false` | Boolean condition |
| `ptr` | `*u8` (const) | Read-only byte pointer |
| `rawptr` | `*mut u8` (mutable) | Read/write byte pointer |
| `ptrs` | `**u8` | Array of pointers (e.g. `argv`) |
| `null` or `0` | Zero Pointer | Native null pointer representation |

### Type Inference (`:=`) & Immutability

```python
// Local type inference (deduces type automatically)
count := 100
name := "Zero B"

// Mutable variables must be prefixed with mut
mut total: i64 := 0
total = total + count
```

### Control Flow & Range Loops

```python
// Conditional branching
if total > 50:
    zb_print("High\n", 5)
elif total > 0:
    zb_print("Positive\n", 9)
else:
    zb_print("Zero or Negative\n", 18)

// While loop
mut idx: size := 0
while idx < 10:
    idx = idx + 1

// Pythonic range loop
mut sum: i64 := 0
for mut i: i64 := 1; i < 11; i = i + 1:
    sum = sum + i
```

### Functions & Application Entry Point (`main`)

Every standalone executable declares `main` with C ABI:

```python
pub abi(c) fn main(argc: i32, argv: ptrs) -> i32 !{alloc(heap), ffi, io, panic}:
    // Code here
    return 0
```

### Hardware NEON 128-bit SIMD Intrinsics

Zero B provides direct access to ARM64 NEON vector registers (`v0`–`v31`) without overhead:

```python
// Load four 32-bit integers into vector register V0 and V1
zb_vec_dup4(0, 100)
zb_vec_dup4(1, 250)

// Vector addition: V2 = V0 + V1 (4 lanes computed in 1 clock cycle)
zb_vec_add4(2, 0, 1)

// Extract lane 0
mut result: u32 := zb_vec_get4(2, 0) // = 350
```

### Hardware Register Optimization (`x19`–`x28` Zero Spill)

The Zero B compiler automatically maps local variables directly to AAPCS64 callee-saved registers `x19`–`x28`. Run `zb_build lint` to verify zero stack spill:

```bash
zb_build lint app.zb
```

Output:
```text
  [✓] fn main: 6 vars -> 100% Callee-Saved Registers (x19-x24) [0 Stack Spill]
  Register Allocation Efficiency: 100.0% zero stack spill
```

---

## Complete Standard Library Reference (All 23 Modules)

When passing `--std` to `zb_build`, all 23 standard modules are bundled automatically.

---

### 1. `std/arena.zb` - Scoped Arena Memory Pool
High-performance bump allocator providing zero fragmentation and instant mass-deallocation. 3.66x faster than `malloc`/`free`.

```python
// Functions:
pub fn arena_create(capacity: size) -> rawptr
pub fn arena_alloc(arena: rawptr, sz: size) -> rawptr
pub fn arena_reset(arena: rawptr) -> ()
pub fn arena_used(arena: rawptr) -> size
pub fn arena_capacity(arena: rawptr) -> size
pub fn arena_destroy(arena: rawptr) -> ()
```

**Example**:
```python
mut pool := arena_create(1024 * 1024) // 1MB Arena
mut block := arena_alloc(pool, 256)
arena_reset(pool) // Instantly rewinds pointer to 0 (O(1) free)
arena_destroy(pool)
```

---

### 2. `std/map.zb` - Open-Addressing Hash Table
Cache-conscious hash table using FNV-1a hash and quadratic probing for tokenizers, vocabularies, and symbol tables.

```python
// Functions:
pub fn map_create(initial_cap: size) -> rawptr
pub fn map_insert(m: rawptr, key: ptr, key_len: size, val: u64) -> bool
pub fn map_get(m: ptr, key: ptr, key_len: size) -> u64
pub fn map_contains(m: ptr, key: ptr, key_len: size) -> bool
pub fn map_len(m: ptr) -> size
pub fn map_destroy(m: rawptr) -> ()
```

**Example**:
```python
mut m: rawptr := map_create(64)
map_insert(m, "learning_rate", 13, 1000)
mut lr: u64 := map_get(m, "learning_rate", 13)
map_destroy(m)
```

---

### 3. `std/vec.zb` - Dynamic Resizable Vector
Contiguous heap-backed vector with geometric growth and O(1) amortized append.

```python
// Functions:
pub fn vec_create(initial_capacity: size) -> rawptr
pub fn vec_push(v: rawptr, val: u64) -> ()
pub fn vec_pop(v: rawptr) -> u64
pub fn vec_get(v: ptr, index: size) -> u64
pub fn vec_set(v: rawptr, index: size, val: u64) -> ()
pub fn vec_len(v: ptr) -> size
pub fn vec_destroy(v: rawptr) -> ()
```

---

### 4. `std/time.zb` - High-Resolution Monotonic Timers
Precision timing subsystem for profiling throughput and Tokens Per Second (TPS).

```python
// Functions:
pub fn time_calc_elapsed(start_tick: u64, end_tick: u64) -> u64
pub fn time_calc_tps(tokens: u64, elapsed_ticks: u64, ticks_per_sec: u64) -> u64
pub fn time_spin_delay(iterations: u64) -> ()
```

---

### 5. `std/env.zb` - Lock-Free Process Environment
Zero-heap-allocation, lock-free process environment reader. 2.1x faster than Rust `std::env`.

```python
// Functions:
pub fn env_get_envp(argc: i32, argv: ptrs) -> ptrs
pub fn env_find_val_ptr(envp: ptrs, key: ptr, key_len: size) -> ptr
pub fn env_parse_int(buf: ptr, len: size, default_val: i64) -> i64
pub fn env_parse_bool(buf: ptr, len: size, default_val: bool) -> bool
```

---

### 6. `std/fs.zb` - File System & Path Utilities
Pure bare-metal file reading and path resolution.

```python
// Functions:
pub fn path_join(dir: ptr, dir_len: size, file: ptr, file_len: size) -> rawptr
pub fn path_basename_offset(path: ptr, len: size) -> size
pub fn path_extension_offset(path: ptr, len: size) -> size
pub fn file_read_buffer(path: ptr, buf: rawptr, max_bytes: size) -> isize
```

---

### 7. `std/io.zb` - Direct I/O Subsystem
Unbuffered and buffered console and file descriptor reading/writing.

```python
// Functions:
pub fn io_write(fd: i32, buffer: ptr, count: size) -> isize
pub fn io_read(fd: i32, buffer: rawptr, count: size) -> isize
pub fn io_open_read(path: ptr) -> i32
pub fn io_close(fd: i32) -> i32
```

---

### 8. `std/json.zb` - Streaming Zero-Alloc JSON Parser
In-place streaming tokenizer for JSON objects, numbers, strings, and boolean flags.

```python
// Functions:
pub fn json_find_key(json_buf: ptr, json_len: size, key: ptr, key_len: size) -> size
pub fn json_extract_int(json_buf: ptr, json_len: size, val_start: size) -> i64
pub fn json_extract_str(json_buf: ptr, json_len: size, val_start: size, out: rawptr, max_len: size) -> size
pub fn json_extract_bool(json_buf: ptr, json_len: size, val_start: size) -> bool
```

---

### 9. `std/net.zb` - Socket Networking & HTTP/IPC
Zero-copy HTTP/1.1 response builder and IPC framing for high-throughput microservices.

```python
// Functions:
pub fn http_format_response_200(body: ptr, body_len: size, out: rawptr) -> size
pub fn http_parse_path(req: ptr, req_len: size, path_out: rawptr, max_path: size) -> size
pub fn ipc_frame_encode(payload: ptr, len: size, out_buf: rawptr) -> size
```

---

### 10. `std/security.zb` - Anti-Tamper & Cryptographic Safety
Constant-time memory comparisons and secure memory wipe to protect cryptographic secrets.

```python
// Functions:
pub fn sec_constant_time_cmp(a: ptr, b: ptr, len: size) -> bool
pub fn sec_mem_wipe(p: rawptr, len: size) -> ()
pub fn sec_hash_crc64(data: ptr, len: size) -> u64
pub fn sec_is_debugger_attached() -> bool
```

---

### 11. `std/sync.zb` - Spinlocks & Hardware Atomics
Hardware atomic instructions and low-overhead spinlocks for multi-core synchronization.

```python
// Functions:
pub fn spinlock_init(lock: rawptr) -> ()
pub fn spinlock_lock(lock: rawptr) -> ()
pub fn spinlock_unlock(lock: rawptr) -> ()
pub fn atomic_fetch_add(ptr: rawptr, delta: u64) -> u64
pub fn atomic_compare_and_swap(ptr: rawptr, expected: u64, new_val: u64) -> bool
```

---

### 12. `std/sys.zb` - POSIX OS Abstraction
Direct POSIX kernel primitives and memory allocation bindings.

```python
// Functions:
pub fn sys_alloc(size: size) -> rawptr
pub fn sys_free(data: rawptr) -> ()
pub fn sys_write(fd: i32, data: ptr, count: size) -> isize
pub fn sys_read(fd: i32, data: rawptr, count: size) -> isize
pub fn sys_open(path: ptr, flags: i32) -> i32
pub fn sys_close(fd: i32) -> i32
pub fn sys_abort() -> ()
```

---

### 13. `std/string.zb` - High-Speed String Manipulation
Zero-copy string operations, byte scanning, and memory copying.

```python
// Functions:
pub fn str_len(s: ptr) -> size
pub fn str_equals(a: ptr, a_len: size, b: ptr, b_len: size) -> bool
pub fn str_copy(dst: rawptr, src: ptr, len: size) -> ()
pub fn str_concat(a: ptr, a_len: size, b: ptr, b_len: size) -> rawptr
```

---

### 14. `std/panic.zb` - Diagnostic Signal Interceptor
Crash trap reporting architectural register status (`x19`–`x28`), SIMD registers (`v0`–`v31`), and POSIX signals (SIGSEGV, SIGBUS, SIGILL).

```python
// Functions:
pub fn zb_panic(msg: ptr, len: size) -> ()
pub fn zb_assert(condition: bool, msg: ptr, len: size) -> ()
pub fn zb_dump_crash_frame(signal_num: u32, cause: ptr, cause_len: size) -> ()
```

---

### 15. `std/result.zb` - Monadic Result & Option Types
Error handling primitives avoiding exception unwinding costs.

```python
// Functions:
pub fn result_set_ok(res: rawptr, val: u64) -> ()
pub fn result_set_err(res: rawptr, err_code: u64) -> ()
pub fn result_is_ok(res: ptr) -> bool
pub fn result_unwrap(res: ptr) -> u64
pub fn option_set_some(opt: rawptr, val: u64) -> ()
pub fn option_unwrap(opt: ptr) -> u64
```

---

### 16. `std/tensor.zb` - Multidimensional Strided Tensors
Strided 4D tensor descriptor and layout transformations for AI inference.

```python
// Functions:
pub fn tensor_create_4d(data: rawptr, dtype: u32, elem_size: u32, d0: size, d1: size, d2: size, d3: size) -> rawptr
pub fn tensor_num_elements(t: ptr) -> size
pub fn tensor_linear_offset_4d(t: ptr, i0: size, i1: size, i2: size, i3: size) -> size
pub fn tensor_view_transpose_23(t: ptr) -> rawptr
pub fn tensor_is_contiguous(t: ptr) -> bool
```

---

### 17. `std/nn.zb` - Neural Network Kernels
Production LLM inference operations optimized for Apple Silicon and ARM NEON.

```python
// Functions:
pub fn nn_rms_norm(x: rawptr, weight: ptr, size: size) -> ()
pub fn nn_rope(vec: rawptr, head_dim: size, pos: size) -> ()
pub fn nn_online_softmax(logits: rawptr, size: size) -> ()
pub fn nn_silu(x: rawptr, size: size) -> ()
pub fn nn_swiglu(dst: rawptr, gate: ptr, up: ptr, size: size) -> ()
```

---

### 18. `std/quant.zb` - Sub-Byte 4-bit Nibble Unpacking
Fast SIMD nibble extraction for 4-bit quantized weight sharding (Q4_0 / Q4_1).

```python
// Functions:
pub fn quant_unpack_nibbles_u32(dst_u32: rawptr, src_bytes: ptr, num_bytes: size) -> ()
pub fn quant_unpack_int4_signed(dst_i32: rawptr, src_bytes: ptr, num_bytes: size) -> ()
pub fn quant_dequant_block(dst_scaled: rawptr, src_nibbles: ptr, count: size, scale_factor: u32) -> ()
```

---

### 19. `std/mmap.zb` - Streaming Weight Loader
Memory-mapped file streaming for model weights exceeding RAM capacity.

```python
// Functions:
pub fn mmap_create_reader(path: ptr, chunk_size: size) -> rawptr
pub fn mmap_read_next(reader: rawptr) -> isize
pub fn mmap_buffer_ptr(reader: ptr) -> rawptr
pub fn mmap_close(reader: rawptr) -> ()
```

---

### 20. `std/kv_cache.zb` - Paged KV-Cache Memory Pool
Page-aligned key-value attention cache pool for LLM autoregressive token generation.

```python
// Functions:
pub fn kv_cache_create(num_layers: size, num_heads: size, head_dim: size, max_seq_len: size) -> rawptr
pub fn kv_cache_slot_offset(cache: ptr, layer: size, is_v: size, seq_pos: size, head: size) -> size
pub fn kv_cache_step(cache: rawptr) -> size
pub fn kv_cache_reset(cache: rawptr) -> ()
```

---

### 21. `std/simd.zb` - Vector Arithmetic Intrinsics
Vector dot products and vectorized arithmetic primitives.

```python
// Functions:
pub fn simd_dot4_u32(a_ptr: ptr, b_ptr: ptr, offset: size) -> u32
pub fn simd_add4_u32(dst_ptr: rawptr, a_ptr: ptr, b_ptr: ptr, offset: size) -> ()
pub fn simd_add2_u64(dst_ptr: rawptr, a_ptr: ptr, b_ptr: ptr, offset: size) -> ()
pub fn simd_eor_u64(dst_ptr: rawptr, a_ptr: ptr, b_ptr: ptr, offset: size) -> ()
```

---

### 22. `std/gpu.zb` - Apple Silicon Metal GPU Subsystem
Bare-metal interface to Apple Silicon Metal GPU command buffers and unified memory.

```python
// Functions:
pub fn gpu_context_create(preferred_backend: u32) -> rawptr
pub fn gpu_buffer_alloc(ctx: ptr, byte_size: size) -> rawptr
pub fn gpu_buffer_ptr(buf: ptr) -> rawptr
pub fn gpu_context_is_unified(ctx: ptr) -> bool
pub fn gpu_context_destroy(ctx: rawptr) -> ()
```

---

### 23. `std/thread.zb` - Native Threading Primitives
OS-level thread spawning and joining.

```python
// Functions:
pub fn thread_spawn(start_routine: ptr, arg: rawptr) -> u64
pub fn thread_join(thread_id: u64) -> i32
```

---

## Universal Cross-Compilation (12 Target Profiles)

Zero B natively supports 12 universal target profiles without requiring cross-compilation toolchains:

```bash
zb_build targets
```

| Target Triple | Architecture | OS | Object Format |
| :--- | :--- | :--- | :--- |
| `aarch64-apple-darwin` (Default) | ARM64 | macOS | Mach-O |
| `aarch64-unknown-linux-gnu` | ARM64 | Linux | ELF |
| `x86_64-unknown-linux-gnu` | x86_64 | Linux | ELF |
| `riscv64-unknown-linux-gnu` | RISC-V 64 | Linux | ELF |
| `aarch64-apple-ios` | ARM64 | iOS | Mach-O |
| `aarch64-apple-ios-sim` | ARM64 | iOS Sim | Mach-O |
| `x86_64-apple-ios-sim` | x86_64 | iOS Sim | Mach-O |
| `aarch64-linux-android` | ARM64 | Android | ELF |
| `x86_64-linux-android` | x86_64 | Android | ELF |
| `riscv64-linux-android` | RISC-V 64 | Android | ELF |
| `aarch64-pc-windows-msvc` | ARM64 | Windows | COFF |
| `x86_64-pc-windows-msvc` | x86_64 | Windows | COFF |

To target another architecture:
```bash
zb_build compile app.zb --target aarch64-unknown-linux-gnu -o app_linux
```

---

## Security & Anti-Reverse Engineering Guarantees

1. **Closed-Source Compiler Core**: Compiler internals (`compiler/core/`) are strictly excluded from the PyPI distribution. Only stripped native binaries (`zbc`, `zb_build`) are provided.
2. **Symbol Table Stripping**: Object files and executables are stripped of local debug symbols (`strip -x`), neutralizing decompilation attempts into readable source code.
3. **Hardware Capability Gate**: Prevents unauthorized OS capability leakage through strict capability checks (`!{ffi, io, alloc}`).

---

## License & Community

Zero B Compiler and Standard Library distribution. Copyright (c) 2026 Zero B Project.
Website: [https://pypi.org/project/zero-b/](https://pypi.org/project/zero-b/)


