Compact by design
Types, pattern matching, and functions without the ceremony. tok fmt keeps one consistent shape.
THE LANGUAGE
Tokit is a compact, statically typed language for code written with language models. Write a little, check precisely, and run it natively.
Open source · MIT or Apache-2.0 · Version 0.1
struct Item{name:String,price:F}
total(items:[Item])->F{
fold(items,0.0,|sum,i|sum+i.price)
}
main()->String{
let cart=[Item("tea",3.5),
Item("cake",4.25)];
"total "+String(total(cart))
}Small programs should stay small. Tokit keeps syntax concise, gives each program a canonical form, and reports errors in a way a person or an agent can act on.
Explore the specificationsTypes, pattern matching, and functions without the ceremony. tok fmt keeps one consistent shape.
Stable diagnostic codes, source positions, and JSON output make tok check useful in an editing loop.
Interpret while exploring, or use tok build to compile a native executable with Rust.
Values, enums, and exhaustive matches fit together without hiding the control flow.
enum Shape{Circle(F),Square(F)}
area(s:Option<Shape>)->F{
match s{
Some(Shape::Circle(r))=>pi()*r*r,
Some(Shape::Square(a))=>a*a,
None=>0.0
}
}
main()->F{area(Some(Shape::Square(3.0)))}IN THE LANGUAGE
? propagationCheck a file before running it. Diagnostics include a code, location, and concrete message. Use --json to read them from an editor or an agent.
$ tok check --json shapes.tok
{
"ok": false,
"error": {
"code": "E116",
"line": 2, "column": 26,
"message": "non-exhaustive match: missing Some(Square)"
}
}tok runExplore instantlytok checkCatch mistakestok fmtKeep one formtok buildShip a binaryBEYOND THE FIRST PROGRAM
--allow-net.tok lsp, the VS Code extension, or build for WASI.The installer fetches a release and verifies its SHA-256. Add Rust when you want native builds.
curl -sSf https://raw.githubusercontent.com/AlphaVIE/tokit/main/scripts/install.sh | shirm https://raw.githubusercontent.com/AlphaVIE/tokit/main/scripts/install.ps1 | iextok new hello && cd hellotok run main.tokKEEP EXPLORING