Docs / Overview

Overview

Kex is a small functional programming language with Ruby-like syntax, immutable data by default, Uniform Function Call Syntax, type-directed make blocks, pattern matching, and explicit side-effect boundaries.

It’s designed for code that reads like a scripting language without giving up typed records, sum types, pure functions, and predictable dispatch.

The shape of a program

Every kex program starts from main. main is the one place side effects are allowed to live, so it’s implicitly foul.

hello.kex
main do
  IO.printLine("Hello, world!")
end
stdout
Hello, world!

Design principles

  • Pipelines over methods. value.f(arg) is exactly f(value, arg). Plain functions compose into fluent chains.
  • Behavior near its type. make attaches functions, operators, and methods to a type — without classes or inheritance.
  • Effects you can see. Pure by default; foul marks effectful code, and pure code can’t call it.
  • Failure as a value. Result and Optional carry errors; ? propagates them.

Status

The current implementation is a tree-walk interpreter written in C++20, with a type checker active by default. Work is underway on a bytecode VM and WASM codegen for a browser REPL.

Looking for install steps? See the install guide, or jump into syntax.