136,066 Lines
  • C 59.4%
  • CSharp 27.1%
  • JSON 8.9%
  • Markdown 3%
  • JavaScript 0.9%
  • Yaml 0.3%
  • Scheme 0.2%
  • Python 0%
  • TypeScript 0%
  • Rust 0%
  • C++ 0%
  • XML 0%
README.md

Briar

Briar's my attempt to make a comfortable programming language. Drawing inspiration from Rust and Zig for systems, and C#/Kotlin for more enterprise-y OOP stuff.

The compiler emits LLVM IR, which compiles down to freestanding static binaries targeting x86_64 Linux. It already compiles working programs, and the stdlib, while small, contains necessities like owned String and Vec<T>, as well as builder-style formatting on String.

The language evolves as I build it or run into constraints. Thus, consider this repo as a work in progress, expect changes, and don't rely on Briar as your only programming language (yet >:3).

Where It's Going

Since I've solved AoC 2026's Day 1 (parts 1 and 2) in Briar, I dunno. Wherever really. I'll figure something out.

What It Looks Like

// Adapted from ./examples/matching
import std::num::i32; // note that Briar has no "prelude"

enum Shape {
  Dot,
  Rectangle { width: i32, height: i32 = 1 },
}

fn area(shape: Shape) -> i32 {
  return match shape {
    Shape::Dot => 0,
    Shape::Rectangle { width, height } => width * height,
  };
}

fn main() -> i32 {
  return area(Shape::Rectangle { width: 6, height: 7 });
}

main returns the process exit status, which in this case is 42.

The runnable examples has more shapes of things Briar can do.

For a deeper syntax reference, look at the tree-sitter grammar.

Building It

You'll need .NET 11's SDK, just, and pnpm with Node.js 22 or newer for the grammar and playground tooling. Additionally, to compile the output LLVM IR into a usable executable, you'll want Clang/LLVM.

$ just setup
$ dotnet run --project Briar.Cli -- compile examples/objects --full
$ ./a.out

Or, if you'd prefer:

$ just tooling
$ export PATH="$PWD/support:$PATH"
$ briar --help

Add --preview-pretty-diagnostics to ast, analyze, compile, or format for source excerpts and colored span underlines.

Repository Layout for Nerds

  • Briar.Language is the language implementation + compiler
  • Briar.Cli is the briar command with its subcommands
  • Briar.Verifiers has all the compile-time verifiers
  • Briar.Tooling has LSP stuff
  • Briar.Language.Tests is the test suite, running native compilations and analysis
  • stdlib is the standard library, written in Briar.
    • The idea is that it's not special, and that anyone could write their own stdlib if they wished, without the compiler needing to know about it. builtins:: is the only module the compiler cares about :3
  • examples has small programs covering aspects of Briar
  • support/tree-sitter-briar contains grammar, a live playground
  • support/zed-briar is the Zed extension
  • docs has various arch/component/design notes
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover