# AWL types and values

All value forms, schema doors, constants and expression precedence.

AWL checks values at workflow and action boundaries. Records and enums are named types. Optional fields may be absent. A supplied value must match the field’s type.

## Values

- `Bool`: true or false.
- `Int`: A whole number.
- `Float`: A floating-point number.
- `String`: Double-quoted or triple-quoted text. A plus joins strings.
- `Nil`: The language nil type.
- `Dir`: A typed working-directory value used by declared commands.
- `[T]`: A list of values of type T. A declared [T?] is refused.
- `T?`: An optional field may be absent. JSON null is refused; [T]? makes a whole list optional.
- `Record`: Declare named fields, construct with Type(field: value), and read with value.field.
- `Enum`: Declare alternatives separated by a vertical bar. Conditions can test variants.
- `Binding`: An expression followed by -> name binds its value. Arguments to calls are named.
- `Operators`: Loosest to tightest: or, and, not, comparisons and is predicates, string +, then field access, literal indexing and pipeline stages. Parentheses group expressions. There are no user functions or general arithmetic.
- `Comments`: //! narrates the document; /// documents the next declaration or field; // is an ordinary comment. Command bodies use # comments.
- `Durations`: A positive integer with s, m, h or d. The canonical formatter uses two-space indentation.


Guards proving a field present narrow that access path for the guarded arm. The guard narrows only the checked field path. Indexing a list is an expression form with the compiler limits named on the reference overview.

## Type and constant words

- `type`: Declares a record, an enum, or a schema door, and names the type an `outcome` carries. Arguments: form: declaration; positions: top-level, workflow-header, workloop-header.
- `schema`: Opens a schema door: `schema("path")` imports one, `schema { … }` inlines one, and `schema of Type` derives one in constant position. Arguments: form: value-word; positions: const-value, type-door.
- `true`: The `Bool` literal for truth. Arguments: form: condition-word; positions: condition.
- `false`: The `Bool` literal for falsity. Arguments: form: condition-word; positions: condition.
- `const`: Declares a compile-time constant, which may never depend on a runtime binding. Arguments: form: declaration; positions: top-level.
- `json`: Opens a literal JSON body, as in `json { "type": "string" }`, and names the JSON capture selector in a worker document's `run json "…"` body — two distinct places. Arguments: form: value-word; positions: const-value, run-capture.
- `of`: Names the subject of `schema of Type`, the constant-position schema derivation. Arguments: form: value-word; positions: schema-source, recipe-step.


## Schema doors

An import resolves relative to the document. Inline schemas and imported files use the same supported structural subset. Local definitions can be referenced through the schema's own definitions. External references, alternatives that cannot be represented, pattern properties and null-admitting types are refused by name.

The constant-position schema derivation produces a schema value for a declared type. Use a constant to carry that value into later expressions; a runtime schema derivation is refused at bytecode compilation.

## Expression symbols

- `->`: Bind an expression or call result to a name.
- `|>`: Pipe a value to an action, accessor, collection operation or route. An action stage has exactly one parameter.
- `+`: Concatenate strings. AWL has no general arithmetic or user-defined functions.
- `==, !=, <, <=, >, >=`: Compare compatible values. Use parentheses when a boolean expression needs different grouping.
- `and, or, not`: Canonical boolean operators. The accepted symbolic aliases are &&, || and !; format rewrites them to words.
- `.field, [0]`: Read a record field or a literal list index. Parallel bodies and some guard/bound positions restrict indexing at compile time.
- `T?, [T], [T]?`: Optional field, list, optional list. Declared [T?] is refused; tolerant collect produces optional item slots.
- `"text", triple quotes`: Double-quoted text uses string escapes. Triple quotes hold multiline text.
- `..`: Separates retry backoff minimum and maximum durations.
