The Tycho language specification
Status: ratified — Tycho 0.5, maintained against the current release (0.9.2). Where the two differ,
CHANGELOG.mdrecords the change. This document is the normative contract a conforming implementation must satisfy.Internal links,
§-labels, and section cross-references are verified mechanically. Themake spec-checkgate regenerates the collected grammar (Appendix A) from the defining chapters §3/§4, asserts every fixture the conformance matrix (Appendix E) cites exists, and builds and runs every runnabletycho/outputexample (§2.3) against its shown output.
What this document is
Where the reference pages teach the language by example, this document defines it by rule. On any conflict, the specification governs, and the divergence is logged in Appendix H.
How to read it
The files are numbered in normative reading order. Requirement keywords (MUST, SHOULD, MAY) follow RFC 2119/8174. The grammar is W3C-style EBNF over lexer-produced tokens (Tycho is indentation-sensitive; see §3).
Contents
| # | File | Chapters | Status |
|---|---|---|---|
| — | README | index | — |
| 00 | Conventions | 1 Scope & conformance · 2 Notation | 1.0 |
| 01 | Lexical structure | 3 Source text, tokens, indentation | 1.0 |
| 02 | Grammar | 4 The phrase grammar | 1.0 |
| 03 | Types | 5 | 1.0 |
| 04 | Type inference | 6 | 1.0 |
| 05 | Generics | 7 | 1.0 |
| 06 | Conversions | 8 | 1.0 |
| 07 | Memory & object model | 9 Value semantics · 10 Arenas · 11 inout | 1.0 |
| 08 | Declarations & scoping | 12 | 1.0 |
| 09 | Expressions | 13 | 1.0 |
| 10 | Statements & control flow | 14 | 1.0 |
| 11 | Functions | 15 | 1.0 |
| 12 | Aggregates | 16 arrays · 17 structs/tuples · 18 maps · 19 enums/match | 1.0 |
| 13 | Concurrency | 20–23 | 1.0 |
| 14 | FFI | 24–26 | 1.0 |
| 15 | Program & packages | 27 Program structure · 28 Packages & modules | 1.0 |
| 16 | Builtins | 29 | 1.0 |
| 17 | Runtime behavior | 30 | 1.0 |
| 18 | Standard library | 31–33 corelib | 1.0 |
| A | Collected grammar | collected EBNF (§3–§4) | 1.0 |
| B | Keywords | reserved + contextual | 1.0 |
| C | Precedence | operator table | 1.0 |
| D | Builtin index | locator | 1.0 |
| E | Conformance map | clause → fixture | 1.0 |
| F | Impl-defined register | unspecified + impl-defined | 1.0 |
| G | Glossary | terms | 1.0 |
| H | Differences | reference-doc drift log | 1.0 |
Conformance in one paragraph
An implementation conforms at the core tier iff, across the conformance suite (Appendix E), it accepts exactly the programs the reference accepts, rejects exactly those it rejects, and produces byte-identical program output — for the language and the pure-Tycho + libc-only corelib. The extended tier additionally provides the deps/pkg-config corelib packages (http, crypto, compress, image, tls); an implementation MAY omit them and still conform at the core tier (§1).