Browse the docs

Overview.

What this covers#

This is the reference for the core Silk language: syntax, rules and the diagnostics that enforce them. It is terse on purpose. The Silk book teaches, and this reference is where you look things up.

Every example on these pages was compiled with silk check or run with silk run on Silk 0.1.0. A program example exits with status 0 when its checks pass, unless the text around it says otherwise. The quoted diagnostics are the compiler's own text.

How a page is laid out#

  1. Summary. One or two sentences on what the page covers.

  2. Syntax. The grammar in the notation below.

  3. Rules. What the compiler accepts and what each form means, as short bullets.

  4. Examples. Small complete programs that compile.

  5. Diagnostics. The error codes for this topic, with their messages.

  6. See also. Related reference pages and std lib API pages.

Grammar notation#

NotationMeaning
'fn'A literal token
NameAnother grammar rule
x?Optional
x* / x+Zero or more / one or more
a | bEither
( … )Grouping

Pages#

PartPages
BasicsLexical structure · Values and primitive types · Bindings and statements · Expressions and operators · Control flow · Program entry and termination
DataStructs, tuples and arrays · Enums and unions · Patterns and match
Functions and abstractionFunctions and methods · Closures and callable types · Generics · Interfaces and impls
Memory and ownershipOwnership and moves · Borrowing · Lifetimes · Allocation and shared ownership
Effects and servicesEffects and run · Typed failures · Services and providers
ConcurrencyFibers and scheduling · Suspension and cancellation
Static evaluationStatic evaluation · Static control flow and reflection · Package parameters
AdvancedUnsafe code and C interop · Intrinsics

View the source of this page