Language

Under the surface.

The keyword pages and targets describe what you write. This section describes what happens to it: how source is read, how a module is stored, how its state lives while it runs, and the loop that drives a program forward. None of it is something you have to think about to write Program — it is here for when you want to know how the machine underneath works.

The path a program takes

A Program starts as text and ends as a running process. A handful of stages sit between:

  1. Grammar — the rules each line of source is written against.
  2. Parsing walks the lines as an indentation tree in one pass, building the tree and checking as it goes.
  3. Tree is the direct, line-for-line shape the program first becomes: one node per line, nesting as branches.
  4. Structure is the canonical JSON command form the tree is written to — the single artefact everything else reads.
  5. State is what the canonical form's state cells become once the compiler renders them into a running target: the values that actually change.
  6. Running is the loop that feeds state and updates in, and takes effects and new state out.

The six pages