Skip to content

About This Reference ​

This reference describes the formal rules of the SYX language — lexical structure, grammar, types, expressions, statements, declarations, attributes, patterns, generics and protocols — for readers who need to look things up precisely (compiler contributors, SDK maintainers, advanced language users).

Current version: SYX 117.0 (Phase 139) · syx-cache-v1 · license Apache-2.0 · documentation last synced 2026-10-27

For the full status matrix, see shared/implementation-status.md; for architecture decisions, see docs/adr/architecture-decisions.md; for the capabilities summary, see docs/adr/capabilities-summary.md.

Relationship to the Language Guide ​

This ReferenceThe Language Guide
Formal definitions, grammar tables, diagnostic codesNarrative explanations, complete examples, learning path
"What is the grammar of an if statement?""How do I write branching logic with if?"

The "Usage examples" at the end of each chapter link to the corresponding guide chapter; the "See also" at the end of each guide chapter links back to this reference.

Chapter Structure ​

#ChapterContents
1Lexical StructureTokens, keywords, literals, comments, escapes
2TypesType expressions, numerics, String, collections, references, opaque types, SIMD
3ExpressionsExpression classification, precedence table
4StatementsVariable declarations, control flow, exceptions
5Declarationsimport / func / class / struct / enum / actor / protocol / extension
6Attributes@attached / @Service / @Around / @resultBuilder / @Equatable and more
7PatternsVariants, tuples, switch / if case patterns
8Generic Parameters and Arguments<T> / where / protocol constraints / monomorphization
9Protocols and ConformancesProtocol declarations, conformances, witnesses, existential types
10Grammar SummaryEBNF / modules / functions / types / expressions
AAppendix: Implementation Status MatrixPoints at the implementation status master table

Notation Conventions ​

NotationMeaning
…Grammar element
|Alternative
?Optional
*Zero or more times
+One or more times
[x]Optional group
{x}Zero or more repetitions
(x | y)Grouping
terminalTerminal (keyword / punctuation)
nontermNonterminal

Implementation Status ​

Every rule or feature is marked with one of five tiers (see shared/implementation-status.md):

TierMeaning
Implemented / GAVerifiable with syx run, parity, or hard gates
Partially implemented / partial GAParses/compiles but semantics are incomplete
PlannedRecorded on the roadmap, implementation unfinished
Not implementedNo corresponding AST/semantics
RejectedDeliberately fail-closed (the compiler reports an error)

Diagnostic Code Prefixes ​

PrefixPhaseScopeExample
LLexical / LintTokens, naming conventionsL001 unterminated string / L001 function names should be lowercase
PParsingSyntax errorsP001 parse error
SSemanticSymbols, types, borrowingS002 undefined identifier
AActorIsolation violationsA002 cross-actor access
CConcurrencyCross-isolation, SendableC003 not Sendable
RRuntimepanic / trapR007 force unwrap nil
HHost plugindlopen / signature verificationH001 plugin not loaded
EMacroExpansion errorsE002 macro expansion depth exceeded
WWarningCompile-time warningsW001 #warning

The full index lives in Language Guide Appendix B: Diagnostic Code Index.

Relationship to the Compiler Implementation ​

This ReferenceCompiler source
Lexicalcrates/syx-lexer/src/
Syntax (AST)crates/syx-ast/src/lib.rs
Parsingcrates/syx-parser/src/
Semanticscrates/syx-semantic/src/
Macro expansioncrates/syx-macro/src/
MIRcrates/syx-mir/src/
Codegencrates/syx-codegen/src/ / crates/syx-llvm/src/ / crates/syx-wasm-emit/src/
VMcrates/syx-vm/src/

The complete BNF is kept in sync with the parser in docs/2_SyntaxAnalysis.md.

Toolchain ​


Usage examples → Language Guide

SYX · Apache-2.0