017 bridge grammar renders rules and inventions

✓ Passing This code compiles and runs correctly.

Code

input.k

Actual

defined shout
A wire turn is one flow: verb(field: value, field: value) with `|` arms chaining what each call issues.
- An arm binds what a call issued to a name for the next call: `| ok u |>` for an ordinary result, `| chosen c |>` for a named branch — the arm word is the branch name the verb's line in the vocabulary declares; a `| ?` outcome may go unarmed, every other named outcome must be armed or the turn stops with `unhandled-branch`.
- The verb is a bare name from your vocabulary — letters, digits, '-', '_' — immediately followed by '('.
- A value is a double-quoted string (escape \" and \\ inside) or a bare literal: a number, true/false, or a name a `|` arm already bound.
- A field typed `Expression` takes expression text bare (`calc(expr: 2 + 3)`); a field typed `Source` takes prose bare (`note(text: thinking this through)`) — and a verb whose only field is Source also answers to `verb: prose`.
- A field typed `name<x>` takes only a bound name the session minted `<x!>` — an `rN` from an earlier verb or an arm binding, never literal text. `name<!x>` spends it.
- A bound name keeps its fields: `r3.user_id` reads that field out of the value r3 bound — the whole result stays readable in the session, not just its name.
- A second invocation starts a second item: one invocation per line runs each in order with one line of report per step.
- Prose is not wire — it binds as residue: "residue bound: rN — your reply was not wire; nothing reached the user" keeps YOUR reply at rN; nothing hears it until a verb takes it as an argument.
- Chain fresh outcomes with arms — a `| branch name |>` arm binds `name` to what the call just issued. Never invent one, never predict one: bind it.

Your vocabulary:
echo(text: string)
shout(text: string)
--- done

Expected output

defined shout
A wire turn is one flow: verb(field: value, field: value) with `|` arms chaining what each call issues.
- An arm binds what a call issued to a name for the next call: `| ok u |>` for an ordinary result, `| chosen c |>` for a named branch — the arm word is the branch name the verb's line in the vocabulary declares; a `| ?` outcome may go unarmed, every other named outcome must be armed or the turn stops with `unhandled-branch`.
- The verb is a bare name from your vocabulary — letters, digits, '-', '_' — immediately followed by '('.
- A value is a double-quoted string (escape \" and \\ inside) or a bare literal: a number, true/false, or a name a `|` arm already bound.
- A field typed `Expression` takes expression text bare (`calc(expr: 2 + 3)`); a field typed `Source` takes prose bare (`note(text: thinking this through)`) — and a verb whose only field is Source also answers to `verb: prose`.
- A field typed `name<x>` takes only a bound name the session minted `<x!>` — an `rN` from an earlier verb or an arm binding, never literal text. `name<!x>` spends it.
- A bound name keeps its fields: `r3.user_id` reads that field out of the value r3 bound — the whole result stays readable in the session, not just its name.
- A second invocation starts a second item: one invocation per line runs each in order with one line of report per step.
- Prose is not wire — it binds as residue: "residue bound: rN — your reply was not wire; nothing reached the user" keeps YOUR reply at rN; nothing hears it until a verb takes it as an argument.
- Chain fresh outcomes with arms — a `| branch name |>` arm binds `name` to what the call just issued. Never invent one, never predict one: bind it.

Your vocabulary:
echo(text: string)
shout(text: string)
--- done

Flows

flow ~register click a branch to expand · @labels scroll to their anchor
register (scope: "api", source: echo(1))
subflow ~do-define click a branch to expand · @labels scroll to their anchor
define (br, source: "tor shout { text: string }\nshout = echo(text)")
subflow ~show-grammar click a branch to expand · @labels scroll to their anchor
grammar (br)
flow ~create click a branch to expand · @labels scroll to their anchor
create (id: "gram", scope: "api")

Test Configuration

MUST_RUN