Quartz v5.25

Write it like Ruby.
Run it like C.

Quartz is a self-hosting systems language that reads like a scripting language and compiles to native binaries that beat C on benchmarks. No garbage collector. No runtime. Just you and the machine.

hello.qz
def main(): Int
  names = ["Alice", "Bob", "Charlie"]

  names
    |> map() { "Hello, #{it}!" }
    |> each() { puts(it) }

  return 0
end
5,511 Tests Passing
1,153 Functions
v5.25 Self-Hosted
0.5Γ— Faster than C

What makes Quartz different?

Every systems language makes you choose between power and readability. Quartz doesn't.

πŸ“–

You Can Actually Read It

No lifetime annotations. No borrow checker fights. No fn, let mut, or ::<> soup. Quartz reads like pseudocode and compiles to native machine code.

x = 42              # immutable by default
var y = 10          # mutable when you need it
def double(n: Int): Int = n * 2
⚑

Genuinely Faster Than C

Quartz compiles to LLVM IR. Its bump allocator emits 4 branchless instructions per allocation β€” no function calls, no branches, no overhead. On real benchmarks, it wins.

# 4 instructions. Zero function calls.
bump = bump_new(2097152)
node = bump_alloc(bump, 24)
bump_free(bump)
πŸ”€

A Type System Nobody Else Has

Quartz has true union types β€” a value that is literally Int | String. Not a tagged enum. Not a workaround. A real union. The only systems language that does this.

# A value that IS an Int or a String. For real.
def process(value: Int | String): Void
  match value
    Int => puts("got a number")
    String => puts("got text")
  end
end

How does Quartz compare?

Features that other systems languages simply don't have.

Capability Quartz Rust Zig C
Type inference (Hindley-Milner) βœ… Partial ❌ ❌
True union types (Int | String) βœ… ❌ ❌ ❌
Structural subtyping βœ… ❌ ❌ ❌
Row polymorphism βœ… ❌ ❌ ❌
Zero-overhead allocator intrinsics βœ… ❌ ❌ ❌
Pipeline operator (|>) βœ… ❌ ❌ ❌
Self-hosting compiler βœ… βœ… βœ… βœ…
Bare metal (no OS, no libc) βœ… βœ… βœ… βœ…

Everything you'd expect β€” and more

The stuff you love from your favorite languages, all in one place.

Pattern Matching

Exhaustive match with destructuring, guards, and string/regex patterns. Use it as an expression.

Pipelines (|>)

Chain data transformations left-to-right. data |> parse |> validate |> save β€” reads like English.

Defer

Guaranteed cleanup on any exit path. Like Go's defer, but with LIFO ordering and no GC safety net to fall back on.

Newtypes

newtype UserId = Int β€” zero runtime cost, total type safety. You can never accidentally pass a ProductId where you meant UserId.

Compile-Time Evaluation

const def square(n) = n * n β€” runs at compile time. Also callable at runtime. No separate macro language needed.

Structural Records

Pass any struct with the right fields β€” no interfaces, no generics ceremony. If it has a .name field, it works.

Comprehensions

[x * x for x in 0..10] β€” list, map, and set comprehensions. Familiar and expressive.

Bare Metal

Compile freestanding binaries for ARM, x86, anything LLVM targets. No OS, no libc, no runtime. Just your code.

Don't take our word for it

5 of 6 benchmarks at or beating clang -O2.

Benchmark Quartz C (clang -O2) Rust Zig
binary_trees (bump) 2.7ms πŸ”₯ 5.1ms 5.9ms 2.7ms
sieve (byte) 15.5ms 13.1ms 12.6ms 13.7ms
fibonacci 319.1ms 318.8ms 317.8ms 317.1ms
sum 2.2ms 2.1ms 2.9ms 2.0ms
string_concat 2.4ms 2.6ms 2.7ms 2.0ms
matrix 5.5ms 5.5ms 5.6ms 5.2ms

Ready to try Quartz?

Clone the repo, build the compiler, and write your first program in under 5 minutes.

terminal
$ brew install llvm
$ git clone https://git.sr.ht/~mathisto/quartz
$ cd quartz && bundle install && rake
$ ./self-hosted/bin/quartz hello.qz -o hello && ./hello
Hello from Quartz!