Skip to content

Language

The Fourier language reference. Each page below covers one construct, grounded in fourier/parser.py and fourier/codegen.py.

Read in this order if you're new:

  1. Contracts — the top-level contract { ... } block. What goes inside and the init function.
  2. Typesuint, address, bool, bytes, plus map[K, V] and array[T] for storage.
  3. Storagestorage NAME: TYPE @ SLOT; declarations and how slots are derived for mappings, arrays, and struct fields.
  4. Functionsfn vs pub fn, selector assignment, parameters, return types.
  5. Statementslet, assignment, if, while, return, require, emit.
  6. Expressions — operators, precedence, builtins.
  7. Eventsevent declarations, emit semantics, topic vs data layout.
  8. Errors and reverts — how require revertss, how sub-call failures propagate, the optional bytes revert payload.
  9. Cross-contract callscall_b, delegatecall_b, staticcall_b, and the one-word call.
  10. Address type — semantics, sentinels, comparison rules, builtins that return addresses.

The full grammar lives at fourier/GRAMMAR.md in the repo; this reference is the more detailed, code-grounded companion.