04-syntax (pocket version)

TL;DR (5 lines)

  • Syntax is about shape before detail.
  • A valid block is the smallest useful teaching unit.
  • Statements and declarations belong to different layers.
  • Invalid examples should isolate shape errors.
  • The reader should leave able to recognize a healthy block instantly.

Concrete Problem

Syntax pages become noisy when they enumerate tokens without showing how a complete block is supposed to look.

Coherent example

space demo/syntax

proc compute(x: int, y: int) -> int {
  let sum: int = x + y
  if sum < 0 { give 0 }
  give sum
}

entry main at core/app {
  return compute(1, 2)
}

Global explanation

Essential syntax is best taught as structure. The reader should see where declarations live, where statements live, and how a block closes with an explicit result.

Short exercise

Add one extra branch and one extra local binding while preserving the same readable block structure.

Next best action

Keep the example small, reproduce it locally, then continue to the full chapter if you need the broader context.