An object-oriented language that reads like the math on your whiteboard — then compiles, through a compiler written in itself, to native binaries via LLVM and GPU kernels via Metal. No end, no braces, no return. Fewer tokens for the humans and the models reading along.
Tungsten strips programming to its mathematical essence. Write code that looks like the pseudocode you'd put on a whiteboard.
First-class support for dollars, cents, and percentage operations. No more floating-point money bugs.
Meters, feet, kilograms — with automatic conversion and dimensional analysis, so mismatched units fail loudly instead of becoming bad numbers.
Write mathematical notation directly. Square roots, superscript exponents, deltas — your code reads like the textbook.
Define classes with +, methods with ->, output with <<. Arity is explicit. Everything else melts away.
3.14 is an exact decimal, not an IEEE float. Approximation is opt-in with ~ — so the default never surprises your accountant.
Complex numbers, quaternions, octonions, sedenions — one generic implementation, specialized per scalar type, all the way out to 256-dimensional algebras.
@gpu fn compiles a Tungsten function to Metal Shading Language — same file, same syntax, no FFI, no strings of C.
One allocation, three faces: a CPU array, a Metal buffer, and tensor views when the platform supports them — sharing the same bytes. Attention runs end-to-end on-device.
No end, no braces, no self, no return. Every keyword the syntax omits is a token neither you nor a model has to spend — so more algorithm fits in the same context window.
Concrete examples from the language surface — nine features, one tab each.
Define a class with +, a method with ->, and output with <<. Arity after the slash tells you exactly how many arguments a method takes.
Instance variables are declared inline in the constructor with @. The ro suffix makes them read-only. No boilerplate getters, no verbose accessor declarations.
The prime notation (x') refers to the same-named property on the argument — so x - x' means "my x minus their x." And Δx is that difference in one glyph: √(Δx² + Δy² + Δz²) is a distance method that runs.
A block is just -> followed by an expression, and inside it item is already bound. No pipes, no lambda keyword, no parameter list for the common case.
Block passthrough goes further: pass a trailing block to a method that doesn't take one, and the block iterates the method's result. bag.items -> s += item loops over what items returns.
Accumulator methods read like recurrences — -> sum 0 declares the initial value inline, and the body folds into it.
recaseDispatch with case/when, close blocks by dedent. When an arm needs to re-enter the decision with a new value, recase expr re-dispatches the enclosing case — structured, no goto, no loop scaffolding.
Because symbols and small strings are interned at compile time, a case over them compiles to a real LLVM switch — dispatch at jump-table speed.
Complex<f64> isn't a boxed wrapper — the compiler stamps out a real specialized class with native f64 arithmetic, the same way Rust monomorphizes. Constraints are declared with with T in (…).
The same machinery gives you Complex, Quaternion, Octonion, Sedenion, and larger algebras up to 256 dimensions — with typed operator-overload dispatch picking the right * for each pair of operands.
Annotate a function with @gpu fn and the compiler lowers it to Metal Shading Language while the rest of the file compiles to native code through LLVM. One language, two targets, one file.
Types are ascribed with ## f32[] hints. Inside the kernel, gpu.thread_position_in_grid and friends map straight onto Metal's execution model — and simdgroup 8×8 cooperative matrices are available for tiled matmuls.
This example is the project's smoke test: it compiles, dispatches on-device, and reads back [2, 3, 4].
A Tensor owns one shared allocation with three faces: a CPU array, a Metal buffer, and tensor views when the platform supports them — zero copies between them.
.linear runs bf16 matmuls on the Metal backend; .matmul, views, broadcasting, reductions, and .softmax compose into transformer math. This is the library's capstone test: single-head self-attention, on-device, attention rows summing to 1 within 5×10⁻⁸.
Three compile-time math modes: strict, precise (the default), and fast. Precise mode contracts a direct a*b + c into one FMA — but refuses to contract a*b − c*d, so determinants and cross products of equal terms stay exactly zero.
Override the ambient mode lexically with @strictmath / @fastmath blocks, even inside a method body. And fma(a, b, c) guarantees a single-rounding fused multiply-add in every mode.
Tungsten treats currency as a first-class type. No floating-point rounding errors. No string formatting gymnastics. Just write the dollar sign and go.
Percentages work intuitively — price - 15% calculates the discount. Chain operations freely: price - 15% + 8.25% applies a discount then adds tax.
Mix dollars and cents naturally. Tungsten handles the conversion and precision automatically.
Attach units directly to numbers. Tungsten understands dimensional analysis — multiplying length × length gives area, volume gives volume.
Mixing incompatible dimensions raises a dimension mismatch error. No more silently adding meters to kilograms.
Constants like the speed of light carry their units through every calculation. Einstein's equation isn't a comment — it's working code.
Side-by-side with the languages you know.
| Feature | Tungsten | Python | Ruby |
|---|---|---|---|
| Output | << x |
print(x) |
puts x |
| Class | + Point |
class Point: |
class Point...end |
| Method | -> distance/1 |
def distance(self, other): |
def distance(other)...end |
| Map | list.map -> item ** 2 |
[x**2 for x in list] |
list.map { it ** 2 } |
| Generics | Complex<f64> (monomorphized) |
complex (boxed) |
Complex (boxed) |
| GPU kernel | @gpu fn — in the language |
CUDA / Triton DSL | FFI to C |
| Interpolation | "[name]" |
f"{name}" |
"#{name}" |
| Block ending | (dedent) |
(dedent) |
end |
Tungsten is made in America, and our 250th birthday felt like the ideal moment. Tungsten is my semiquincentennial gift to you.
W · 183.84 u · m.p. 3695 K · version 2026.07.04
Deep dives from building Tungsten — performance engineering, GPU work, and compiler internals, written while the paint was still wet.
The rung-by-rung climb of a self-hosted JSON lexer from 1.4 GB/s to 21 GB/s — SIMD classification, branch elimination, and the microarchitectural detail behind every jump.
Read the story →A pure-Tungsten nvfp4 decode path for a 1.7B-parameter model, taken from 0.71× to 1.16× of Apple's hand-tuned MLX — on the very same Apple silicon.
Read the story →Notes from bringing Apple's tensor-oriented Metal matmul path into Tungsten — the instruction shape, the feed path, and what it takes to keep it busy.
Read the story →Rebuilding the compiler's AST so each node reference is one machine word with zero bytes of header — the data-structure design behind a faster self-host.
Read the story →Tools, packages, and documentation designed with the same care as the language itself.
Find, install, and share Tungsten packages. Dependency resolution, semantic versioning, and the package layout are part of the preview toolchain.
Explore packages →The language specification: lexical structure, semantics, floating-point math modes, units of measurement, and the WValue encoding.
Read the spec →An interactive REPL that plots. Type ? Σ(2x⁷ + 3x²) and get a rendered curve in your terminal — then scrub coefficients live with the arrow keys, ∫ shades the area under it.
Questions, ideas, and collaboration. File issues, start design discussions, and follow the preview work in the open.
Join the discussion →Install in seconds. Write your first program in minutes.
Fall in love before your mid-afternoon coffee.
Public preview · macOS (Apple silicon) & Linux · requires clang/LLVM · Metal GPU features require supported macOS and Apple hardware