OVERVIEW
Monorepo/Core Toolchain/packages/std
v0.2.0 • ActiveSource Code
packages/std/

packages/std

Official Kale Standard Library

The backbone of all Kale software. Delivers generic lists, dynamic byte buffers, hash maps, piece tables, path manipulation, directory walkers, and UTF-8 string builders. Designed for maximum runtime performance and zero unnecessary allocations.

Modules14 Core Packages
CollectionsList, Buffer, Map, PieceTable
I/O Speed> 4.2 GB/s Memory Buffer
MilestoneCore Module
packages/std
Compiler Internal Stages
AOT Emission Latency < 24ms
STAGE 1
Lexer & Token Stream
Single-pass UTF-8 scanner with zero allocations
STAGE 2
Parser & AST Tree
Recursive descent parser emitting strict typed AST nodes
STAGE 3
Type Binder & Inference
Symbol resolution, struct layout, and type deduction
STAGE 4
LLVM IR Emitter
LLVM 18 IR generation linked directly via Clang/LLD
Native C ABI Linker

Zero-Overhead Foreign Function Interface

Kale links directly against native C dynamic libraries with no runtime marshaling wrapper. Functions declared with extern symbols resolve directly through the platform loader (kernel32, user32, opengl32, glfw3, sqlite3).

// Linker Flags
python -m kale.cli build main.kl -o bin/app.exe -lglfw3 -lopengl32 -lsqlite3
Compiler Hardware Architecture
std_demo.kl
kale
import "packages/std/collections/list.kl" as list;
import "packages/std/fs/path.kl" as path;
import "packages/std/text/string_builder.kl" as sb;

fn main() -> int32 {
    let b: sb.StringBuilder = sb.new();
    sb.append(&b, "Kale standard library initialized at: ");
    sb.append(&b, path.join("packages", "std"));
    
    print(sb.to_string(&b));
    return 0;
}
Compilation & Linker Directives

Deterministic command-line invocations to build, link native dynamic dependencies, and run automated regression tests:

$kale build tests/test_std_collections.kl -o bin/test_std.exe
$./bin/test_std.exe
Monorepo Governance

GPG Key 1B917D4779A6102E • Continuous integration with automated symbol verification.

Architectural Capabilities
Collections & Buffers

Generic dynamic arrays, ring buffers, and fast associative map implementations.

Filesystem & Pathing

Cross-platform path resolution, recursive directory traversal, and file manipulation.

Piece Table Text Engine

Industrial-strength text editing data structure used across both the compiler and the flagship editor.