Full grammar

This page is a compact, human‑readable grammar reference for CFS.

Program

  • use statements (optional)
  • behavior blocks

Behavior block

behavior <selector> {
  <declarations>
  [construct]
  [destruct]
  [on]
  [nested behavior]
}

Declarations

  • State: name: value;
  • Bindings: @attr :< expr;, $style := expr;
  • Flags: !important, !debounce(200)

Statements

  • if, for, while, try/catch
  • Assignments (including +=, -=, *=, /=)
  • Function declarations and calls
  • Return values

Known limitations

  • No classes
  • No module system inside CFS
  • HTML templating is intentionally minimal