Skip to content

Symbol Reference

Complete reference for all symbols used in EventFlow.

Symbol Quick Reference

SymbolPositionElementExample
(none)-Action (default)order moves to #paid
?line prefixGuard? cart is valid
??line prefixGuard (OR)?? user is admin
=line prefixAssertion= order is in #processing
>after onAPI Eventon> :checkout from @customer
@inlineActor@customer
:inlineEvent:checkout
#inlineState#processing
$inlineContext$total

Line Prefixes

Line prefixes indicate what the line does.

No Prefix (Action)

Lines without prefix are actions - the default line type:

flow
order moves to #paid
emit :notification to @customer
$total increases by 100
send confirmation email

? (Guard)

Condition that must be true for indented actions:

flow
? cart is not empty
  order moves to #checkout

Multiple guards are AND:

flow
? cart is not empty
? user is logged in
  order moves to #checkout

?? (OR Guard)

Alternative condition - any one passing is enough:

flow
? user is admin
?? user has override permission
  allow action

= (Assertion)

Verification statement in expect: blocks:

flow
expect:
  = order is in #paid
  = $total equals 1200

> (API Event)

After on to mark public/external events:

flow
on> :checkout from @customer
  // Externally accessible

Inline Symbols

Inline symbols indicate references within a line.

@ (Actor)

Reference to a machine/actor:

flow
machine: @order
on> :checkout from @customer
emit :request to @payment

: (Event)

Reference to an event:

flow
on> :checkout from @customer
emit :payment_request to @payment
on :payment_success from @payment

# (State)

Reference to a machine state:

flow
order moves to #pending
? order is in #paid
order transitions to #completed

$ (Context Variable)

Reference to context data:

flow
$total becomes 100
$items adds "Laptop"
? $total > 0

With type annotation:

flow
$total: number becomes 100
$items: array adds "Laptop"

Case Rules

ElementCaseExample
Keywordslowercasemachine:, scenario:, expect:
Actorslowercase@customer, @admin
Stateslowercase#checkout, #processing
Eventslowercase:checkout, :payment_request
Contextlowercase$total, $items
Typeslowercasestring, number, array
String literalsas-is"Proceed to Checkout"

Type Annotations

Optional types for context variables:

TypeDescriptionExample
stringText values$name: string becomes "John"
numberIntegers and decimals$total: number becomes 100
booleanTrue/false$active: boolean becomes true
arrayList of items$items: array becomes empty
objectKey-value pairs$config: object becomes empty

Comparison Operators

Used in guards and assertions:

OperatorMeaningExample
equals / isEqual to? $total equals 100
is notNot equal to? $status is not "cancelled"
is greater than>? $total is greater than 100
is less than<? $count is less than 5
is at least>=? $age is at least 18
is at most<=? $items is at most 10
containsHas element? $items contains "Laptop"
is emptyEmpty collection? $cart is empty
is not emptyHas elements? $items is not empty

State Transition Verbs

All equivalent - use what reads best:

VerbExample
moves toorder moves to #paid
transitions toorder transitions to #approved
enterspayment enters #processing
becomesticket becomes #closed
changes tostatus changes to #active

Guard Logic

AND Logic (multiple ?)

flow
? condition1
? condition2
  // Runs only if BOTH true

OR Logic (??)

flow
? condition1
?? condition2
  // Runs if EITHER true

Combined

flow
? conditionA
? conditionB
?? conditionC
  // Runs if (A AND B) OR C

Default Case

flow
? condition1
  handle case 1
? condition2
  handle case 2
otherwise
  handle default

// Or with empty ?
? condition
  handle condition
?
  handle else

Released under the MIT License.