This is the specification for the legacy PCB — the original, standalone form of the Pocket / Cup / Box language, before it was pulled into trainingGround and before the major architectural changes that followed. It is preserved deliberately as a speciation point: the seed from which later flavors of the language descend.
It is not the current PCB. The features here are the foundation; the richer behavioral systems of the modern language — inverted-mode operator dispatch, container persistence, pocket starvation policies, seam-crossing, flow-powered tick loops, the multi-pass knot topology analyzer, and ?box type inference — are later additions and are not part of this legacy version. Section six states that boundary explicitly.
PCB is built around one idea most languages ignore: code can run in two directions. Every keyword has a mirror — the character-reversed spelling — and the forward form and its mirror are syntactically distinct but semantically paired. Running a program backward is not reversing its output; it is a structurally different traversal of the same code through the same environment. The commitment reaches into the lexer (mirrored keywords are separate token types), the parser, the resolver, and the interpreter. The pairing not ↔ knot is load-bearing — the reverse of not is knot, which is why one of the container types is the knot.
A PCB program is processed in five stages. The scanner lexes (mirrored keywords become distinct token types); the grouper performs a second structural pass over the token stream; the parser builds the AST; the resolver computes scope distances, walking declarations forward or in reverse to match the execution direction; and the tree-walk interpreter evaluates the AST under a single forward flag. The orchestrator Box.Box.Box wires these together.
PCB organizes values into a container hierarchy. The legacy establishes the eight-container vocabulary — four forward containers and their four reverse mirrors — in both the runtime type enum and the runtime instance classes. All instances descend from a common Instance base. In the legacy form these containers establish the type vocabulary and runtime representation that the modern language later elaborates with richer behavioral contracts.
| forward | reverse | runtime instance | role |
|---|---|---|---|
| box | xob | BoxInstance | pure data container |
| cup | puc | CupInstance | code / execution block |
| pkt | tkp | PocketInstance | ecosystem container |
| knt | tnk | KnotInstance · TonkInstance | orientation / crossing |
Primitive value types carry reversed forms too: Int/Tni, Double/Elbuod, Bin/Nib, Char/Rahc, String/Gnirts, Boolean/Naeloob — plus the null family (NULL · NILL · LLUN · LLIN), Any, Type/Epyt, and Function.
Bidirectionality is enforced at the environment level, not merely syntactically. When any value is defined — a variable, a function, or a type — it is bound under both its forward name and its mirrored name as separate bindings. A function declaration carries both a forward identifier and a backwardIdentifier, so it is reachable from either direction. The resolver walks declarations in forward order when execution runs forward and in reverse order when it runs backward, computing the scope distances used for direct-index lookup. The interpreter holds a single forward flag — flipping it traverses the same AST in the opposite direction through the same environment. A program authored entirely in forward PCB can be executed backward by flipping one flag.
The dynamic type tag #HATTAG (mirror #GATTAH) is recognized case-insensitively across all capitalization variants — the legacy basis for runtime-typed values.
The math sub-language. PCB embeds a second, self-contained language for mathematics, with its own scanner, parser, interpreter, syntax, and token set — including a MathDeriver that computes symbolic derivatives. It is a language within the language, and one of the legacy's most complete subsystems.
FL* world-reach commands. PCB includes first-class commands for creating, moving, and destroying named entities — FLCreate, FLMove, FLDestroy, and variants. In the legacy form these are fully decoupled from any external host: they operate on a self-contained, in-interpreter entity registry, with a read-only view. The language keeps its "reach into a world" capability as a pluggable principle while standing entirely on its own.
To keep the boundary with the modern language explicit, the following constructs described on the current PCB page are trainingGround-era additions and are not part of this legacy version. They grew later — the legacy is the foundation they grew from.
- Inverted-mode operator dispatch —
pucflipping the arithmetic / comparison dispatch table. Not present. - Container persistence — serializing system-container state across JVM sessions. Not present.
- Pocket starvation policies & seam-crossing — context transfer between pockets and
tkp. Not present. - Flow-powered tick loops — the
"(."flow connector as the power source for autonomous pockets, heat death. Not present. - The multi-pass knot topology analyzer — SETUP / ENTRY / UNWIND region resolution over interleaved bracket topology. Not present.
?boxuser-defined type inference — slot-pattern matching over registered types. Not present.