Braid Language Specification
Everything you need to build with Braid — from first principles to production deployment.
Core Language
Introduction
Overview of Braid's design philosophy, key features, and hello world examples.
ExploreInstallation
Build the braidc compiler from source using CMake and GCC.
ExploreQuick Start
Get up and running with your first Braid program in minutes.
ExploreLanguage Tour
A guided tour through Braid's syntax, types, and core features.
ExploreLexical Structure
Comments, identifiers, keywords, literals, and token rules.
ExploreTypes
Primitive types, compound types, tensors, diameters, and type inference.
ExploreVariables & Constants
Immutable bindings, type annotations, reassignment, and scope.
ExploreExpressions
Arithmetic, comparison, logical, pipe, and string operators.
ExploreStatements
Assignments, blocks, print, and expression statements.
ExploreControl Flow
if/else, while loops, match expressions with pattern matching.
ExploreFunctions
Declarations, closures, recursion, extern and native functions.
ExploreMethods
impl blocks, self parameter, method syntax, and constructors.
ExploreAdvanced Features
Traits & Interfaces
Trait definitions, implementations, and interface contracts.
ExploreGenerics
Generic types, type parameters, and bounded polymorphism.
ExploreModules & Imports
Module paths, imports, exports, and file resolution.
ExplorePackages
Package configuration, dependencies, and version management.
ExploreAttributes & Annotations
@autograd, @layer, @param, and custom attributes.
ExploreError Handling
Nil returns, error propagation, and safe patterns.
ExploreConcurrency
Threads, channels, spawn blocks, and parallel execution.
ExploreAsync / Await
Async functions, await expressions, and the async runtime.
ExploreMemory Model
ARC, cycle detection, reference counting, and heap allocation.
ExploreFFI
extern fn C linkage, native fn runtime bindings, and C interop.
ExploreMetaprogramming
Runtime code generation with std.compiler and eval patterns.
ExploreCompiler & Tooling
Standard Library
io, math, time, async, dts, and compiler modules.
ExploreCompiler Internals
Lexer, parser, AST, IR, and codegen pipeline stages.
ExploreBuild System
CMake build configuration, targets, and build flags.
ExploreCLI Reference
braidc commands for parsing, building, running, and testing.
ExploreConfiguration
braid.toml config file, compiler options, and targets.
ExploreDiagnostics
Error codes, warnings, and compiler diagnostic messages.
ExploreOptimization
Supercompilation, polyhedral optimization, and performance.
ExploreSecurity Model
Memory safety, sandboxing, and security guarantees.
ExploreML & Tensor
Tensor Library
N-dimensional tensors, dtypes, slicing, and device transfer.
ExploreTensor Ops
Matrix multiplication, element-wise ops, reductions, and broadcasting.
ExploreNeural Network Ops
Linear layers, convolutions, attention, and activation functions.
ExploreModel & Training API
Model definitions, optimizers, learning rate schedulers, and training loops.
ExploreML Standard Library
Pre-built ML utilities, data loaders, and evaluation metrics.
ExploreFrameworks
Junction Overview
Full-stack framework for routing, middleware, storage, and deployment.
ExploreJunction Routing
URL routing, parameters, nested routes, and route guards.
ExploreBond (VDOM)
Virtual DOM components, lifecycle, and stateful widgets.
ExploreBlend (CSS)
Styling system with themes, responsive design, and animations.
ExploreLink (Router)
Client-side routing with transitions and prefetching.
ExploreMerge (State)
State management with reducers, selectors, and subscriptions.
ExploreLibraries
Standard Library Ref
Complete API reference for all standard library modules.
ExploreDTS Library
Distinction Tree Storage — O(1) knowledge graph operations.
ExploreDiameter Reasoning
Dialectical reasoning patterns and predefined decision templates.
ExplorePackage System
Package registry, versioning, and dependency management.
Explore