v0.3.0-alpha

A minimal, functional-first language
that compiles to native binaries.

No parens for function calls. Indentation-based blocks. Algebraic data types. Pattern matching. Hindley-Milner type inference. Reference counting. One binary, no runtime.

$ git clone https://github.com/Adjanour/ko-language.git && cd ko-language && ./build.sh
MIT licensed Zig + LLVM Linux / macOS
hello.ko
# Functions — no parens needed
fn add x y = x + y

# Pattern matching
type Maybe a = Just a | Nothing

fn from-just default mx =
  match mx
    Just x => x
    Nothing => default

# Pipe operator
5 |> add 1 |> add 2

# Error propagation
fn divide a b =
  if b == 0 then Err "by zero"
  else Ok (a / b)

Everything you need in a functional language.

Minimal syntax. Powerful type system. Native performance.

Hindley-Milner Inference

Full type inference with let-polymorphism. Write expressive code without type annotations.

Algebraic Data Types

Sum types, record types, and exhaustive pattern matching. Model your domain precisely.

Native Performance

Compiles to native binaries via LLVM. Reference counting for memory management. No GC pauses.

Zero Dependencies

One binary. One folder. No npm, no brew, no virtualenv. Drop it anywhere and run.

Error Propagation

Built-in Result type with ? operator. Unwrap or propagate errors seamlessly.

Developer Tools

LSP server, REPL, tree-sitter grammar, VS Code extension. Full toolchain included.

Clean, expressive syntax.

# No parentheses for function calls
add 1 2

# Partial application
let add1 = add 1
add1 2  # 3

# Pipe operator
5 |> add 1 |> add 2

No Parentheses

Function calls use spaces, not parens. Pipe operator for chaining.

type List a = Cons a (List a) | Nil

fn length lst =
  match lst
    Cons _ rest => 1 + length rest
    Nil => 0

Pattern Matching

Exhaustive matching on ADTs. Destructure and bind in one step.

type Result a b = Ok a | Err b

fn divide a b =
  if b == 0 then Err "by zero"
  else Ok (a / b)

let x = divide 10 3?

Error Propagation

Built-in Result type. The ? operator unwraps or propagates.

Install Kō

Requires Zig 0.17 and LLVM 22.

Linux

# Ubuntu/Debian
sudo apt install llvm-22-dev zlib1g-dev

# Arch
sudo pacman -S llvm zlib

# Build
git clone https://github.com/Adjanour/ko-language.git
cd ko-language/ko-zig
zig build

macOS

brew install llvm@22
export PATH="/opt/homebrew/opt/llvm@22/bin:$PATH"

git clone https://github.com/Adjanour/ko-language.git
cd ko-language/ko-zig
zig build

Quick start

terminal
./build.sh
echo 'fn main = println "Hello, Kō!"' > hello.ko
./ko-dist/ko hello.ko