A low-level compiled alternative to C, C++, and more!
Why? β’ Goals β’ Performance β’ Static Analysis & Ownership β’ Status β’ Getting Started β’ Join Us
Luma is a modern systems programming language designed to provide the performance and control of low-level languages while maintaining developer productivity and code clarity.
It's built from the ground up to address common pain points in systems programming β offering explicit memory control, compile-time verification, and minimal abstraction overhead.
Luma uses manual memory management with static analysis, giving developers full control over when and how memory is allocated or freed, while the type checker verifies correctness before code generation.
Modern systems programming often involves a trade-off between performance, safety, and developer experience.
Luma aims to bridge that gap by providing:
- Manual memory control with compile-time static analysis
β The type checker validates use-after-free, double-free, and unfreed allocations before codegen. - Blazing fast compilation β 50ms for a complete 3D graphics application
- Tiny binaries β 24KB stripped executables (comparable to C)
- Direct hardware access and predictable performance
- Readable, minimal syntax that doesn't hide control flow or introduce lifetimes
- Zero runtime overhead β all verification is done statically
- Fast, transparent tooling that stays close to the metal
Unlike Rust, Luma doesn't use lifetimes or a borrow checker. Instead, developers can annotate functions with lightweight ownership hints like #returns_ownership and #takes_ownership so the analyzer can reason about ownership transfers β for example, when returning an allocated pointer.
The result: C-level control with static guarantees, and no runtime or hidden semantics.
Luma is designed for speed at every stage β from compilation to execution:
# 3D graphics application with 4 standard libraries
$ luma 3d_spinning_cube.lx -l math.lx memory.lx string.lx termfx.lx
[========================================] 100% - Completed (51ms)
Build succeeded! Written to '3d_test' (51ms)Real-world metrics:
- 51ms: Complete 3D graphics app with math, memory management, strings, and terminal effects
- +1ms: Memory safety analysis overhead (essentially free)
- Sub-100ms: Typical compilation times for most projects
$ ls -lh 3d_test_stripped
-rwxr-xr-x 1 user user 24K Oct 9 19:27 3d_test_strippedComparable to C β Luma produces tiny, efficient binaries:
- 24KB: Stripped 3D graphics application
- 29KB: With debug symbols
- Zero runtime: No garbage collector, no hidden allocations
| Language | Compile Time Range | Your Test | Binary Size |
|---|---|---|---|
| C/C++ | 100-800ms | ~300ms | 40-80KB |
| Rust | 2-15s | ~3-5s | 150-400KB |
| Go | 100-400ms | ~200ms | 1.5-2MB |
| Zig | 200-600ms | ~400ms | 30-50KB |
| Luma | 50-52ms | 51ms | 24KB |
- π― Minimal & Explicit Syntax β No hidden control flow or implicit behavior
- β‘ Lightning-Fast Compilation β Sub-100ms builds for rapid iteration
- π Zero-Cost Abstractions β No runtime overhead for safety or ergonomics
- π¦ Tiny Binaries β Comparable to C in size and efficiency
- π§ Manual Memory Control β You decide when to
alloc()andfree() - π§ Static Verification β The type checker validates memory safety (use-after-free, double-free, leaks) before codegen
- π Optional Ownership Annotations β Use
#returns_ownershipand#takes_ownershipto make ownership transfer explicit
Luma performs end-of-type-check static analysis to ensure memory safety without runtime overhead.
The analyzer checks for:
- Memory allocated but never freed
- Double frees
- Use-after-free errors
It doesn't use lifetimes or a borrow checker β instead, it relies on explicit ownership annotations to clarify intent.
#returns_ownership
pub const calloc = fn (count: int, size: int) *void {
let total_size: int = count * size;
let ptr: *void = alloc(total_size);
if (ptr != cast<*void>(0)) {
memzero(ptr, total_size);
}
return ptr;
}
#takes_ownership
pub const destroy_buffer = fn (buf: *byte) void {
free(buf);
}
pub const main = fn() int {
let buf = calloc(128, 1);
defer destroy_buffer(buf);
// Safe - verified at compile time in 51ms
return 0;
}
Key Features:
#returns_ownershipβ Function returns newly allocated memory#takes_ownershipβ Function takes responsibility for freeing memorydeferβ Ensures cleanup happens at scope exit- Compile-time verification β All memory safety checks happen during type checking
Current Phase: Early Development
Luma is currently in active development. Core language features are being implemented and the compiler architecture is being established.
What Works:
- β Complete lexer and parser
- β Full type system with structs, enums, functions
- β Static memory analysis with ownership tracking
- β LLVM backend for native code generation
- β Standard library (math, memory, strings, terminal effects)
- β Real-world applications (3D graphics, memory management)
Check out the todo to see what is being worked on or that is done.
You'll need the following tools installed:
- Make - Build automation
- GCC - GNU Compiler Collection
- LLVM - Compiler infrastructure (Version 20.0+ required)
- Valgrind (optional) - Memory debugging
Important: Luma requires LLVM 20.0 or higher due to critical bug fixes in the constant generation system.
Known Issues:
- LLVM 19.1.x: Contains a regression that causes crashes during code generation (
illegal hardware instructionerrors) - LLVM 18.x and older: Not tested, may have compatibility issues
If you encounter crashes during the "LLVM IR" compilation stage (typically at 60% progress), this is likely due to an incompatible LLVM version.
llvm-config --versionArch Linux:
sudo pacman -S llvm
# For development headers:
sudo pacman -S llvm-libsFedora/RHEL:
sudo dnf update llvm llvm-devel llvm-libs
# Or install specific version:
sudo dnf install llvm20-devel llvm20-libsUbuntu/Debian:
sudo apt update
sudo apt install llvm-20-devmacOS (Homebrew):
brew install llvm"illegal hardware instruction" during compilation:
- This indicates an LLVM version incompatibility
- Upgrade to LLVM 20.0+ to resolve this issue
- See LLVM Version Requirements above
Missing LLVM development headers:
# Install development packages
sudo dnf install llvm-devel # Fedora/RHEL
sudo apt install llvm-dev # Ubuntu/DebianInstall the required tools using Scoop:
# Install Scoop package manager first if you haven't: https://scoop.sh/
scoop install python ninja cmake mingw- Clone the LLVM repository:
git clone https://github.com/llvm/llvm-project.git
cd llvm-project- Configure the build:
cmake -S llvm -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;lld" -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_ASM_COMPILER=gcc- Build LLVM (adjust
-j8based on your CPU cores):
ninja -C build -j8- Build time: 30 minutes to several hours depending on hardware
- Disk space required: ~15-20 GB for full build
- RAM usage: Can use 8+ GB during compilation
- If you encounter memory issues, reduce parallelism:
ninja -C build -j4orninja -C build -j1
The compiled binaries will be located in build/bin/
To use clang, lld, and other LLVM tools from anywhere, add the build directory to your PATH:
set PATH=%PATH%;C:\path\to\your\llvm-project\build\bin- Open System Properties β Advanced β Environment Variables
- Edit the
PATHvariable for your user or system - Add the full path to your
build\bindirectory (e.g.,C:\Users\yourname\Desktop\llvm-project\build\bin)
[Environment]::SetEnvironmentVariable("PATH", $env:PATH + ";C:\path\to\your\llvm-project\build\bin", "User")After adding to PATH, open a new command prompt and test:
clang --version
lld --version
llvm-config --version@module "main"
pub const main = fn () int {
output("Hello, World!\n");
return 0;
}
Compile and run:
$ luma hello.lx
[========================================] 100% - Completed (15ms)
Build succeeded! Written to 'output' (15ms)
$ ./output
Hello, World!See tests/3d_spinning_cube.lx for a complete 3D graphics application that:
- Renders rotating 3D cubes
- Uses sine/cosine lookup tables for performance
- Manages memory safely with
defer - Compiles in 51ms to a 24KB binary
Interested in contributing to Luma? We'd love to have you!
- Check out our GitHub repository
- Join our Discord community
- Look at the doxygen-generated docs for architecture details
- If you would like to contribute, please read our contribution guidelines.
Built with β€οΈ by the Luma community
