pip install scons)sudo apt install libncurses-dev (opcional, para o visualizador)git clone <repo>
cd brick
scons # compila o compilador 'brick' em build/
scons profile=debug # build debug (sem otimização, amigável ao GDB)
scons visualizer=no # pular visualizador TUI
scons vsix=yes # compilar extensão VS Code (.vsix)
Crie hello.brc:
using IO
block global = 64MB
fn main() {
print("Olá, Brick!")
}
Compile e execute:
brick run hello.brc
# Output: Olá, Brick!
Ou passo a passo:
brick hello.brc -o hello.c # compilar Brick → C
gcc -O3 hello.c runtime/block_memory.c runtime/io.c -o hello
./hello # Olá, Brick!
package JOGO
using IO
block global = 256MB
block jogo = 64MB
interface Danificavel {
fn tomar_dano(int dmg)
}
struct Inimigo : Danificavel {
int hp
String nome
fn Inimigo(int h, String n) {
hp = h; nome = n
}
fn tomar_dano(int dmg) {
hp -= dmg
if hp <= 0 { print("{0} destruído!", nome) }
}
}
fn main() {
Inimigo e = Inimigo(100, "Goblin") @jogo
e.tomar_dano(30)
e.tomar_dano(80)
jogo.reset()
}
brick build jogo.brc -o jogo
./jogo
projeto/
├── main.brc
├── lib/
│ └── MATH.brc
lib/MATH.brc:
package MATH
export fn somar(int a, int b) -> int {
return a + b
}
export const PI = 31415
main.brc:
package GAME
using IO
using MATH
block global = 64MB
fn main() {
int r = somar(3, 4)
print("{0}", r)
}
Build:
brick build main.brc -I lib -o programa
./programa
cd vscode-ext
npm install
npm run compile
# Pressione F5 para abrir Extension Development Host
Features: syntax highlighting, LSP (completions, hover, go-to-def, signature help, semantic tokens), memory webview.