Brick

A language that compiles to C.
Maximum performance. Zero overhead. Full control.

package GAME
using IO

block global = 256MB

interface Damageable {
    fn take_damage(i32 dmg)
}

struct Player : Damageable {
    i32 hp
    String name

    fn take_damage(i32 dmg) {
        hp -= dmg
        if hp < 0 { hp = 0 }
        print("{0} took {1} damage", name, dmg)
    }
}

fn main() {
    Player p = Player(100, "Felipe") @game
    p.take_damage(20)
    game.reset()
}

Why Brick?

⚑

Zero-Cost Abstractions

Compiles to pure C with #line directives. Every fn becomes static inline β€” zero call overhead.

🧱

Block-Based Memory

Bump allocator (~3 cycles). No malloc/free. No GC. Reset a block in ~5 ns.

πŸ”„

Native Hot Reload

Swap code at runtime without restarting. Atomic function pointer swap. Inotify + dlopen.

πŸ”§

OOP with Speed

Structs with methods, interfaces with vtbl dispatch, inheritance, impl blocks, all zero-cost.

πŸ“¦

Package System

Multi-file projects, nested packages (MATH.VEC2), export/private visibility, auto-resolution.

πŸ› οΈ

Macro Metaprogramming

macro with $ interpolation, build {} compile-time eval, emit {} code gen, hygiene, varargs.

🌐

C Interoperability

Seamless C interop: include, link, extern fn, @system. String β†’ *u8 auto-conversion.

βš™οΈ

Fixed-Width Types

u8..u64, i8..i64, f32/f64, usize/isize. Bitfields (u4, i3). Overflow checked at compile time.

🎨

Rich Type System

Dynamic arrays, fixed arrays, pointers, structs, unions, enums, match with guards, defer, sizeof/alignof.

Language at a Glance

πŸ”’ Types & Arrays

let x: u32 = 0xFF
f32[16] matrix = {1.0}
int[] items

🎯 Pattern Matching

match value {
    1 { print("one") }
    2, 3 { print("multi") }
    _ { print("default") }
}

🧹 Defer Statements

defer { print("cleanup") }
// called when scope exits

πŸ”— Pointer Arithmetic

*int p = &x
p += 1        // next element
isize d = q - p // element count

Ready to build with Brick?

Compile to native code. Own your memory. Stay in control.

Get Started β†’ Read the Docs