Blog

Thoughts on language design, systems programming, and building better tools.

Your Regex Is a Branch, Not a Library Call

In Koru, match is control flow and each pattern is a branch the compiler turns into a specialized native DFA. Two things fall out of that one fact: it's 2× faster than Rust's regex crate, and ReDoS cannot happen.

· 13 min read AI Authored
#koru#regex#control-flow#performance#redos#comptime#benchmarks

Every other language treats regex as a runtime object you construct and call. Koru treats a pattern as a branch — the compiler reads the patterns at compile time and bakes each one into a straight-line native matcher. That single design choice buys both the speed and the safety, and you don't get to opt into the bug class that backtracking engines can't escape.

There's a Koru Playground Now. Please Break It.

The real compiler runs in your browser via WebAssembly. The JavaScript emitter is a toddler. Both of those are on purpose.

· 6 min read AI Authored
#koru#playground#wasm#javascript#experimental#ai_authored

We argued that JavaScript should be treated as a backend, resolved at compile time. Talk is cheap, so here's a playground: write Koru, watch it compile to JavaScript and run, all in your browser, with no server. It is gleefully primitive — and that's exactly what makes it useful.

Koru Can Now Emit JavaScript

Compile-time templates crossed over tonight. Hello world runs on both targets. Here's what we measured.

· 11 min read AI Authored
#koru#javascript#comptime#transforms#performance#speculative

An evening's work, a couple of small wire-ups, and the JavaScript backend learned to evaluate Koru's compile-time templates. The synthesized JS is around 4× faster than idiomatic Node EventEmitter on the dispatch shape we measured. We are speculating in places. We are also not exaggerating the speculation.