Systems Programming Language

Compiled.
Stack-first.
No compromises.

Flux gives you direct control over memory, calling conventions, and machine code - with a syntax that doesn't get in the way. Everything is stack allocated unless you say otherwise.

hello.fx
#import "standard.fx";

namespace hello {

    object Greeter {
        void greet(void) {
            std::io::println("Hello, World!");
        }
    };

    int main(void) {
        Greeter g = new Greeter();
        g.greet();
        return 0;
    }

}
LLVM
Native Code Backend
Zero
Hidden Allocations
Stack
First Memory Model
Full
ABI Control

Built for control.

01
Stack-First Memory

Everything lives on the stack unless you explicitly heap-allocate. No garbage collector, no runtime overhead. You decide exactly where your data lives.

02
LLVM Backend

Flux compiles directly to LLVM IR, giving you access to all LLVM optimisation passes and every target architecture LLVM supports.

03
Inline Assembly

Drop into raw assembly anywhere in your program with asm { } blocks. Architecture-conditional via #ifdef. Works on x86-64 and ARM64.

04
ABI Control

Specify calling conventions per function. Mark functions extern for C interop or naked for full prologue/epilogue control.

05
Objects & Namespaces

First-class objects with method dispatch, operator overloading, and scoped namespaces. No inheritance — compose instead.

06
Typed Pointers

Pointers are first-class with explicit width: *[8]int is a pointer to an 8-bit int. Cast, dereference, and do arithmetic with full type safety.

What Flux looks like.

Structs
Objects
Pointers
Asm
Templates
Strings
struct Vec3 {
    float x;
    float y;
    float z;
};

int main(void) {
    Vec3 pos = {1.0, 2.0, 3.0};
    Vec3 vel = {0.1, 0.0, -0.5};
    pos.x += vel.x;
    return 0;
}
object Counter {
    int value = 0;

    void inc(void) { this.value++; }
    void dec(void) { this.value--; }
    int  get(void) { return this.value; }
};

int main(void) {
    Counter c = new Counter();
    c.inc(); c.inc(); c.inc();
    return c.get();
}
int main(void) {
    int x = 42;
    *int p = &x;
    *p = 100;

    // typed width pointer
    *[8]int bp = (*[8]int)&x;
    return x;
}
int add_one(int n) {
    asm {
        "mov rax, [rbp-8]";
        "add rax, 1";
        "mov [rbp-8], rax";
    }
    return n;
}

int main(void) {
    return add_one(41);
}
template<T>
T max(T a, T b) {
    return a > b ? a : b;
}

int main(void) {
    int   a = max(3, 7);
    float b = max(1.5, 2.5);
    return 0;
}
#import "standard.fx";

int main(void) {
    int score = 42;

    // f-string: prints directly
    f"Score: {score}\n";

    // i-string: builds a value
    char* msg = i"Result={score}";
    std::io::println(msg);
    return 0;
}

Structs

Plain data structures with named fields. Stack-allocated by default, exact size deterministic at compile time. Zero runtime overhead — struct access compiles to direct memory offsets.

  • Stack-allocated by default
  • Deterministic field layout
  • Aggregate initialisation
  • Nestable and composable

Run Flux in your browser.

The online compiler runs real Flux programs in a sandboxed environment. No install, no setup. Share programs with a link.

Open Compiler

Linux & macOS.

01

Python 3.8+ and LLVM

Flux requires Python 3.8 or newer and LLVM with Clang. On Ubuntu and Debian, both are available via apt.

02

llvmlite Python bindings

The code generation backend uses llvmlite. Install version 0.43.0 - it matches LLVM 18 which ships with Ubuntu 24.04.

03

Clone the repository

Flux is open source. The repository includes the compiler, standard library, and examples.

04

Compile

Run fxc.py on any .fx file. The output is a native binary - no runtime required to distribute or run it.

bash
$ sudo apt install python3 python3-pip llvm clang
Reading package lists... Done
✓ Done
 
$ pip3 install llvmlite==0.43.0
Successfully installed llvmlite-0.43.0
 
$ git clone https://github.com/kvthweatt/FluxLang Flux
Cloning into 'Flux'...
✓ Done
 
$ cd Flux && python3 fxc.py examples/hello.fx
✓ Compilation completed: ./hello
 
$ ./hello
Hello, World!