Skip to content

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:

LET balance: Decimal = 100.00;
CONST MAX_RETRIES: Integer = 5;

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:

  1. Generic END; terminators are not permitted.
  2. Every block terminator MUST identify the structure it closes.
  3. Block terminators MUST match their corresponding opening structures.
  4. Nested blocks MUST close in reverse order of opening.
  5. ELSE and other intermediate clauses MUST NOT independently terminate their parent structure.
  6. Every typed block terminator MUST end with a semicolon.
  7. 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:

END FUNCTION;

Incorrect:

END FUNCTION;;

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:

LET total: Decimal = price + tax;
LET total:
    Decimal =
    price
    +
    tax;

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:

LET balance: Decimal = 100.00; // Initial balance

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:

  1. The statement termination rules are incorporated into the normative specification.
  2. All compound structures have explicitly defined typed terminators.
  3. Generic END; terminators are specified as rejected.
  4. Nested block matching in reverse order of opening is specified.
  5. Intermediate clauses such as ELSE are specified as not independently closing their parent structure.
  6. The formal grammar describes the complete rules.
  7. Newlines and indentation are confirmed as semantically insignificant.
  8. Empty statement behavior is specified.
  9. Existing examples are consistent with the decision.
  10. No conflicting syntax rules remain elsewhere in the documentation.
  11. Simple declarations require semicolons.
  12. Compound declarations require their typed block terminators.
  13. No additional semicolon is required after a typed block terminator.
  14. 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:

  1. The statement termination rules are incorporated into the normative specification — TECHSPEC-01, TECHSPEC-20, and TECHSPEC-39 amendments.
  2. All compound structures have explicitly defined typed terminators — TECHSPEC-20 amendment, §B.
  3. Generic END; terminators are specified as rejected — TECHSPEC-20 amendment, §§A–B.
  4. Nested block matching in reverse order of opening is specified — TECHSPEC-20 amendment, §C.
  5. Intermediate clauses such as ELSE are specified as not independently closing their parent structure — TECHSPEC-20 amendment, §C.
  6. The formal grammar describes the complete rules — TECHSPEC-20 amendment, §B, for the OQ-001 scope. Other items in TECHSPEC-20 §11 remain open.
  7. Newlines and indentation are confirmed as semantically insignificant — TECHSPEC-01 and TECHSPEC-20 amendments.
  8. Empty statement behavior is specified — TECHSPEC-20 amendment, §D.
  9. 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.
  10. 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.
  11. Simple declarations require semicolons — TECHSPEC-20 amendment, §B.
  12. Compound declarations require their typed block terminators — TECHSPEC-20 amendment, §B.
  13. No additional semicolon is required after a typed block terminator — TECHSPEC-20 amendment, §§A–B.
  14. 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 / ELSE without header colons; those examples illustrate termination only. The conditional header syntax — including : after the condition and after ELSE — is as defined in TECHSPEC-20 §6 and in every source example, and is unchanged by OQ-001.
  • MATCH terminator established; MATCH grammar pending. MATCH is an established compound statement (match_statement is listed in the statement alternatives of TECHSPEC-20 §6) and the terminator form END MATCH is attested (TECHSPEC-4 §3), so by the general typed-terminator rule the terminator is END 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_definition only as a variant of type_definition inside a TYPE declaration (TECHSPEC-20 §4), so there is no standalone ENUM declaration and no END ENUM terminator; TEST appears in exactly one example and in no grammar production; PARALLEL appears 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_declaration is 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)

  • ENUM termination is unresolved. The grammar defines enum only as part of a TYPE declaration; the standalone ENUM <Name>: form, enum member termination, and any END ENUM terminator are unestablished. An enum written as part of a TYPE declaration is closed by that declaration's END TYPE;.
  • TEST and PARALLEL termination is unresolved. Neither construct is an established grammar category; their terminators cannot be assigned without inventing them.
  • TRANSACTION:, LOG, STATE_MACHINE, and TRANSITION blocks 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 lone MODULE BankAccount header 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.