Skip to main content

White

White

White is a statically typed language that compiles to native code. The compiler is written in White and uses LLVM for code generation.

Apache-2.0Written in WhiteBuilt with LLVM
hello.wlwlc
class Greeting {
let name: String;

init(name: String) {
self.name = name;
}

func write() -> Void {
print("hello, ", self.name);
}
}

func main() -> Int {
let greeting = Greeting("White");
greeting.write();
return 0;
}
$ wlc hello.wl && ./hello
hello, White

Language

Some language basics

White has static types, classes, interfaces, ARC, fallible return values, and a FFI for calling native libraries. The syntax is deliberately kept small.

01

Static types

Types may be written explicitly or inferred from an initializer. Inference is resolved by the compiler and adds no runtime type information.

let count = 10;
const limit: Int = 64;
02

Errors

A function that can fail returns T?. Use ? at the call site and catch the error where it can be handled.

let text: String = input("name: ")?;
catch(err) { print(err); }
03

Memory

Strings, classes, interfaces, and closures are managed with ARC. Classes may define deinit when they need to release a file, handle, or other resource.

deinit() {
    file.close();
}

Compiler

How wlc builds a program

wlc reads White source, checks it, and writes LLVM IR. Clang then produces the executable, object file, assembly, or shared library. wlc itself is built through the same process.

Compiler source
  1. 01.wl
  2. 02Lexer / Parser
  3. 03Typed AST
  4. 04LLVM IR
  5. 05Native

Platforms

Supported systems

The release pipeline builds and tests wlc for the targets listed here. Cross-compiling for another operating system still requires that system's SDK or sysroot.

Windows

x86-64 / x86

Linux

x86-64 / x86 / AArch64 / ARMv7

macOS

Apple silicon / Intel

Downloads

Tools

The rest of the project

Current limitations

ARC does not collect cycles, weak references are not implemented, and the generic system and standard library are still incomplete. White is not ready for general production use yet.

Read the limitations