Skip to content
Playground

Reference ​

This page maps Yulang's top-level syntax, visibility, comments, and detailed reference topics. Use it to find a language construct; the guide presents the language in learning order.

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. The Playground evaluates bare expressions and shows the last root value; the CLI command yulang run --print-roots prints root expression values.

Visibility ​

KeywordMeaning
myPrivate binding, local or top-level
ourExports a binding into the enclosing companion module
pubExports a binding from the module; also shows it in the Playground's Types 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 Flow — for, sub:, case, references
  • Effects — act, catch, handler shapes
  • Errors — error, fail, from, up, wrap

Style

  • Idioms — what idiomatic Yulang looks like

Theory

Standard library

Yulang