Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

References and expressions

Expressions appear in condition state, mutation requirements and changes, and task predicates. The parser preserves their structure and precedence. The resolver resolves entity and role component paths and keeps other symbols and calls for later stages.

References

An entity reference starts with @ and a quoted identity:

@"cargo-42".properties.mass

A mutation role reference starts with @ and a role identifier:

@payload.properties.mass

Role references are valid only inside a mutation that declares the role.

Except for whole-entity resource uses, a reference must identify exactly one component value:

@"van-110".description.plate
@"van-110".capacities.payload_mass
@"van-110".conditions.readiness
@"van-110".properties.fuel_volume
@"van-110".traits.vehicle

References cannot stop at an entity or component, and they cannot continue past the value name. Reference chains are not supported.

Evaluation values

An evaluation value starts with $:

$distance
$duration

The parser and resolver preserve evaluation paths as symbolic inputs. The current DSL pipeline does not compute them. A later routing or planning stage is expected to supply their values.

Values and calls

General expressions accept:

  • quoted strings;
  • numbers and quantities;
  • symbols and paths;
  • function calls;
  • parenthesized groups;
  • unary + and -; and
  • binary arithmetic and comparison operators.
@van.properties.fuel_volume > 0 l
$distance * @van.properties.fuel_per_distance
score(@vehicle.properties.speed, $duration)

Calls are parsed generically. Only location(latitude, longitude) has special meaning when it initializes a property or capacity.

Operators and precedence

Binary operators bind in this order, from strongest to weakest:

PrecedenceOperators
1unary +, unary -
2*, /
3+, -
4=, !=, <, <=, >, >=

Operators with the same precedence associate from left to right. Parentheses override precedence.

a + b * c
(a + b) * c
a - b - c

The resolver does not yet type-check general expressions, compare units, or require task and requirement expressions to produce Boolean values.