ablative docs
↑↓ move↵ openesc close
Stack Notebook ablative.com.au

AWL types and values

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

Open .md

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 awl 2

Declares a record, an enum, or a schema door, and names the type an `outcome` carries.

  • form declaration
  • positions top-level, workflow-header, workloop-header
//! Declare an enum and a record, then build one for the outcome.
workflow triage_ticket
  input note: String
  outcome done: type Triage, route success

type Category = Urgent | Routine
type Triage { category: Category, note: String }

step judge
  route done(category: Routine, note: note)
schema awl 2

Opens a schema door: `schema("path")` imports one, `schema { … }` inlines one, and `schema of Type` derives one in constant position.

  • form value-word
  • positions const-value, type-door
//! An inline schema door names a JSON shape as an AWL type.
workflow ingest_payload
  input raw: Payload
  outcome done: type Payload, route success

type Payload = schema {
  "type": "object",
  "required": ["value"],
  "properties": { "value": { "type": "string" } }
}

step accept
  route done(raw)
true awl 2

The `Bool` literal for truth.

  • form condition-word
  • positions condition
//! `true` is the Bool literal for truth.
workflow flag_finding
  input title: String
  outcome done: type Finding, route success

type Finding { title: String, blocking: Bool }

step flag
  route done(title: title, blocking: true)
false awl 2

The `Bool` literal for falsity.

  • form condition-word
  • positions condition
//! `false` is the Bool literal for falsity.
workflow clear_finding
  input title: String
  outcome done: type Finding, route success

type Finding { title: String, blocking: Bool }

step clear
  route done(title: title, blocking: false)
const awl 2

Declares a compile-time constant, which may never depend on a runtime binding.

  • form declaration
  • positions top-level
//! A compile-time constant, usable anywhere a value is.
workflow announce_poll
  input feed: String
  outcome done: type String, route success

const prefix = "polling: "

step announce
  route done(prefix + feed)
json awl 2

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.

  • form value-word
  • positions const-value, run-capture
//! `json { … }` opens a literal JSON body in constant position.
workflow request_review
  input diff: String
  outcome done: type String, route success

const output_schema = json { "type": "string" }

worker reviewers
  action review(prompt: String, contract: String) -> String

step review
  review(prompt: diff, contract: output_schema) -> verdict
  route done(verdict)
of awl 2

Names the subject of `schema of Type`, the constant-position schema derivation.

  • form value-word
  • positions schema-source, recipe-step
//! `schema of Type` derives a schema constant from a declared type.
workflow plan_items
  input goal: String
  outcome done: type Plan, route success

const plan_schema = schema of Plan

type Plan { items: [String] }

worker agents
  action plan(prompt: String, output_schema: String) -> Plan

step plan
  plan(prompt: goal, output_schema: plan_schema) -> result
  route done(result)

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.