Skip to content
Playground

Reference

This section documents Yulang's syntax and semantics in detail. The guide is where you go to learn the language; this is where you go to look something up.

Program structure

A Yulang program is a sequence of top-level statements. Statements are declarations (my, our, pub, struct, enum, act, role, impl, error, cast, type, use, mod) and bare expressions whose values are shown by the CLI and playground.

Visibility

KeywordMeaning
myPrivate binding, local or top-level
ourPublic — appears in the enclosing module's companion
pubExported binding; also shown in the playground's type pane

Comments

yulang
// Line comment.

/* Block comment. */

-- Single-line doc comment (not a line comment).

---
Multi-line doc block.
May contain markdown and ```yulang fences.
---

// and /* ... */ are ordinary comments. -- and --- blocks are documentation comments — they appear in syntax trees and tooling, so they are not interchangeable with //.

By topic

Surface syntax

Values and types

Computation

  • Functions — declarations, currying, named arguments
  • Control Flowfor, sub:, case, references
  • Effectsact, catch, handler shapes
  • Errorserror, fail, from, up, wrap

Style

  • Idioms — what idiomatic Yulang looks like

Theory

Standard library

Yulang