Jacket is a toolchain for the Jai programming language, written from scratch. It has a compiler (jaic), a language server (jailsp), a formatter (jaifmt), a linter (jailint), and jacket, which runs all of them from one jacket.toml and adds tests, benchmarks, API docs and git dependencies. Its standard library is written in Jai and adds extension modules such as JSON, HTTP, Postgres, Regex, TOML and WebGPU.
Note
Jacket is unofficial and is not affiliated with or endorsed by Thekla, Inc. or the official Jai project.
- API reference for the standard library, with runnable examples
- Guides: testing, benchmarking, documenting a library, memory safety, other targets, dependencies
- Command-line reference and lint rules
- Features: what works and what is missing
- Playground and changelog
#import "Basic";
#import "Extensions/Json";
User :: struct {
name: string;
languages: [..] string;
}
main :: () {
text := #string JSON
{"name": "Ada", "languages": ["Jai", "C"]}
JSON;
user, error := from_json(User, text);
assert(error.kind == .NONE, "%", error.message);
defer free_json(*user);
print("% writes %\n", user.name, user.languages);
print("%\n", to_json(User.{ name = "Grace" }));
}$ jacket run users.jai
Compiling users (users.jai)
Finished debug [unoptimized] in 0.39s
Running `users`
Ada writes ["Jai", "C"]
{"name":"Grace","languages":[]}Install on macOS or Linux with Homebrew or the install script:
brew install matteopolak/tap/jacket
curl -fsSL https://jacket.matteopolak.com/install.sh | shOn Windows, in PowerShell:
irm https://jacket.matteopolak.com/install.ps1 | iexjacket upgrade updates an installation. Nix, prebuilt archives and CI setup are in install channels.
Start a project and run it:
$ jacket new hello
created program hello in hello: jacket.toml, build.jai, main.jai
$ cd hello
$ jacket run
Compiling hello (build.jai)
Finished debug [unoptimized] in 0.19s
Running `hello`
Hello from hello!Tests are procedures with a @test note, in files under tests/:
// hello/tests/greeting.jai
#import "Basic";
#import "Extensions/Testing";
greets_by_name :: () {
greeting := tprint("Hello from %!", "hello");
expect_equal(greeting, "Hello from hello!");
} @test$ jacket test
Starting 1 test
PASS [ 0.069s] greets_by_name
Summary [ 0.197s] 1 test run: 1 passedjacket.toml holds the settings of every tool, so the editor, the build and CI agree:
[project]
entry = ["build.jai"]
import-path = ["src"] # folders `#import` searches
[format] # jaifmt
indent-width = 4
max-width = 100
[lint.rules] # jailint
unused_variable = "deny"
[test] # jacket test
timeout = 30
[target.pi] # jacket run --target pi
triple = "armv7-unknown-linux-gnueabihf"
runner = "qemu-arm -L {sysroot} {exe}"For editors, install the VS Code extension (also on Open VSX) or jacket.nvim for Neovim 0.11+. Any other editor can run jailsp over stdio.
| Tool | What it does |
|---|---|
jaic |
Compiles Jai to native executables and libraries through LLVM, or runs it in its interpreter (-interp). |
jailsp |
Language server: errors and lints as you type, hover with types and layout, completion with auto-import, go to definition, rename, inlay hints, code actions. |
jailint |
Reports mistakes, memory bugs and performance pitfalls; jacket lint --fix applies the safe fixes. |
jaifmt |
Formats Jai code (rules). |
jacket |
Runs the tools, tests, benchmarks, API docs, dependencies and migrate for older Jai code. |
Jacket runs on macOS (arm64, x86-64), Linux (x86-64, arm64) and Windows (x86-64, arm64). Programs build for those, for WebAssembly, for 32-bit and big-endian Linux, and for boards with no operating system down to the 8-bit AVR (other targets). Cross targets are experimental.
Bug reports and feature requests are welcome as issues. Pull requests are not accepted; see CONTRIBUTING.md. Jacket is a clean-room implementation: contributors must not read the official Jai sources.
AGPL-3.0-or-later, with a runtime library exception: programs you compile with Jacket can use any license. The standard library (stdlib/) is also available under MIT OR Apache-2.0, and the specifications (docs/specs/) are public domain (CC0).