K3 Programming Language

A modern, high-performance language designed for building everything from system utilities to web applications.

Download K3 Try Online

Features

K3 combines the best aspects of modern programming languages with innovative features for maximum productivity and performance.

High Performance

K3 delivers near-native performance with advanced optimizations and a zero-cost abstraction model.

Memory Safety

Enjoy memory safety without garbage collection through K3's innovative ownership system.

Concurrency

Write safe concurrent code with K3's lightweight tasks and message-passing channels.

Modern Type System

Expressive static typing with type inference, generics, and pattern matching.

Package Manager

Easily share and reuse code with K3's integrated package manager and dependency resolver.

Tooling

First-class tooling with integrated formatter, linter, and documentation generator.

K3 in Action

Clean, expressive syntax that makes complex tasks simple.

Hello World
Web Server
Concurrency
Stellar UI
hello.k3
// A simple K3 program
fn main() {
    println("Hello, K3 World!");
    
    // Variables and type inference
    let name = "K3";
    let version = 1.0;
    
    println("Welcome to {} version {}", name, version);
    
    // Optional type annotations
    let is_awesome: bool = true;
    
    if is_awesome {
        println("K3 is awesome!");
    }
}
server.k3
import net.http
import net.http.router

// A simple HTTP server in K3
fn main() {
    // Create a new router
    let router = router.new();
    
    // Define routes
    router.get("/", handle_home);
    router.get("/api/users", handle_users);
    router.post("/api/users", create_user);
    
    // Start the server
    let server = http.server(router);
    println("Server listening on http://localhost:8080");
    server.listen(8080);
}

// Route handlers
fn handle_home(req: http.Request, res: http.Response) {
    res.html("<h1>Welcome to K3 Web Server</h1>");
}

fn handle_users(req: http.Request, res: http.Response) {
    let users = [
        {id: 1, name: "Alice"},
        {id: 2, name: "Bob"},
        {id: 3, name: "Charlie"}
    ];
    
    res.json(users);
}

fn create_user(req: http.Request, res: http.Response) {
    // Parse JSON body
    let user = req.json();
    
    // In a real app, you would save to a database
    println("Created user: {}", user.name);
    
    res.status(201).json({
        success: true,
        message: "User created"
    });
}
concurrency.k3
import async
import time

// Concurrent programming in K3
fn main() {
    println("Starting concurrent tasks...");
    
    // Create a channel for communication
    let (sender, receiver) = async.channel();
    
    // Spawn a task that sends values
    async.spawn(|| {
        for i in 1..5 {
            println("Sending: {}", i);
            sender.send(i);
            time.sleep(1000); // Sleep for 1 second
        }
        
        // Close the channel when done
        sender.close();
    });
    
    // Spawn another task that processes values
    let handle = async.spawn(|| {
        // Receive values until the channel is closed
        while let Some(value) = receiver.receive() {
            println("Received: {}", value);
            
            // Do some processing
            let result = value * 2;
            println("Processed: {}", result);
        }
        
        println("Channel closed, processing complete");
    });
    
    // Wait for the processing task to complete
    handle.join();
    
    println("All tasks completed");
}
counter.k3
import stellar

// A simple counter app using Stellar UI
fn main() {
    // Create a new Stellar app
    let app = stellar.app("Counter App");
    
    // Define the app state
    let state = {
        count: 0
    };
    
    // Define the UI
    app.view(|state| {
        stellar.container([
            stellar.h1("Counter: {}", state.count),
            
            stellar.row([
                stellar.button("Decrement")
                    .onClick(|state| { state.count -= 1 }),
                    
                stellar.button("Reset")
                    .onClick(|state| { state.count = 0 })
                    .style("margin", "0 10px"),
                    
                stellar.button("Increment")
                    .onClick(|state| { state.count += 1 })
                    .primary()
            ])
            .spacing(10)
            .padding(20)
        ])
        .center()
        .padding(40)
    });
    
    // Run the app
    app.run();
}

Performance

K3 delivers exceptional performance across a wide range of workloads.

Compute
Memory Usage
Startup Time

Computation Performance (lower is better)

Compute Benchmark Chart
K3
Rust
Go
C++

Memory Usage (lower is better)

Memory Benchmark Chart
K3
Rust
Go
C++

Startup Time (lower is better)

Startup Benchmark Chart
K3
Rust
Go
C++

Stellar UI Framework

Build beautiful, responsive, and high-performance user interfaces with K3's integrated UI framework.

High Performance

Stellar UI renders at 60+ FPS even on complex interfaces with thousands of elements.

Responsive Design

Automatically adapts to any screen size with built-in responsive layouts.

Beautiful Components

Over 50 pre-built components with customizable themes and animations.

Declarative Syntax

Intuitive, declarative API that makes UI development a breeze.

Learn More About Stellar UI

K3 Games & Demos

Explore fun ASCII games and demos built with K3. These games showcase the power and expressiveness of the language.

ASCII Art Generator

Create and view cool ASCII art animations including a K3 logo, rocket ship, and animated loading screens.

Play Now

Maze Game

Navigate through a maze to reach the exit. Avoid traps and find the shortest path to freedom!

Play Now

Snake Game

Control a snake to eat food and grow longer. Don't hit the walls or yourself!

Play Now
View All Games

Download K3

Get started with K3 today. Available for Windows, macOS, and Linux.

Windows

Windows 10/11 (64-bit)

Download

Linux

Ubuntu, Debian, Fedora, etc.

Download

Source Code

Build from source

GitHub