Pa logo v0.1.1 · MIT
60-second setup · pac v0.1.1 · CPython 3.10–3.14

Quickstart

Written by AI, effortlessly reviewed by humans. Install pac, load the bundled agent skills, and start shipping native LLVM binaries without memorizing a new syntax manual first.

01 / 60-Second AI Workflow

Three steps from zero to native LLVM output.

Linux · macOS · Windows
STEP 01 · INSTALL & VERIFY ~15s

Install the compiler CLI, LSP server, and bundled skills from PyPI, then verify llvmlite, Python.h, and your system C linker.

terminal
$ pip install pa-compiler
$ pac doctor
Checks clang / gcc / cl, LLVM backend, and CPython headers.
STEP 02 · INSTALL BUILT-IN AGENT SKILLS 3 skills bundled

Install all three bundled SKILL.md guides in one command. Supported targets: claude, cursor, codex, copilot, github, antigravity, or any custom directory.

install all skills (default: all)
$ pac skill --install claude            # project-local (.claude/skills/)
$ pac skill --install cursor --global   # user-global (~/.cursor/skills/)
$ pac skill --list                      # pa-coder · py-to-pa · cpp-to-pa
pa-coder
0-to-1 Pa projects & .paw
py-to-pa
Port Python hot loops to .so
cpp-to-pa
Migrate C++ to flat RAII .pa
Omit the skill name to install all three, or pass one explicitly (e.g. pac skill py-to-pa --install codex).
STEP 03 · PROMPT YOUR AGENT Copy either prompt directly into Claude Code, Cursor, Codex, or Copilot
PROMPT A · STANDALONE PURE PA pa-coder

“Write a standalone Pa program in main.pa that computes a 100k-point moving average, verify it with pac check --ai-diagnostic, and execute it directly with pac run --mode prod main.pa.”

How to run
$ pac run main.pa
PROMPT B · PYTHON .SO / .PYD ACCELERATOR py-to-pa

“Port the hot loop in scorer.py to an @export Pa kernel using py-to-pa, compile it with pac build --shared into a self-contained direct-import .so / .pyd module (scorer_pa), and verify output parity against Python.”

How to use in Python (zero ctypes)
import scorer_pa
result = scorer_pa.score_batch(buf, 2.0)

That’s it. Hand the rest over to your AI.

With the skills installed, your agent already knows Pa’s zero-annotation syntax, mut() borrow rules, and the pac check --ai-diagnostic deterministic JSON self-healing loop—no manual syntax study required.

Skip to Human Review

02 / Manual Deep Dive

Two production workflows. Same compiler.

Want to drive pac directly? Choose whether you are shipping a standalone native executable or accelerating an existing Python codebase with zero ctypes boilerplate.

PATH A · PURE PA STANDALONE 0 GC · LLVM -O2

Compile a zero-dependency native executable

Pure .pa programs compile straight to native machine code via LLVM—no interpreter, no libpython linked, and zero garbage-collector pauses.

main.pa
def sum_squares(n) -> float:
    total = 0.0
    for i in range(n):
        x = float(i) * 0.001
        total += x * x
    return total

def main() -> int:
    print(sum_squares(100000))
    return 0
run natively
$ pac run main.pa                # dev mode: bounds checks, auto-cleanup
$ pac run --mode prod main.pa    # prod mode: LLVM -O2 (~1.7 MB RSS)
333328333.34999967
Need a distributable standalone binary? Compile explicitly with pac build --mode prod main.pa -o app. For binaries that embed .paw modules across machines, add --relocatable and run pac bundle app --with-stdlib.
PATH B · NATIVE .SO / .PYD FOR PYTHON zero ctypes · self-contained

Drop-in native extension module for Python hot loops

Replace Cython, pybind11, or ctypes wiring. Mark functions with @export and compile with pac build --shared to emit a self-contained .so / .pyd module (zero external DLLs on Windows).

pa_kernel.pa
@export
def dot_scale(xs: span[float], k: float) -> float:
    acc = 0.0
    for i in range(len(xs)):
        acc += xs[i] * k
    return acc
compile & import directly in Python
$ pac build --shared --mode prod pa_kernel.pa -o pa_kernel.so

import array, pa_kernel

# Zero-copy buffer protocol (array.array or NumPy float64 ndarray)
buf = array.array("d", [1.5, 2.5, 3.5, 4.5])
print(pa_kernel.dot_scale(buf, 2.0))   # 24.0
Need the reverse direction (Pa calling NumPy, PyTorch, or SQLite)? Place third-party Python imports inside a typed <tool>.paw module with a locked In -> Out signature; Pa passes zero-copy read-only memoryview buffers and traps boundary faults into pa_boundary_fault.json.

03 / Human Review Cheatsheet

Key differences from Python when reviewing AI code

Every .pa file parses with standard ast.parse, so control flow reads like Python. Focus your 30-second audit on these five systems-level invariants.

5 mental-model shifts · 0 lifetime sigils
01 · Static Types & Width
PA_E086 · PA_E030
Python Habit Variables change type freely, ints have arbitrary precision, and lists can mix element types.
Pa Reality Local types are inferred statically and stay fixed. int (int64) and float (float64) are 64-bit defaults; narrow widths (int32, uint8, float32) are explicit, and mixed records use flat @struct classes.
02 · Borrows & mut()
PA_E050 · PA_E089
Python Habit Passing a list to a helper lets that helper mutate it silently; b = a aliases the same list.
Pa Reality Containers borrow read-only by default (const T&). In-place mutation must be marked explicitly at the call site with mut(xs), aliasing a mutable borrow is rejected, and b = a deep-copies.
03 · Flat RAII & Bounds
0 GC · PA_E073
Python Habit A garbage collector frees heap objects unpredictably, and a[-1] indexes from the end.
Pa Reality Fixed lists (≤ 64 KB) stay on the stack; dynamic Vec[T] auto-frees deterministically at scope exit. Indexing is strictly 0 <= i < len (use a[len(a) - 1], bounds-checked in --mode dev).
04 · .pa / .paw Wall
PA_E001 · PA_E002
Python Habit Import numpy, sqlite3, or any third-party package directly inside compute loops.
Pa Reality Pure .pa forbids third-party Python imports. External libraries live strictly in typed .paw boundary files and cannot be called inside hot loops (batch first).
05 · Semantics & LSP Audit
pac check · pac lsp
Python Habit Floored modulo on negative numbers; manually guessing object sizes and heap allocations.
Pa Reality % and // follow C semantics (truncate toward zero). Run pac check --ai-diagnostic for JSON repair tickets, or hover any variable in VS Code (pac lsp) to see LLVM layout, byte size, and RAII free lines.

Want the full compiler internals?

Explore bidirectional type inference, flat CSR jagged arrays, RAII escape analysis, and the .paw C ABI.