Guide
Command-line tools
Since Sprint 23, programs read their arguments and environment — render pipelines become real CLI tools.
fn main(sys: Env) -> Void:
let a = args()
if a.len() != 2:
print("usage: ptc run tool.pt <input> <output>")
return
let mode = sys.var("TOOL_MODE")
print("rendering {a[0]} to {a[1]} (mode: {mode})")$ ptc run tool.pt in.pti out.ppm
Recorded output of the real compiler
args() -> List[Text] holds everything after the file on the ptc run command line — no argv[0] to skip, no separate count, and main keeps its single canonical shape. Reading the environment is the Env capability (spec §29): take an Env in main and call sys.var(name) -> Option[Text]; unset is None, never an error. The old ambient env(name) builtin is retired — a capability makes the effect visible in the signature.