Guide
Getting started
POLYTONE programs live in .pt files. The compiler, ptc, type-checks, runs, tests, and builds them — one binary, no project scaffolding.
fn main() -> Void:
let name = "world"
print("Hello, {name}!")
print("2 + 2 = {2 + 2}")$ ptc run hello.pt
Recorded output of the real compiler
main() is the entry point. Top-level statements run first, then main is called automatically. Blocks are indented with exactly four spaces — there is one canonical formatting, so there is nothing to argue about and nothing for a code generator to get wrong.
Grab a native build for Windows, macOS, or Linux from the Download page — or build once from the repository. Either way the whole toolchain is available:
cd compiler
cargo build --workspace
ptc run file.pt # type-check and execute
ptc test file.pt # run the file's test blocks
ptc check file.pt # type-check only
ptc build file.pt # compile the scalar subset to WASM