Active development · v0.2.2

Code that reads like you think.

code-lang is a general-purpose interpreted language built in Rust — fast to learn, with first-class functions, structs, enums, destructuring, and a complete standard library.

12stdlib modules
100+built-in functions
Rustinterpreter core
MITlicense

See it in action

example.cl
import "fmt";
import "math";

struct Point {
    x = 0,
    y = 0,
    distance = fn(self) {
        math.sqrt(self.x ** 2 + self.y ** 2)
    },
}

enum Status { Ok, Pending, Err }

let p = Point { x: 3, y: 4 };
let status = Status.Ok;
let label = null ?? "no label";

let [a, b] = [p.x, p.y];
fmt.print("x:", a, "y:", b);
fmt.print("dist:", p.distance());
fmt.print("type:", typeof status);

Why code-lang

Everything you need, nothing you don't.

{ }

Familiar syntax

C-style braces, fn, let/const. Reads like the languages you already know.

λ

First-class functions

Functions are values. Closures, higher-order, recursion, default parameters — all built in.

Structs with self-methods

Define types with default fields and methods. Call point.distance() — self is injected automatically.

Enums and switch

Named variant sets with dot access. Switch dispatches on any value with ==.

[ ]

Destructuring

Unpack arrays and hashes directly: let [a, b] = arr and let { x, y } = hash.

12

12 stdlib modules

math, strings, arrays, fs, http, json, time, rand, os, hash, path, fmt — ready to import.

??

Null safety

null is a first-class value. let x; defaults to null. ?? returns the right side when the left is null.

!

Precise errors

Every error shows the source line, a caret, and a hint on how to fix it.

Roadmap

What's coming next.

The interpreter is stable. The toolchain — formatter, install script, CI — has shipped. Editor support is next.

in progress

VS Code extension

Syntax highlighting for .cl files in VS Code, Cursor, and all Electron-based editors.

in progress

code-lang-lsp

Language server with parse diagnostics — underlines errors in the editor as you type.

done

code-lang-fmt

Formatter with check and lint subcommands. code-lang-fmt check exits 1 on parse errors.

done

Install script

curl | sh that drops code-lang and code-lang-fmt into ~/.code-lang/bin/ on Linux and macOS.

planned

Zed extension

Tree-sitter grammar and language server integration for Zed.

done

Higher-order stdlib

arrays.map, filter, reduce, find, any, all with user-defined functions.

Install

One command installs both code-lang and code-lang-fmt into ~/.code-lang/bin. Pre-built binaries for Linux and macOS — no Rust or compiler required.

Linux
curl -fsSL https://raw.githubusercontent.com/Walon-Foundation/code-lang/main/install.sh | sh

Other platforms & install guide →

Building from source? See the full install guide →