🇧🇷 Português

Brick

A programming language that compiles to C.
Maximum performance. Explicit memory. Native hot reload.

Get Started

What is Brick?

An OOP language with clean syntax that compiles directly to C. Designed for games, real-time systems, and any domain where performance and memory control matter.

Compiles to C

Your .brc code becomes readable C — then gcc turns it into a native binary. No VM, no interpreter, no overhead.

Explicit Memory

No garbage collector, no stack for user data. Everything lives in named blocks you control. Reset a block — all allocations go with it.

Hot Reload

Swap code without stopping your program. Powered by dlopen + inotify. Edit, save, see results instantly.

Fixed-Width Types

i8/i16/i32/i64, u8/u16/u32/u64, f32/f64, usize/isize. Compile-time overflow checking, literal suffixes, and type promotion rules.

Code Example

Interfaces, fixed-width types, blocks — all working together.

Brick (.brc)
package DEMO

using IO

block global = 256MB

interface Drawable {
    fn draw()
}

struct Circle {
    u32 id
    String name
    f32 radius

    fn Circle(u32 i, String n, f32 r) {
        id = i
        name = n
        radius = r
    }

    fn draw() {
        print("Circle #{0} radius={1}", id, radius)
    }
}

fn main() {
    Circle c = Circle(1u32, "Small", 5.0f32) @global
    c.draw()
}

Features

Everything you need for high-performance systems programming — nothing you don't.

OOP with Structs

Structs with methods, constructors, inheritance, and interface support. Clean GDScript-inspired syntax that compiles to C.

🧱

Block Memory

Declare named memory blocks (8KB – 256MB+). All allocations go into blocks. No malloc/free per object — just block.reset().

🔄

Hot Reload

Edit code while it runs. dlopen + inotify detect changes, reload .so files, remap functions. Zero downtime iteration.

📏

Fixed-Width Types

i8..i64, u8..u64, f32/f64, usize/isize. Full compile-time overflow checking, widening rules, and literal suffixes.

🐛

GDB Integration

Step through your original .brc code, not the generated C. #line directives map every line back.

📊

TUI Visualizer

Ncurses dashboard showing block memory usage and allocations in real time. brick --visualize file.brc.

🔌

VS Code Extension

Syntax highlighting, LSP, and a memory-view panel that plots block allocations. Debug your memory layout visually.

🌍

Cross-platform

Write once, compile anywhere C goes — Linux, macOS, Windows. Pure C runtime with POSIX dlopen.

Performance

Block memory isn't just safe — it's brutally fast.

Allocation Speed

bump allocator
~3 ns19× faster
malloc
~80 nsbaseline

Free / Reset Speed

block.reset()
~5 ns2000× faster
free() per object
~1 ms (1000 objects)baseline

Cache Locality

contiguous blocks
sequential accessoptimal
linked-list alloc
scattered accessfragmented

Quick Start

From zero to running in four steps.

1

Clone

Get the repository and enter the project directory.

git clone https://github.com/nonunknown777/brick.git
cd brick
2

Build

Brick uses SCons. Build the compiler and runtime in one command.

scons
3

Write

Create a .brc file with structs, methods, and blocks.

touch game.brc
4

Compile & Run

Use the brick CLI — no manual gcc needed.

build/brick run game.brc

Architecture

From source to binary — the compilation pipeline.

.brc Source
your code
Lexer
src/lexer
Parser
src/parser
Codegen
src/codegen
C Code
with #line
gcc
-O3
Binary
native
Runtime
C (block alloc)
Hot Reload
dlopen + inotify
Visualizer
ncurses TUI
Debugger
GDB + .gdbinit
VS Code
ext + memory view

Documentation

Learn the language, the runtime, and the toolchain.