Input and edge cases
stdin, wait, exit, multi-statement lines, colons, story vs script anti-patterns.
Input (stdin)
Listen words: listen, listens, listening, sniff, sniffs, perk, perks, hear, hears, eavesdrop, eavesdrops, ask, asks, prompt, prompts, await, awaits.
| Line | Parses as | Need to know |
|---|---|---|
the labrador listens | Listen[labrador] | Reads one stdin line into that dog's name storage |
Wait
Wait words: wait, waits, waiting, sleep, sleeps, sleeping, nap, naps, napping, doze, dozes, dozing, snooze, snoozes, snoozing, settle, settles, settling, rest, rests, resting, lounge, lounges, lounging, pause, pauses, pausing, linger, lingers, lingering, loiter, loiters, loitering, dream, dreams, dreaming.
| Line | Parses as | Need to know |
|---|---|---|
wait 2 seconds | Wait[2] | Number optional; default 1 second |
sleep | Wait[1] | lazy trait doubles wait time |
Negative wait time throws an error.
Exit
Exit words: escape, leave, depart, scram, wander.
| Line | Parses as |
|---|---|
escape | Exit |
Multiple statements on one line
When one line contains two heard actions, the parser may build a LineGroup:
| Line | Parses as | Need to know |
|---|---|---|
she whimpers as she wants the first biscuit from her cookie jar | LineGroup[Print, TakeFromStash] | Whimper + take |
Most lines should stay one statement. This is mainly for take + mood print.
Colons and glue
| Line | Parses as | Need to know |
|---|---|---|
bark: "hello" | Print | Colon before value ignored |
her cookie jar holds some items: "a", "b" | StashInit | some items is glue |
Story vs script
| Story | Script | Notes |
|---|---|---|
her cookie jar | cookie_jar | Spaces → underscores |
the laundry basket | laundry_basket | No pile filler in script |
her cookie jar holds "a", "b" | cookie_jar holds "a", "b" | No stash filler in script |
her cookie jar is empty | cookie_jar empty | Prefer empty, not starving |
she whimpers … first biscuit from her cookie jar | whimper first from cookie_jar | Ordinal + from + name |
she woof how many toys she has | bark how many toys the labrador has | Name the dog in script |
when she has 2 toys then she woof "hi" | when labrador has 2 toys then bark "hi" bury | |
for each treat from her cookie jar then | for each treat from cookie_jar then |
Prefer story phrasing in shipped examples/woof/. Underscore script lines are fine in tests and scratch files.
Script anti-patterns
| Wrong | Why |
|---|---|
cookie_jar stash holds … | stash is glue, confuses parser |
cookie_jar stash starving | Use cookie_jar empty |
whimper cookie_jar first | Parses as print-all, not first slot |
Use whimper first from cookie_jar instead.
Comments
// scene note
# act two
Strict mode
bark --strict story.woof warns on lines that parsed as story-only glue with no effect. Useful when a sentence looks right but does nothing.
Hearing rules summary: Writing stories.
