OQ-001: Statement Termination and Block Boundaries¶
Status: ACCEPTED Accepted: 2026-11-08 Decision: Explicit semicolon termination with typed block endings Category: Core Language Syntax
1. Decision¶
Kyllo will use explicit semicolons to terminate simple statements and declarations. Compound structures will use explicit, typed block-ending keywords.
The language will not use automatic semicolon insertion or newline-based statement termination.
This approach prioritizes predictable parsing, clear diagnostics, and consistent source interpretation.
2. Statement Termination¶
Every complete simple statement and declaration MUST terminate with a semicolon (;).
Examples:
LET name: String = "Adam";
LET balance: Decimal = 100.00;
balance = balance + 25.00;
PRINT(balance);
RETURN balance;
A missing semicolon MUST produce a compiler diagnostic.
The compiler MUST NOT silently insert missing semicolons.
Simple declarations¶
Simple declarations MUST terminate with a semicolon.
This includes, where applicable:
- Variable declarations.
- Constant declarations.
- Individual type fields.
- Individual properties.
- Individual interface members.
- Individual trait members.
- Other simple declarations defined by the language grammar.
Examples:
3. Compound Block Termination¶
Every compound language structure MUST use an explicit, typed block-ending keyword.
Proposed forms:
| Opening structure | Required terminator |
|---|---|
| FUNCTION | END FUNCTION; |
| TYPE | END TYPE; |
| MODULE | END MODULE; |
| IF | END IF; |
| WHILE | END WHILE; |
| FOR | END FOR; |
Syntax requirements:
- Generic
END;terminators are not permitted. - Every block terminator MUST identify the structure it closes.
- Block terminators MUST match their corresponding opening structures.
- Nested blocks MUST close in reverse order of opening.
ELSEand other intermediate clauses MUST NOT independently terminate their parent structure.- Every typed block terminator MUST end with a semicolon.
- Missing, unexpected, or mismatched block terminators MUST produce compiler diagnostics.
Example:
IF balance > 0
PRINT(balance);
ELSE
PRINT(0);
END IF;
WHILE balance > 0
balance = balance - 1;
END WHILE;
FUNCTION calculate() -> Integer
RETURN 42;
END FUNCTION;
Compound declarations¶
Compound declarations MUST terminate with their corresponding typed block terminator.
This includes:
- Functions.
- Types.
- Modules.
- Interfaces.
- Traits.
- Other compound declarations defined by the language grammar.
Examples:
TYPE Account:
balance: Decimal;
END TYPE;
FUNCTION calculate() -> Integer
RETURN 42;
END FUNCTION;
MODULE Banking
// Module contents
END MODULE;
No redundant termination¶
A compound declaration MUST NOT require an additional semicolon after its typed block terminator.
The typed terminator already includes its required semicolon.
Correct:
Incorrect:
4. Newlines and Indentation¶
Newlines and indentation are formatting only. They MUST NOT determine statement termination or program semantics.
The following examples MUST be semantically equivalent:
The parser MUST determine statement boundaries through grammar and explicit terminators, not source line positioning.
5. Empty Statements¶
Standalone empty statements MUST NOT be permitted in the initial language.
For example:
MUST produce a compiler diagnostic.
This restriction may be reconsidered through a future language-design decision if a legitimate use case emerges.
6. Comments¶
Comments MUST NOT terminate statements or alter their semantics.
A statement MUST still contain its required semicolon before an end-of-line comment.
Example:
7. Grammar Requirements¶
The formal grammar MUST explicitly define:
- Simple statement termination.
- Declaration termination.
- Declaration classification — which declarations are simple and which are compound.
- Compound block opening and closing.
- Typed block terminators.
- Nested block matching.
- Comment handling.
- Empty statement rejection.
- Permitted whitespace and line breaks.
The formal grammar is responsible for identifying which declarations are simple and which are compound. No additional declaration categories or syntax are defined by this proposal merely to populate the examples. If an existing declaration category cannot be classified confidently from the current specification, it MUST be identified as unresolved rather than guessed.
Closing parentheses and other structural delimiters MUST NOT require additional semicolons unless explicitly specified by the grammar.
For example, function parameter lists terminate through their closing parenthesis. They do not require a semicolon before the function body.
8. Rationale¶
Explicit terminators provide several advantages:
- Predictable parsing without automatic insertion rules.
- Clearer syntax diagnostics.
- Consistent behavior across formatting styles.
- Easier source generation by AI agents.
- Explicit nested block boundaries.
- Reduced ambiguity between declarations and expressions.
The design also supports Kyllo's broader philosophy: language behavior should be explicit rather than dependent on hidden conventions.
9. Consequences¶
The following documentation MUST be updated to reflect this decision:
- TECHSPEC-01: Source File Structure
- TECHSPEC-20: Formal Grammar
- TECHSPEC-39: Expressions and Evaluation Order
- Language Guide: Syntax
- Getting Started: Examples
Existing examples MUST be audited for compliance.
The lexer, parser, grammar tests, and diagnostic tests MUST implement and enforce these rules.
10. Acceptance Criteria¶
OQ-001 may be marked ACCEPTED when:
- The statement termination rules are incorporated into the normative specification.
- All compound structures have explicitly defined typed terminators.
- Generic
END;terminators are specified as rejected. - Nested block matching in reverse order of opening is specified.
- Intermediate clauses such as
ELSEare specified as not independently closing their parent structure. - The formal grammar describes the complete rules.
- Newlines and indentation are confirmed as semantically insignificant.
- Empty statement behavior is specified.
- Existing examples are consistent with the decision.
- No conflicting syntax rules remain elsewhere in the documentation.
- Simple declarations require semicolons.
- Compound declarations require their typed block terminators.
- No additional semicolon is required after a typed block terminator.
- Every declaration category is accounted for by the formal grammar.
11. Implementation Notes¶
This decision establishes the intended syntax. It does not imply that the compiler already implements or validates these rules.
Compiler implementation and conformance testing remain separate requirements.
12. Acceptance¶
Accepted on 2026-11-08, after three refinement rounds (0.2.4 proposal, 0.2.5 typed block terminators, 0.2.6 declaration termination rules). The acceptance criteria in §10 were verified during documentation integration:
- The statement termination rules are incorporated into the normative specification — TECHSPEC-01, TECHSPEC-20, and TECHSPEC-39 amendments.
- All compound structures have explicitly defined typed terminators — TECHSPEC-20 amendment, §B.
- Generic
END;terminators are specified as rejected — TECHSPEC-20 amendment, §§A–B. - Nested block matching in reverse order of opening is specified — TECHSPEC-20 amendment, §C.
- Intermediate clauses such as
ELSEare specified as not independently closing their parent structure — TECHSPEC-20 amendment, §C. - The formal grammar describes the complete rules — TECHSPEC-20 amendment, §B, for the OQ-001 scope. Other items in TECHSPEC-20 §11 remain open.
- Newlines and indentation are confirmed as semantically insignificant — TECHSPEC-01 and TECHSPEC-20 amendments.
- Empty statement behavior is specified — TECHSPEC-20 amendment, §D.
- Existing examples are consistent with the decision — 156 corrections applied to 26 files (152 audit findings plus 4 terminator-form corrections for MATCH and IMPORT, whose forms are attested in the source and whose constructs are established grammar categories). ENUM, TEST, and PARALLEL termination is explicitly unresolved (see below) and their examples were left in their original form. Remaining ambiguities are listed below.
- No conflicting syntax rules remain elsewhere in the documentation — cross-document consistency audit completed 2026-11-08: zero prose conflicts found. The glossary and cross-reference index gained entries for the new terminology.
- Simple declarations require semicolons — TECHSPEC-20 amendment, §B.
- Compound declarations require their typed block terminators — TECHSPEC-20 amendment, §B.
- No additional semicolon is required after a typed block terminator — TECHSPEC-20 amendment, §§A–B.
- Every declaration category is accounted for by the formal grammar — TECHSPEC-20 amendment, §B. Interface and trait declarations remain undefined in the grammar; their terminators apply if and when the grammar defines those declarations.
Interpretations recorded at acceptance¶
- Conditional header colons are unchanged. The record's illustrative
examples show
IF balance > 0/ELSEwithout header colons; those examples illustrate termination only. The conditional header syntax — including:after the condition and afterELSE— is as defined in TECHSPEC-20 §6 and in every source example, and is unchanged by OQ-001. - MATCH terminator established; MATCH grammar pending.
MATCHis an established compound statement (match_statementis listed in thestatementalternatives of TECHSPEC-20 §6) and the terminator formEND MATCHis attested (TECHSPEC-4 §3), so by the general typed-terminator rule the terminator isEND MATCH;. The complete MATCH grammar — arm syntax, pattern syntax, exhaustiveness rules — is NOT established by OQ-001 and remains pending (TECHSPEC-20 §11). The arm forms in examples are illustrative only. - ENUM, TEST, and PARALLEL terminators are unresolved.
Post-acceptance reconciliation (2026-11-08) established that a
terminator beyond the OQ-001 table requires the construct to be an
established grammar category as a compound declaration or statement
with an attested terminator form. None of the three meets that test:
the grammar defines
enum_definitiononly as a variant oftype_definitioninside aTYPEdeclaration (TECHSPEC-20 §4), so there is no standaloneENUMdeclaration and noEND ENUMterminator;TESTappears in exactly one example and in no grammar production;PARALLELappears in exactly one example and its syntax is listed as incomplete in TECHSPEC-20 §11. Ten corrections applied at acceptance for these forms were reverted; their examples show the original forms and must not be treated as established syntax. - IMPORT is a simple declaration and terminates with
;.import_declarationis an established grammar production (TECHSPEC-20 §3) with no body or block structure, so by the record's classification it is a simple declaration.
Remaining ambiguities (not resolved by OQ-001)¶
ENUMtermination is unresolved. The grammar defines enum only as part of aTYPEdeclaration; the standaloneENUM <Name>:form, enum member termination, and anyEND ENUMterminator are unestablished. An enum written as part of aTYPEdeclaration is closed by that declaration'sEND TYPE;.TESTandPARALLELtermination is unresolved. Neither construct is an established grammar category; their terminators cannot be assigned without inventing them.TRANSACTION:,LOG,STATE_MACHINE, andTRANSITIONblocks have no attested terminator form in the source; their terminators are undecided and their examples were left uncorrected.- Function-signature-only fragments, ellipsis (
...) fragments, the loneMODULE BankAccountheader fragment, and the named-argument call fragment were left as-is: no minimal correction is possible without inventing the missing content. - Whether the
IMPLEMENTATION:header form itself is retained is undecided; only the statements inside such blocks were corrected.
Scope of acceptance¶
Acceptance is documentation-level: it makes OQ-001 an authoritative language-design decision in the specification. It does not imply that the compiler already implements or validates these rules. Compiler implementation and conformance testing remain separate requirements.
Affected sections: TECHSPEC-01, TECHSPEC-20, TECHSPEC-39, TECHSPEC-57 (register note), Language Guide (Syntax), Glossary, Cross-Reference Index, existing examples (26 files), Unresolved Questions register, Decision Records index, CHANGELOG.md (0.2.7).
Design principle: Explicit boundaries. Predictable behavior. No silent syntax correction.