Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Installation

POSIX shell (Linux, macOS, FreeBSD):

curl -fsSL https://raw.githubusercontent.com/abit-foggy/pith/main/install.sh | sh

Windows (PowerShell):

iwr https://raw.githubusercontent.com/abit-foggy/pith/main/install.ps1 -UseBasicParsing | iex

Windows (Command Prompt):

curl -fsSL https://raw.githubusercontent.com/abit-foggy/pith/main/install.cmd -o install.cmd && install.cmd

This downloads the latest release and installs under a prefix (~/.local on POSIX, %LOCALAPPDATA%\pith on Windows NT):

PathWhat it is
<prefix>/bin/pithThe toolchain binary (libtcc embedded statically)
<prefix>/lib/pith/tcc/libtcc1.aThe vendored tcc runtime
<prefix>/lib/pith/runtime/libruntime.aThe ARC runtime library
<prefix>/include/pith.h (+ other headers)The FFI and ABI headers

Add <prefix>/bin to your PATH if it isn’t already (the installer prints the exact command).

macOS note

The installer checks for the Xcode command line utilities (they provide clang and the SDK). If missing, it offers to install them (xcode-select --install, password prompt).

Installer overrides

PREFIX=/usr/local sh install.sh          # install system-wide (POSIX)
PITH_REPO=owner/pith sh install.sh       # use a fork
PITH_TAG=v0.1.0 sh install.sh            # install a specific version

From source

git clone --recurse-submodules https://github.com/abit-foggy/pith
cd pith
make

The vendored tcc is a git submodule, the build compiles it automatically. If you cloned without --recurse-submodules:

git submodule update --init

Then run the test suite to verify:

make check

External tools

Pith needs one external tool at runtime:

ToolPurposeInstall
qbeLowers QBE IL to machine assemblyQBE

The assembly is assembled in-process by the embedded tcc’s built-in assembler (Linux, Windows NT, FreeBSD); on Darwin, clang’s assembler is used (from the Xcode command line utilities). mold is optional (Darwin AOT builds only).

Verify

pith version
# pith 0.1.0

pith engine
# pith engine report
#   host os           : linux
#   execution backend : libtcc (in-memory)
#   aot linker        : tcc (embedded, in-process)
#   qbe               : /usr/bin/qbe
#   ...

What’s inside a release

FileDescription
pithThe toolchain binary, libtcc is embedded statically
libtcc1.atcc runtime, needed by the JIT at relocate time
libruntime.aThe ARC runtime, linked into pith build output
include/pith.hThe FFI header for imported C modules
include/api.hRuntime ABI bindings
include/compiler.hInternal API (tokens, AST, engine)
include/pith_embed.hEmbeddable C host interface