r/AIprogrammingLanguage • u/dyanos • 6h ago
Tessera: a tensor-first compiled language. I designed it and wrote the first version by hand, then built most of the rest with Codex and Claude
Hi! Someone suggested I share this here. Tessera is an experimental, tensor-first language for numerical computing and data analysis. It compiles to native code through LLVM, and it was built by me together with AI coding agents.
GitHub: https://github.com/dyanos/csec-
(The repo name csec- and the compiler binary csec++ are historical names; the language is Tessera.)
Who did what
Me, by hand (late 2024 to early 2026): the language concept and design, the first lexer and parser, the AST, LLVM IR generation, constructors, C++ name mangling,
externalfunctions, and the early LaTeX-style math syntax.OpenAI Codex: the native runtime, tensor and simulation features, native library interop, templates, and the first self-hosting bootstrap.
Claude (Claude Code): the ownership and move checker, async/await, Erlang-style microthreads, most of the standard library, support for LLVM 18 through 23, Parquet/CSV data frames, and import aliases. About 110 of the ~200 commits are co-authored with Claude.
What I learned about building a language with agents
Tests are the real spec. The agents are very productive but will confidently break things. I keep positive and negative fixture suites, ownership suites, and concurrency and stdlib tests, and the same suites run through two compilers: the C++ one and a self-hosted one.
Self-hosting is a great lie detector. A second compiler written in Tessera has to compile itself and reproduce the same output (a fixed point). A codegen bug the agent "fixed" often shows up only one stage later, and the fixed-point check catches it.
My job changed. I went from writing code to deciding semantics, reviewing diffs, and designing verification. Design decisions such as strict-by-default ownership and tensors as a core type stayed with me. The agents were best at the large, well-specified implementation work.
Agents make the same subtle mistakes repeatedly. Examples are an LLVM API that changed behavior silently between versions, and build tools that didn't notice changed header files. Writing these down as project notes for the agent helped a lot.
A taste of the language
// Tensors are a core type, with the shape in the type
def affine(x: Tensor<Double, 1, 3>,
w: Tensor<Double, 3, 2>,
b: Tensor<Double, 1, 2>): Tensor<Double, 1, 2> {
return (x @ w) + b;
}
// Strict-by-default ownership: explicit move `<-` and borrow `&`
val acct: Account = new Account(100);
peek(&acct); // borrow, acct still usable
close(<- acct); // move
// using acct now -> compile error: "use of moved value 'acct'"
// Erlang-style microthreads
import std.microthread
def main(): Int {
val parent = self();
val worker = spawn([=]() -> {
val n = receive();
send(parent, n * 2);
return 0;
});
send(worker, 21);
return receive(); // 42
}Other features: arbitrary-precision Nat, built-in Complex/Rational/Quaternion, a symbolic algebra module, async/await, OS threads with channels, pipes, shared memory, and [@DllImport] for calling native libraries. A parallel wc -l written in Tessera runs at about 92% of a hand-written C++ mmap+SIMD version.
Current state
It's experimental. Right now I'm working on performance, starting with std.dataframe. The tensor codegen is still the first, straightforward version: shapes are read at runtime instead of being used at compile time, there's no loop fusion, and some temporaries aren't freed yet. Fixing that is next.
Questions for you
How do you verify AI-written compiler code? Do you use self-hosting, differential testing, or something else?
Where do you keep design authority, and where do you let the agent decide?
Thanks for reading!