<!-- x-generated: Generated by the Hyperscale artifact pipeline; do not edit by hand -->

# HSX language reference

> Generated from the HSX lexer's reserved word list, the parser's own output over the authored corpus, and the UDL clause vocabulary.

## Reserved words

HSX reserves 23 words.

- Opens a declaration in the corpus: `asset`, `import`, `instrument`, `module`, `party`, `port`, `program`, `settlement`
- Reserved elsewhere in the grammar: `action`, `as`, `commit`, `const`, `expect`, `expires`, `export`, `expose`, `from`, `quote`, `rate`, `reconcile`, `subject`, `type`, `use`

## Declaration forms

The 8 top-level forms the parser produces over 45 authored HSX files, with one occurrence of each quoted verbatim.

| Form | Occurrences | Example | Source |
| --- | --- | --- | --- |
| `asset` | 3 | `asset booth: good { title_transfer: off_platform }` | `open/hsx/examples/02-imports-and-archetypes/photo-booth.hsx` |
| `import` | 25 | `import { instant_transfer } from "std/money_flows"` | `open/hsx/examples/01-first-program/tip-jar.hsx` |
| `instrument` | 19 | `instrument advance<C>( funder: party, to: party, amount: money<C>, fee: optional<percent>, count: optional<integer>, every: optional<text>, first_due: optional<date>, against: optional<ref>, ) { ... }` | `open/hsx/std/money_flows/advance.hsx` |
| `instrument_apply` | 33 | `settlement tip = instant_transfer { payer: listener payee: host amount: tipAmount: money(SAR) }` | `open/hsx/examples/01-first-program/tip-jar.hsx` |
| `module` | 20 | `module std.money_flows.advance` | `open/hsx/std/money_flows/advance.hsx` |
| `party` | 59 | `party listener: person` | `open/hsx/examples/01-first-program/tip-jar.hsx` |
| `port` | 25 | `port confirm_delivery { allowed: [company] shape { boothId: id(booth) deliveredOn: date } }` | `open/hsx/examples/02-imports-and-archetypes/photo-booth.hsx` |
| `program` | 25 | `program tip_jar "Tip jar"` | `open/hsx/examples/01-first-program/tip-jar.hsx` |

## Clause vocabulary

UDL admits 51 clauses. Scope is where the clause may appear; cardinality is how many times; a linear sink consumes its input, and linear outputs are the names a clause binds for later clauses.

| Clause | Scope | Target | Cardinality | Linear | Effects |
| --- | --- | --- | --- | --- | --- |
| `agent description` | action | `agentDescription` | one | none | none |
| `capture input` | action | `captureInput` | one | none | none |
| `commit` | action | `commit` | one | none | [] |
| `computes distribute` | action | `distribute` | one | outputs amountRef | none |
| `computes remainder` | action | `remainder` | one | outputs amountRef | none |
| `computes signed_sum` | action | `signedSum` | one | outputs amountRef | none |
| `deadline` | action | `deadline` | one | none | [{"kind":"schedules","per":"clause","signature":{"fixed":"deadline"}}] |
| `decided amount` | action | `decidedAmount` | one | outputs field | none |
| `decision` | action | `decision` | one | none | [{"kind":"decides","per":"clause","signature":{"fromField":"capability"}}] |
| `description` | action | `description` | one | none | none |
| `due` | action | `due` | one | none | [{"kind":"schedules","per":"clause","signature":{"fixed":"due"}}] |
| `earnable` | action | `earnable` | one | none | none |
| `event name` | action | `eventName` | one | none | none |
| `examples` | action | `examples` | many | none | none |
| `input` | action | `input` | one | none | none |
| `moves` | action | `moves` | many | sink | [{"kind":"moves","per":"element","signature":{"movementClass":true}},{"kind":"holds","per":"element","signature":{"fixed":"reserve"}}] |
| `notify` | action | `effects.notifies` | many | none | [{"kind":"notifies","per":"element","signature":{"fromField":"channel"}}] |
| `payout` | action | `payout` | one | sink | [{"kind":"moves","per":"clause","signature":{"fixed":"payout.external"}}] |
| `port` | action | `port` | one | none | [{"kind":"decides","per":"clause","signature":{"fixed":"tenant_port"}}] |
| `principal` | action | `principal` | one | none | none |
| `public action` | action | `publicAction` | one | none | none |
| `quote` | action | `quote` | one | outputs netRef | [{"kind":"holds","per":"clause","signature":{"fixed":"quote"}},{"kind":"schedules","per":"clause","signature":{"fixed":"expiry"}}] |
| `reconcile` | action | `reconcile` | many | none | [{"kind":"reads","per":"element","signature":{"fixed":"reconcile"}}] |
| `requires aggregate` | action | `requiresAggregate` | many | none | [{"kind":"reads","per":"clause","signature":{"fixed":"requires_aggregate"}}] |
| `requires checks` | action | `requiresChecks` | many | none | [{"kind":"reads","per":"clause","signature":{"fixed":"requires_checks"}}] |
| `requires drained` | action | `requiresDrainedAccount` | one | none | none |
| `requires exposure` | action | `requiresExposure` | many | none | none |
| `requires refs` | action | `requiresRefs` | many | none | [{"kind":"reads","per":"clause","signature":{"fixed":"requires_refs"}}] |
| `sandbox failure point` | action | `sandboxFailurePoint` | one | none | none |
| `sets at` | action | `setsAt` | one | none | none |
| `steps` | action | `steps` | many | sink | none |
| `summary` | action | `summary` | one | none | none |
| `updates` | action | `updates` | many | none | none |
| `agent description` | instrument | `agentDescription` | one | none | none |
| `aggregate invariants` | instrument | `aggregateInvariants` | many | none | none |
| `caller parked states` | instrument | `callerParkedStates` | one | none | none |
| `computes derived` | instrument | `derivedAmounts` | many | none | none |
| `computes fees` | instrument | `feeRules` | many | none | none |
| `description` | instrument | `description` | one | none | none |
| `dials` | instrument | `dials` | many | none | none |
| `distinct parties` | instrument | `distinctParties` | one | none | none |
| `id prefix` | instrument | `idPrefix` | one | none | none |
| `journeys` | instrument | `journeys` | many | none | none |
| `nav` | instrument | `nav` | many | none | none |
| `partitions` | instrument | `partitions` | many | none | none |
| `subject` | instrument | `subject` | one | none | none |
| `summary` | instrument | `summary` | one | none | none |
| `surface visibility` | instrument | `surfaceVisibility` | one | none | none |
| `template id` | instrument | `templateId` | one | none | none |
| `title` | instrument | `title` | one | none | none |
| `update` | instrument | `update` | one | none | none |
