Grammar
COMPILABLE SOURCE blocks can be saved in a .ce file. SCHEMATIC TEMPLATE blocks contain placeholders and cannot be compiled.
A complete project
COMPILABLE SOURCE
The program accepts an integer sequence named input.
The program accepts an integer named threshold.
The program computes the following result.
Collect the input values in encounter order into a fresh sequence.
Retain each value only when it is greater than the threshold.
Replace each retained value with the doubled value of that value before appending it.Inputs: input: sequence<int64>, threshold: int64
Result: sequence<int64>
Order: input declarations precede the computation boundary. The computation runs once.
Scope: declared inputs are read-only and visible after the boundary.
Rejected: The program accepts another integer named limit. fails because another cannot start a declaration list.
Joined declarations may use and and an optional Oxford comma. Every declared key is required. Declaration or, duplicate names, and omitted types fail compilation.
Collection, condition, and transformation
SCHEMATIC TEMPLATE
Collect SEQUENCE values in encounter order into a fresh sequence.
Retain every occurrence.SCHEMATIC TEMPLATE
Collect SEQUENCE values in encounter order into a fresh sequence.
Retain each value only when BOOLEAN-CONDITION.
Replace each retained value with INTEGER-EXPRESSION before appending it.Input: sequence<int64>
Result: sequence<int64>
Order: items run from first to last. The condition runs before the replacement. A false condition skips the replacement and append.
Scope: that value names the current integer. The destination reference names only the result built so far.
Rejected: Collect the input in encounter order into a fresh sequence. fails because an input reference requires the occurrence word values.
Aggregation
SCHEMATIC TEMPLATE
Sum SEQUENCE values in encounter order.
Include every occurrence.SCHEMATIC TEMPLATE
Count SEQUENCE values in encounter order.
Include each value only when BOOLEAN-CONDITION.Input: sequence<int64>
Result: int64
Order: items run from first to last. Count adds 1; sum adds the current integer with checked addition.
Scope: the current value exists only inside the inclusion condition.
Rejected: a sequence-valued inclusion condition produces a type diagnostic.
Boolean coordination
SCHEMATIC TEMPLATE
PREDICATE and it PREDICATE
PREDICATE, it PREDICATE and it PREDICATE
PREDICATE, it PREDICATE, and it PREDICATEThe same forms accept or.
Inputs: Boolean predicates over visible values
Result: boolean
Order: and stops at the first false predicate. or stops at the first true predicate.
Scope: every predicate uses the scope of its containing collection, aggregation, or outer conditional.
Rejected: A and B, C should fail because a comma list needs a final connector. The current parser incorrectly accepts it. See status.
Mixed and and or forms fail because grouping and connector precedence are not implemented.
Outer conditional
SCHEMATIC TEMPLATE
If COMPARISON, COMPUTATION Otherwise, COMPUTATIONInputs: one supported comparison and the inputs used by both branches
Result: the shared result type of both branches
Order: the comparison runs first. Exactly one branch runs. Both branches are compiled.
Scope: branch-local current values and state do not escape the branch.
Rejected: branches with different result types produce a type diagnostic. A directly nested outer conditional produces a syntax diagnostic.
Preparation
SCHEMATIC TEMPLATE
First compute EXPRESSION. Then compute EXPRESSION. Then COMPUTATIONInputs: visible values consumed by each expression
Result: the final computation result
Order: each expression runs once from left to right before the final computation.
Scope: a prepared result is visible only after its declaration and inside the containing computation.
Rejected: pair results cannot be prepared. Using a prepared name before its declaration produces a scope diagnostic.
Integer and sequence expressions
SCHEMATIC TEMPLATE
one
VISIBLE-INTEGER
the length of SEQUENCE
the value at position INTEGER in SEQUENCE
the pair consisting of INTEGER and INTEGER
the first component of PAIR
the second component of PAIR
the sum of INTEGER and INTEGER using checked addition
the difference of INTEGER and INTEGER using checked subtraction
the quotient of INTEGER and INTEGER using checked division
an empty sequence
the sequence consisting of INTEGER followed by INTEGER valuesInputs: int64, pair<int64,int64>, or supported integer sequences as shown
Results: int64, pair<int64,int64>, or sequence<int64>
Order: operands and constructed sequence items run from left to right.
Scope: scoped references must belong to the active operation.
Rejected: bare decimal literals other than the fixed word one produce a syntax error. Indexed reads outside 0 <= position < length return execution_bounds.
Accumulation and repetition
SCHEMATIC TEMPLATE
Iterate from INITIAL using TRANSITION in SEQUENCE for PARAMETER.
Before each update, continue only when INTEGER is greater than INTEGER.
Return the first component of the accumulated value.Inputs: an int64 or pair<int64,int64> state plus the operands declared by the selected transition
Result: the final state or one supported observation
Order: the guard runs before each update. State changes only after the transition succeeds.
Scope: accumulated state exists only inside the loop and its result clause.
Rejected: a loop with no control policy or two control policies produces a syntax diagnostic. Transition input and result state types must match.
Worklists
SCHEMATIC TEMPLATE
Process SEQUENCE values using a first-in, first-out worklist.
WORKLIST-ADMISSION-AND-RECORDING
Append each removed value to a fresh sequence.
OPTIONAL-TARGET-STOP
Expand each removed value using PARAMETERIZED-SEQUENCE-CONCEPT.
Continue until the worklist is empty.last-in, first-out selects stack removal.
Inputs: seed sequence<int64> and any source required by the expansion phrase
Result: sequence<int64>
Order: admission records a value before enqueue. Removal appends to the result before the target test. Expansion runs after the target test.
Scope: pending, discovered, and result lists are private to one run.
Rejected: a missing adjacency row returns execution_bounds. A stopping relation other than exact integer equality fails compilation.
Integer tables
SCHEMATIC TEMPLATE
Build a table from SEEDS values in encounter order.
Until its length reaches LENGTH length, extend it using RECURRENCE over SEQUENCE.
Return the completed table.Input: integer seeds, an int64 length, and an optional sequence<int64> used by the recurrence
Result: sequence<int64> or one supported int64 observation
Order: seeds are copied first. Length is checked before each append. The recurrence reads the completed prefix.
Scope: the table is private and append-only.
Rejected: a recurrence with an incompatible input frame or non-integer result produces a type diagnostic.