Getting started with Tabby
From a single install command to a distributable program. The full language reference ships with the toolchain's sources (and installs as an Agent Skill); this page covers everything needed to get things running. The package manager tp, the standard library and the registry's own docs live on the registry site.
Install
The installer puts down two things: the toolchain (cl / mk /
vm / tabby / dbg plus the JSON and SQLite plugins), and the
environment: TABBY_BIN, TABBY_LIB and PATH.
The package manager tp is installed separately, on top of the toolchain — see below.
# PowerShell
PS> irm {{ORIGIN}}/install.ps1 | iex
# cmd.exe
> powershell -c "irm {{ORIGIN}}/install.ps1 | iex"
You can also download tabby-setup.cmd and double-click it, or take an
offline archive from the downloads and double-click its install.cmd.
Requires 64-bit Windows 10/11 and the Microsoft Visual C++ runtime (the installer says so when it is missing;
-InstallVCRedist installs it).
$ curl -fsSL {{ORIGIN}}/install.sh | sh
# with options
$ curl -fsSL {{ORIGIN}}/install.sh | sh -s -- --prefix /opt/tabby
x86_64 and aarch64, glibc 2.28 or newer (RHEL/Alma/Rocky 8, Debian 10, Ubuntu 20.04 and later; OpenSSL is
linked into the binaries). Runtime dependencies are libffi8, zlib and
libzstd — the installer lists anything missing and prints the install command.
Offline: tar xzf tabby-<version>-linux-x64.tar.gz && sh tabby-<version>-linux-x64/install.sh
(use the linux-arm64 archive on aarch64).
What the installer changes
| Item | Windows | Linux |
|---|---|---|
| Toolchain | %USERPROFILE%\.tabby\bin | ~/.tabby/bin |
| TABBY_BIN | user environment variable → the bin above | a marked block in ~/.profile, ~/.bashrc (and ~/.zshrc when present) |
| TABBY_LIB | kept if already set (the VM reads exactly one library directory), otherwise ~/.tabby/lib | |
| PATH | bin prepended to the user PATH | bin added inside the same marked block |
Environment variables apply to new terminals; running the installer again upgrades in place and never adds a second PATH entry.
Options
| PowerShell | sh | Meaning |
|---|---|---|
-Prefix DIR | --prefix DIR | install directory, default ~/.tabby |
-Lib DIR | --lib DIR | set TABBY_LIB |
-NoModifyPath | --no-modify-path | leave PATH alone |
-Uninstall [-Purge] | --uninstall [--purge] | uninstall (a tp in the same directory goes too); Purge also deletes the packages under ~/.tabby/lib |
When passing arguments through irm | iex or curl | sh is awkward, use the environment
variables TABBY_PREFIX and TABBY_INSTALL_LIB.
Then the package manager, tp
The standard library ships with the toolchain (in $TABBY_BIN/stdlib, pre-compiled), so it needs
no package manager. Databases, object storage, etcd, mail, SMS and payment come from the registry site, a
separate site with its own installer: once the toolchain is in place, copy the one-line command from the
registry site. Its installer finds the toolchain in ~/.tabby/bin,
puts the tp command in the same directory and records the registry site's address (package contents
are served by its download site deps.tabby.org / deps.tabby.org.cn over a CDN).
# Windows PS> irm <registry site>/install.ps1 | iex # Linux $ curl -fsSL <registry site>/install.sh | sh
Your first program
// hello.tb
var string name = `Tabby`
print(`Hello, ${name}!`)
$ tabby run hello.tb Hello, Tabby!
tabby run runs a source file directly: it compiles, resolves the modules named by use
(same directory, deps/, TABBY_LIB) and runs. tabby repl opens an
interactive session.
Projects and manifests
A program you intend to distribute is described by a manifest: entry module, local modules, dependencies.
# hello.manifest name=hello package=com.example appid= version=1.0 author=me icon= main=main mod=main dep=jsondb
| Field | Meaning |
|---|---|
main= | entry module (must be one of the mod= or a static dep=) |
mod= | local module, packed into the .t |
dep=name | dependency, dynamic by default: loaded at run time from the program's deps/ or from TABBY_LIB |
dep=name static | dependency packed into the .t: a single file that needs no TABBY_LIB |
$ tabby build hello.manifest # incremental compile + package, writes hello_com.example_1.0.t $ tabby run hello.manifest # the same, then run it $ vm hello_com.example_1.0.t # run the packaged program directly
Compiled bytecode lands in a .tbc/ directory next to the source; one line in
.gitignore (.tbc/) is enough.
Dependencies and packages
dep=name in the manifest records only the library's name; it is resolved at run time:
first deps/<name>/ next to the program, then TABBY_LIB/<name>/. A packaged
.t carries no library code, so upgrading a library needs no repackaging; dep=name static
instead packs the library in and freezes its version.
use jsondb var dict db = jsondb.jsondb_open(`mydb`) var dict doc = dict_new() dict_set(doc, `name`, `Alice`) print(jsondb.jsondb_insert(db, `users`, doc)) jsondb.jsondb_close(db)
Transitive dependencies go in the manifest too. The VM does not follow
use to load a dependency's own dependencies; the manifest lists the whole closure (dependencies
first). tp prints the dep= lines you need when it installs something.
Standard library modules (http_client, http_server, http2_*,
hpack, ws, jsondb, totp, gui) ship with the
toolchain in $TABBY_BIN/stdlib: write the dep= line, nothing to install. Everything
else (databases, S3, etcd, mail, cloud services and payment) gets into TABBY_LIB through the
package manager: tp install redis downloads, verifies and compiles in place. Search, installing,
publishing your own packages and the review process are documented on the
registry site.
Commands
| Command | Does |
|---|---|
tabby run <file> | run a .tb / .manifest / .t; a manifest is compiled and packaged incrementally |
tabby build <manifest> | build without running; -r strips the embedded sources |
tabby repl | interactive session |
tabby -v | versions of tabby / cl / mk / vm |
cl file.tb | compile a single module into .tbc/ |
mk app.manifest | package into a .t |
vm [flags] app.t [args] | run; VM flags such as --sandbox, --deny, --grant go before the program file |
vm -d app.t + dbg | remote debugging |
The package manager's commands (tp search / install / publish …) are on
the registry's docs.
Environment variables
| Variable | Used for |
|---|---|
TABBY_BIN | toolchain directory (cl / mk / vm), set by the installer |
TABBY_LIB | library directory: the VM loads dynamic dependencies from here (tp installs into it) |
TABBY_PATH | extra source search directories when running a .tb directly |
Language tour
- Strings use backticks:
`hello ${name}`interpolates; three backticks start a multi-line string - Comments are
//only;^is exponentiation, usebit_xor(a, b)for XOR - Variables carry a type:
var string s,var int n,var dict d; usevar anywhen it varies - A missing dict / list entry yields
notfound, which fits only in avar any— check withdict_hasfirst - One statement per line; a newline inside parentheses continues the statement
- Functions:
function f(a, b) : { ... }; events:event e(x) :with attribute blocks such asbody:, fired withemit/await - A module is a file:
use otherthenother.fn(); another module's variables are read-only from outside
function fib(n) :
{
if (n < 2) {
return n
}
return fib(n - 1) + fib(n - 2)
}
var dict ages = dict_new()
dict_set(ages, `alice`, 30)
if (dict_has(ages, `bob`)) {
print(dict_get(ages, `bob`))
} else {
print(`fib(20) = ${fib(20)}`)
}
FAQ
tabby is "command not found" after installing
Environment variables apply to new terminals only. On Windows close and reopen the terminal; on Linux start a
new shell or run . ~/.profile.
On Windows vm.exe exits immediately complaining about VCRUNTIME140.dll
Install the Visual C++ runtime, or re-run the
installer with -InstallVCRedist.
On Linux: GLIBC_2.28 not found or a missing libffi.so.8
The distribution is too old, or runtime libraries are missing. Debian / Ubuntu:
sudo apt install libffi8 zlib1g libzstd1; glibc 2.28 or newer is required
(RHEL/Alma/Rocky 8, Debian 10, Ubuntu 20.04 and later).
I already have my own TABBY_LIB
The installer keeps it; use -Lib / --lib to point somewhere else.
tp is "command not found"
tp does not ship with the toolchain; install it from the registry site with the command there (the standard library does not need it).
Runtime error Cannot resolve dynamic dependency
The manifest's dep= is in neither deps/, $TABBY_BIN/stdlib nor
TABBY_LIB: tp install it, check that the toolchain is complete (the standard library
ships with it), or check whether a transitive dependency is missing from the manifest.
How do I uninstall
Run the installer with -Uninstall / --uninstall; a tp in the same directory is removed
too (it cannot run without the toolchain). Installed packages are kept unless you add
-Purge / --purge.