A toy Julia-like language, hand-written in OCaml and compiled to real WebAssembly.
What it is
A single hand-written interpreter that covers a surprising amount of Julia's real semantics — then compiles to real WasmGC, calls a Rust numeric kernel across the wasm boundary, and can turn its own quoted code into GPU shaders.
Julia's actual algorithm: an abstract-type hierarchy up to Any, most-specific
method wins, and a real ambiguity error on a tie.
quote / $, gensym, esc — a macro's own
temporaries genuinely can't collide with yours.
lu / qr / svd / eigen and friends — no
BLAS, no C, computed across the wasm module boundary.
to_wgsl / to_glsl compile a quoted block into real WGSL/GLSL that
runs on WebGPU or WebGL2 — driven from Tsubaki itself.
A taste
abstract type Shape end
struct Circle <: Shape
r::Float
end
struct Square <: Shape
side::Float
end
area(c::Circle) = pi * c.r * c.r # one method...
area(s::Square) = s.side * s.side # ...per shape
shapes = [Circle(1.0), Square(2.0)]
println(sum([area(s) for s in shapes])) # 7.14159...
Honest about it
Tsubaki is a toy, and says so.
It exists to answer one question honestly: how much of Julia's real semantics can a small,
hand-written interpreter cover — and how does building that in OCaml compare to building it in
JavaScript? (Short version: OCaml's exhaustiveness checking catches every unhandled case at
compile time, by name; JavaScript's switch lets the same mistake surface later, at
runtime.) Everything in the README was verified by actually running it, not by reading the code.
The name
Tsubaki (椿) is the Japanese name for the camellia. And camellia quietly holds a camel — OCaml's own mascot — right next to Julia. The language's whole parentage, tucked inside a winter flower. What blooms on the outside is just a plain, quiet thing.