063 scope grammar

✓ Passing This code compiles and runs correctly.

Code

input.k

Actual

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.
- `<open>` — minted by open(...) | ok, append(...) | ok; spent by append(handle:), close(handle:)
- Chain fresh outcomes with arms: `open(path: "1") | ok v |> append(handle: v, text: "2")` — the arm's binding `v` is what the call just issued. Never invent one, never predict one: bind it.

Your vocabulary:
open(path: string) -> <open!>
append(handle: string<!open>, text: string) -> <open!>
close(handle: string<!open>)
say(text: string)
NOT FOUND

Expected output

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.
- `<open>` — minted by open(...) | ok, append(...) | ok; spent by append(handle:), close(handle:)
- Chain fresh outcomes with arms: `open(path: "1") | ok v |> append(handle: v, text: "2")` — the arm's binding `v` is what the call just issued. Never invent one, never predict one: bind it.

Your vocabulary:
open(path: string) -> <open!>
append(handle: string<!open>, text: string) -> <open!>
close(handle: string<!open>)
say(text: string)
NOT FOUND

Flows

subflow ~close click a branch to expand · @labels scroll to their anchor
placeholder
subflow ~say click a branch to expand · @labels scroll to their anchor
placeholder
flow ~register click a branch to expand · @labels scroll to their anchor
register (scope: "notes", source: open(10) append(1) close(1) say(1))
flow ~scope-grammar click a branch to expand · @labels scroll to their anchor
scope-grammar (name: "notes")
flow ~scope-grammar click a branch to expand · @labels scroll to their anchor
scope-grammar (name: "no-such-scope")

Test Configuration

MUST_RUN