Skip to content

Source, declarations, and types ​

Lexical rules ​

Stated source is case-insensitive ASCII prose. Words may contain internal hyphens. Whitespace is insignificant. Period, comma, semicolon, and apostrophe are tokens; fixed punctuation in a grammar form is required.

Bare decimal literals, string literals, quoted names, parentheses, and source comments are unavailable. The only authored integer literal is one; zero is normally constructed as the checked difference of one and one. Code blocks marked Runnable source contain exact programs. Blocks marked Grammar template use uppercase placeholders and are not runnable.

Single-document project declarations ​

Grammar template:

text
The program accepts DECLARATION [, DECLARATION] and DECLARATION.
The program computes the following result.
COMPUTATION

Declarations may be separate sentences or a joined list. Every input is mandatory and ordered. Project syntax supports:

Source declarationInternal typeRuntime JSON
an integer named limitint64integer in signed 64-bit range
an integer sequence named inputsequence<int64>array of signed 64-bit integers

Declaration or is rejected. Comma lists require a final and, optionally preceded by an Oxford comma. another is legal only for a noninitial item whose explicit type appeared earlier in that same list. It creates a fresh input and carries no equality constraint. Duplicate names, omitted types, and initial another are errors.

The name limit creates source form the limit and runtime key "limit". Names do not create executable behavior.

Broader context interface ​

The context-and-vocabulary CLI supports types that the project preamble cannot declare:

Context typeRuntime encodingAvailability
int64JSON integerinput, scalar result
pair<int64,int64>array of exactly two integersbounded input, construction, projection, state, result
sequence<int64>integer arrayinput, private storage, result
sequence<sequence<int64>>array of integer arraysread-only input and checked row selection

Context JSON contains ordered input objects with stable id, nonempty source forms, and type. Optional groups name existing inputs only where a grammar position admits a group; they do not create a type or value.

Runtime input is exactly one JSON object. Every declared key must occur once; unknown keys, missing keys, duplicate or escaped-equivalent keys, null, fractions, out-of-range numbers, malformed shapes, and trailing JSON are rejected.

References, aliases, and ambiguity ​

References may denote context inputs, prior prepared results, a current occurrence, accumulated state, construction-owned storage, tabulation state, or other fixed scoped declarations. Scope-owned references do not escape their construct.

Resolution chooses a unique declaration before type checking. Longest spelling, vocabulary order, and a later type match do not break ties. Multiple aliases of the same declaration count once; separate declarations with an overlapping phrase are ambiguous. Prepared/context collisions are diagnosed at use.

Ownership ​

Inputs and definition formals are stable and read-only. Fresh sequence, worklist, accumulator, and table storage remains private. Scalars and pairs copy by value; public sequence results are copied into caller-owned storage. Failure publishes no partial result.

Stated compiles controlled English deterministically. It does not call an LLM at compile time.