{"slug": "tov-typescript-like-language-that-compiles-to-native-binaries", "title": "Tov: TypeScript-like language that compiles to native binaries", "summary": "Tov, a new TypeScript-like programming language that compiles to native binaries, claims its binaries outperform Rust's, running a binary_trees benchmark in 260 ms versus Rust's 791 ms and compiling a program in 42 ms versus rustc's 98 ms. Tov checks TypeScript syntax and types, emits the program as a single C file, and hands it to clang, producing a 34 KB native binary with no runtime to install; the checker, written in Rust, returns machine-readable fixes via `tov check --json` for coding agents to apply. Tov omits `any`, `null` and `==`, requires failing calls to be marked `try`, and supports Bun and Node APIs including `Bun.serve`, `fetch` and `node:fs`.", "body_md": "A programming language for coding agents. Your agent already writes TypeScript, so it can already write Tov, and when it gets something wrong the compiler hands back the edit that fixes it. What it ships is a native binary that beats Rust's.\n\nbinary_trees: millions of small objects made and freed\n\nTov260 msfastest\n\nBun376 ms45% slower\n\nNode449 ms1.7× slower\n\nC688 ms2.6× slower\n\nRust791 ms3.0× slower\n\nCompiling a program to a native binary\n\nTov42 msfastest\n\nC (clang)49 ms17% slower\n\nRust (rustc)98 ms2.3× slower\n\nMemory, serving that JSON API\n\nTov1.6 MBleast\n\nRust (axum)4.4 MB2.8× more\n\nBun17 MB10.4× more\n\nWhat happens when Tov builds a program\n\nTov is a compiler. It checks the TypeScript your agent wrote, writes it out as C and hands that to clang, so what you ship is one native binary with nothing to install next to it.\n\n1TypeScriptshapes.tov\n\n2Check0.3 ms\n\n3C0.2 ms\n\n4Binary55 ms · 34 KB\n\nYour agent writes TypeScript\n\nTov reads TypeScript's syntax and types, with int and f64 for numbers, and Bun's and Node's APIs. It leaves out what makes a program hard to follow: any, null and ==.\n\n```\ntype Shape =\n  | { kind: \"circle\", r: f64 }\n  | { kind: \"rect\", w: f64, h: f64 }\n\nfunction area(s: Shape): f64 {\n  switch (s.kind) {\n    case \"circle\":\n      return Math.PI * s.r * s.r\n    case \"rect\":\n      return s.w * s.h\n  }\n}\n```\n\nTov checks every line\n\nThe checker, written in Rust, catches what TypeScript lets through: a call that can fail without try, a value shared where it should be copied, a switch that misses a case. Each error has a code and, where the fix is clear, the edit that makes it, which tov check --json hands to your agent.\n\n``` bash\n// without the \"rect\" case\n$ tov check shapes.tov\nerror[F0301] shapes.tov:6:11: `switch` is not\n  exhaustive: missing \"rect\"\n    6 |   switch (s.kind) {\n  fix: add case \"rect\"\n```\n\nIt writes the program as C\n\nThe whole program becomes one C file. Records become structs and a union becomes a tagged union, so switch (s.kind) is a switch on an integer. Values are reference-counted, with the counting written into the C, so there's no garbage collector to pause the program.\n\n```\nstruct Shape {\n    uint32_t tag;\n    union { Circle m0; Rect m1; } u;\n};\n\nstatic double area(Shape s) {\n    switch (s.tag) {\n    case 0: return 3.141592653589793 * s.u.m0.r * s.u.m0.r;\n    case 1: return s.u.m1.w * s.u.m1.h;\n    }\n}\n```\n\nclang makes one binary\n\nclang compiles that C with Tov's runtime, a C library with the event loop, the HTTP server and client, and Tov's strings, arrays and maps. The runtime is compiled once and cached, so most of a build is clang's. A program that imports an npm package also carries the package and JavaScriptCore, the engine Bun uses, to run it.\n\n``` bash\n$ tov build shapes.tov --time\ncheck 0.3 ms, generate 0.2 ms, C compile 55 ms\nbuild: shapes\n$ ls -lh shapes\n34K shapes\n$ ./shapes\ncircle: 3.14\nrect: 6.00\n```\n\nHow an agent writes Tov\n\n1Your agent writes TypeScript\n\n``` js\n// hello.tov\nBun.serve({\n  port: 3000,\n  fetch(req) {\n    const url = new URL(req.url)\n    return new Response(`Hello from ${url.pathname}`)\n  },\n})\n```\n\n2Tov hands back the fix\n\n``` bash\n$ tov check --json\n{\n  \"code\": \"T0831\",\n  \"message\": \"`new URL` can throw `TypeError`; mark the call `try` to pass the error on, or catch it\",\n  \"fixes\": [{\n    \"applicability\": \"safe\",\n    \"edits\": [{ \"line\": 4, \"col\": 17, \"text\": \"try \" }]\n  }]\n}\n```\n\n3You ship a native binary\n\n``` js\n// the agent applies the fix\nconst url = try new URL(req.url)\n\n$ tov build hello.tov\nbuild: hello\n$ ls -lh hello\n152K hello\n$ ./hello & curl :3000/agents\nHello from /agents\n```\n\nIt's TypeScript\n\nWith the APIs your agent knows from Bun and Node. Bun.serve, fetch, node:fs, async/await and npm packages work as it expects.\n\nLess to get wrong\n\nThere's no any, null or ==, and a call that can fail is marked try. If code looks like TypeScript it behaves like TypeScript, and if it can't, it doesn't compile.\n\nA 42 ms compile\n\n--watch restarts the program on save, and tov test runs the tests that sit next to the code.\n\nAgainst Rust, C, Bun and Node\n\nTov compiles to C and counts references instead of collecting garbage, so there are no collector pauses and the binaries stay small.\n\nPrograms\n\nbinary_trees3.0× faster than Rust\n\nsort1.6× faster than Rust\n\nmap_insert1.7× faster than Rust\n\ndispatch2.1× faster than Rust\n\nstrings1.6× faster than Rust\n\nfib7% faster than Rust\n\nnbody7% faster than Rust\n\nServers and builds\n\nweb server12% faster than Rust\n\nserver memory2.8× less than Rust\n\nfetch()9% faster than Rust\n\ncompile2.3× faster than Rust\n\nbinary size10.5× smaller than Rust\n\n3.0× faster than Rustbinary_trees: millions of small objects\n\nTov260 ms\n\nBun376 ms\n\nNode449 ms\n\nC688 ms\n\nRust791 ms\n\nShorter is better.\n\n1.6× faster than Rustsort: 3M floats, with a comparator\n\nTov45 ms\n\nRust74 ms\n\nC275 ms\n\nBun696 ms\n\nNode1175 ms\n\nShorter is better.\n\n1.7× faster than Rustmap_insert: 2M string keys\n\nTov284 ms\n\nC476 ms\n\nRust490 ms\n\nBun823 ms\n\nNode1178 ms\n\nShorter is better.\n\n2.1× faster than Rustdispatch: 50M virtual calls\n\nTov36 ms\n\nC76 ms\n\nRust77 ms\n\nBun109 ms\n\nNode191 ms\n\nShorter is better.\n\n1.6× faster than Ruststrings: format, join, split\n\nTov143 ms\n\nBun203 ms\n\nRust224 ms\n\nC253 ms\n\nNode519 ms\n\nShorter is better.\n\n7% faster than Rustfib: recursive calls, overflow-checked\n\nTov416 ms\n\nRust444 ms\n\nC490 ms\n\nBun942 ms\n\nNode1485 ms\n\nShorter is better.\n\n7% faster than Rustnbody: floating point\n\nTov210 ms\n\nRust224 ms\n\nC312 ms\n\nBun512 ms\n\nNode554 ms\n\nShorter is better.\n\n12% faster than Rustweb server: JSON API, one core\n\nTov242k req/s\n\nRust216k req/s\n\nBun111k req/s\n\nLonger is better.\n\n2.8× less than Rustserver memory: serving that API\n\nTov1.6 MB\n\nRust4.4 MB\n\nBun16.6 MB\n\nShorter is better.\n\n9% faster than Rustfetch(): 64 requests at once\n\nTov177k req/s\n\nRust162k req/s\n\nBun129k req/s\n\nNode30k req/s\n\nLonger is better.\n\n2.3× faster than Rustcompile: a program to a binary\n\nTov42 ms\n\nC49 ms\n\nRust98 ms\n\nShorter is better.\n\n10.5× smaller than Rustbinary size: a program, stripped\n\nTov33 KB\n\nC33 KB\n\nRust351 KB\n\nShorter is better.\n\nMeasured on an Apple M4 Max, and each program prints the same output in every language. Tov checks integer overflow by default; Rust's release builds don't. Method and every result.\n\n×\n\nTrying Tov on Cap\n\nCap is our open-source screen recorder. We've tried two parts of its video pipeline on Tov: a new encoder written in Tov, and the media server Cap already has, compiled by Tov as it is. Neither runs in Cap's production yet.\n\nA screen encoder, written in Tov\n\nEvery Cap recording ends up as H.264 video. We wrote an encoder for it in Tov, tuned for what's on a screen, and compared it with x264 at the same picture quality. The encoder is on GitHub.\n\n5.2×faster than x264, on average\n\nIdle screen8.1×\n\nCode, 4K8.0×\n\nBusy UI, 60 fps7.2×\n\nSlow typing6.9×\n\nBusy UI6.5×\n\nDark mode6.5×\n\nCode editor6.5×\n\nSlides4.6×\n\nScrolling text4.4×\n\nWebcam overlay4.2×\n\nDashboard3.5×\n\nFull-motion video1.5×\n\n46 MB\n\nof memory at its peak (x264: 377)\n\n561 KB\n\nthe whole encoder (x264: 1.3 MB)\n\n12 screen recordings at 1080p, on one thread, against x264's veryfast preset. Every result.\n\nThe media server, unchanged\n\nCap's media server is a Bun app (Hono, zod and FFmpeg) that probes uploaded videos and pulls out their audio. Tov runs it without changing a line; the file below is the whole port. Cap still serves it with Bun.", "url": "https://wpnews.pro/news/tov-typescript-like-language-that-compiles-to-native-binaries", "canonical_source": "https://tov.sh", "published_at": "2026-10-10 15:50:15+00:00", "updated_at": "2026-10-10 16:17:20.622405+00:00", "lang": "en", "topics": ["developer-tools", "ai-agents", "artificial-intelligence"], "entities": ["Tov", "TypeScript", "Rust", "clang", "Bun", "Node", "JavaScriptCore", "npm"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/tov-typescript-like-language-that-compiles-to-native-binaries", "markdown": "https://wpnews.pro/news/tov-typescript-like-language-that-compiles-to-native-binaries.md", "text": "https://wpnews.pro/news/tov-typescript-like-language-that-compiles-to-native-binaries.txt", "jsonld": "https://wpnews.pro/news/tov-typescript-like-language-that-compiles-to-native-binaries.jsonld"}}