Section 1: Source File Structure¶
TECHSPEC-01 — Section 1 · Version 0.1 · Status: Initial Draft
Editorial note: the source file carries no
Sectiontitle line. The title above is taken from its first subsection heading, “1. Source File Structure”. Nothing else was changed.Status: draft. This section is an Initial Draft (Section 57 is a Working Register). It describes intended or proposed behavior, not a finalized, implemented language rule. Do not treat examples here as normative.
1. Source File Structure¶
Every source file must follow a predictable structure.
1.1 File Organization¶
A source file consists of:
- Module declaration.
- Imports (optional).
- Type declarations (optional).
- Function declarations.
- Other permitted declarations.
1.2 Naming Conventions¶
- Module names use PascalCase.
- Type names use PascalCase.
- Function names use camelCase.
- Variable names use camelCase.
- Constants use UPPER_SNAKE_CASE.
Names must be unique within their applicable scope.
1.3 Comments¶
Single-line comments begin with //.
Comments are ignored by the compiler and cannot override language rules.
1.4 Whitespace¶
- Indentation is not semantically significant.
- Statements must have unambiguous boundaries.
- Formatting must be consistent.
- The compiler must not depend on visual indentation to determine program structure.
1.5 Case Sensitivity¶
The language is case-sensitive.
account, Account, and ACCOUNT are three different identifiers.
2. Initial Syntax Example¶
MODULE BankAccount
TYPE Account:
balance: Decimal
FUNCTION getBalance(
account: Account
) -> Decimal
IMPLEMENTATION:
RETURN account.balance
END FUNCTION
END MODULE
3. Compiler Requirements¶
The compiler must: - Recognize module declarations. - Recognize imports and declarations. - Identify identifiers and keywords. - Detect duplicate declarations. - Detect malformed source files. - Produce structured syntax diagnostics.
4. Scope¶
This section establishes source-file organization and naming rules. It does not yet finalize function contracts, expressions, control flow, or type semantics.
Source and related sections¶
Source file: TECHSPEC-1.md (preserved in source-original/LANG/). See the specification index, the glossary, and the cross-reference index.