Modern, Safe, and Lightweight Systems Programming Language
U is a systems programming language that combines the best features of modern languages while maintaining simplicity and performance. It offers:
- Memory Safety through a complete ownership system (like Rust, but simpler)
- Native GUI with a declarative DSL (like Flutter/SwiftUI)
- Actor-based Concurrency without data races (like Erlang/Pony)
- Modern Package Manager for ecosystem growth (like Cargo)
- Full Generics Support with monomorphization and trait bounds
- IDE Integration via Language Server Protocol (LSP) and VS Code extension
- Cross-Platform compilation to Linux, Windows, macOS, and WebAssembly
U compiles to clean C code and uses Zig as a cross-compilation backend, resulting in:
- β‘ Zero runtime overhead
- π― Predictable performance
- π¦ Tiny binaries (no runtime, no GC)
- π True cross-platform support
U implements a 7-rule ownership system that guarantees memory safety without garbage collection:
// Explicit deep copies with .clone()
let s1 = "hello";
let s2 = s1.clone(); // s2 is independent
// Multiple immutable references
let v = Vec_new<i32>();
let r1 = &v; // Immutable borrow
let r2 = &v; // OK: Multiple immutable borrows allowed
// Compile-time error on use-after-move
let x = Vec_new<i32>();
let y = x; // x is moved
// let z = x; // ERROR: use of moved value
No explicit lifetimes. No borrow checker complexity. Just simple, safe code.
Build native user interfaces with a clean, declarative syntax:
ui my_app {
Container {
width: 600,
height: 400,
background: rgb(230, 240, 255),
child: Column {
children: [
Text { text: "Hello, U Language!", size: 24 },
Button {
text: "Click Me",
onClick: handle_click
},
TextField { placeholder: "Enter text..." }
]
}
}
}
Compiles to Skia rendering calls. Runs on desktop and mobile.
Safe, scalable concurrency without locks or data races:
actor Counter {
let mut count: i32 = 0;
fn increment() {
count = count + 1;
}
fn get_count() -> i32 {
return count;
}
}
fn main() {
let counter = spawn Counter;
send counter.increment();
let result = await counter.get_count();
return 0;
}
Micro-runtime of only 5.3 KB. Zero overhead message passing.
Manage dependencies with a Cargo-like package manager:
# Create a new package
ul init my-package
# Install dependencies
ul install u-std
# Build your project
ul build --release
# Publish to registry
ul publishPackage manifest (ul.toml):
[package]
name = "my-package"
version = "1.0.0"
[dependencies]
u-std = "1.0.0"
u-gui = { version = "1.3.0", features = ["skia"] }Write generic code that works with any type:
// Generic function with trait bound
fn print_clonable<T: Clone>(value: T) {
let cloned = value.clone();
unsafe { printf("Cloned!\n"); }
}
// Generic struct
type Point<T> {
x: T,
y: T,
}
fn main() {
let p1 = Point<i32> { x: 10, y: 20 };
let p2 = Point<f64> { x: 1.0, y: 2.0 };
print_clonable(p1);
}
Monomorphization generates specialized code for each concrete type at compile time.
First-class editor support with the U Language Server:
# Install the Language Server
cd lsp
cargo build --release
# Install VS Code extension
cd editors/vscode
npm install
npm run compile
code --install-extension u-language-1.4.0.vsixFeatures:
- β Autocompletion
- β Go to definition
- β Hover information
- β Real-time diagnostics
- β Syntax highlighting
Compile to any platform from any platform using Zig:
# Compile for Linux
ul build --target x86_64-linux
# Compile for Windows
ul build --target x86_64-windows
# Compile for macOS
ul build --target x86_64-macos
# Compile for WebAssembly
ul build --target wasm32-wasi- Rust (for building the compiler)
- Zig (for cross-compilation)
- Git
git clone https://github.com/webcien/u-lang.git
cd u-lang/compiler
cargo build --releaseThe compiler binary will be at target/release/ul.
export PATH="$PATH:/path/to/u-lang/compiler/target/release"Create hello.ul:
fn main() {
unsafe {
printf("Hello, U Language!\n");
}
return 0;
}
extern "C" {
fn printf(format: ptr, ...);
}
Compile and run:
ul build hello.ul
./helloCreate gui_app.ul:
ui my_window {
Container {
width: 400,
height: 300,
background: rgb(255, 255, 255),
child: Text {
text: "Hello, GUI!",
size: 24,
color: rgb(0, 0, 0)
}
}
}
fn main() {
unsafe {
skia_init();
let surface = skia_create_surface(400, 300);
let canvas = skia_get_canvas(surface);
render_ui_my_window(canvas);
skia_save_png(surface, "output.png");
}
return 0;
}
Compile:
ul build gui_app.ul- Language Guide - Complete language reference
- Standard Library - API documentation
- ul.toml Specification - Package manifest format
- Examples - Sample programs
u-lang/
βββ compiler/ # U Language compiler (Rust)
β βββ src/
β βββ lexer.rs # Tokenization
β βββ parser.rs # AST generation
β βββ type_checker.rs # Type validation
β βββ ownership_checker.rs # Ownership validation
β βββ concurrency_checker.rs # Concurrency validation
β βββ optimizer.rs # Code optimization
β βββ package_manager.rs # Package management
β βββ codegen/
β βββ c.rs # C code generation
βββ runtime/ # Runtime libraries (C)
β βββ actor_runtime.c # Actor system (5.3 KB)
β βββ event_loop_sdl2.c # Event loop
β βββ layout.c # Flexbox layout
β βββ skia_real.c # Skia integration
βββ stdlib/ # Standard library (U)
β βββ clone.ul # Clone trait
β βββ option.ul # Option<T>
β βββ result.ul # Result<T, E>
β βββ vec.ul # Vec<T>
β βββ hashmap.ul # HashMap<K, V>
βββ examples/ # Example programs
βββ docs/ # Documentation
βββ tests/ # Test suite
| Command | Description |
|---|---|
ul build <file> |
Compile a U source file |
ul build --release |
Compile with optimizations |
ul build --target <triple> |
Cross-compile to target platform |
ul fmt <file> |
Format source code |
ul lint <file> |
Lint source code |
| Command | Description |
|---|---|
ul init <name> |
Create a new package |
ul install <package> |
Install a dependency |
ul publish |
Publish package to registry |
ul update |
Update dependencies |
U provides a modern standard library with common data structures:
| Type | Description | File |
|---|---|---|
Option<T> |
Optional value | stdlib/option.ul |
Result<T, E> |
Error handling | stdlib/result.ul |
Vec<T> |
Dynamic array | stdlib/vec.ul |
HashMap<K, V> |
Hash map | stdlib/hashmap.ul |
Clone |
Deep copy trait | stdlib/clone.ul |
- β Simpler ownership (no explicit lifetimes)
- β Native GUI DSL (no external frameworks)
- β Smaller learning curve
- β No borrow checker complexity
- β No garbage collection (predictable performance)
- β Memory safety (ownership system)
- β Native GUI (no web-based UI)
- β Smaller ecosystem (for now)
- β Memory safety (ownership system)
- β Actor concurrency (safe by default)
- β GUI DSL (declarative UI)
- β Uses Zig as backend (dependency)
- β Memory safety (no segfaults, no use-after-free)
- β Modern syntax (type inference, traits)
- β Package manager (dependency management)
- β Same performance (compiles to C)
- β Native Windows compiler
- β GUI with Skia integration
- β Macro system
- β Automatic linking scripts
- Interactive GUI (event loop)
- Compile-time execution
- Advanced pattern matching
- Module system improvements
- Async/await over actors
- LLVM backend (optional)
- Garbage collection (optional)
- WebAssembly improvements
Contributions are welcome! Please read CONTRIBUTING.md for guidelines.
git clone https://github.com/webcien/u-lang.git
cd u-lang/compiler
cargo build
cargo testU Language is licensed under the MIT License.
See LICENSE for details.
U Language draws inspiration from:
- Rust - Ownership system and safety
- Go - Simplicity and tooling
- Zig - Cross-compilation and C interop
- Pony - Actor-based concurrency
- Flutter/SwiftUI - Declarative UI
Special thanks to the open-source community.
- Repository: https://github.com/webcien/u-lang
- Issues: https://github.com/webcien/u-lang/issues
- Discussions: https://github.com/webcien/u-lang/discussions
# Clone the repository
git clone https://github.com/webcien/u-lang.git
# Build the compiler
cd u-lang/compiler
cargo build --release
# Try an example
cd ../examples
../compiler/target/release/ul build hello.ul
./helloWelcome to U Language! π
Copyright Β© 2025 Webcien and U contributors