Sharpee 5.5 and Chord 4.0

Sharpee 5.5 and Chord 4.0

In the process of porting Chord Writer to a cross-platform editor and a very old BASIC IF story from 1981 to Chord, I started seeing sizable gaps in the syntax. I've spent probably a month or more updating Chord (and Sharpee to support it) and that work is now released at https://sharpee.net/.

As much as I love to write my own blog entries, sometimes Claude can compile lists of information more effectively, which includes the following changes to the platform and Chord.

Note the IDE downloads are offline until I get that work caught up.

Breaking, the reason it is a major

  • Every create block names its kind, and the kind leads the block: a thing, a room, a container, openable. A block without a kind, or with a trait before it, stops compiling. The inline form create the Potting Shed, a room is admitted.
  • Hatches are gone. define text … from, define action … from and define chain … from are parse errors with fix-its. Every Chord story is pure IR with no TypeScript reach-through.
  • A region declares its rooms instead of nesting them: a rooms group on the region, in <region> on a room. containing and nested regions stop compiling. Regions get an exit table.
  • A vehicle's passage: line becomes a passage … end passage block, and a flight's trip time is pace:.
  • with max items N and with max weight N are gone. holds <n> is the one spelling of capacity.
  • use state-machines is an error. define machine is core and needs no use line.

The kind leads, in the long form and the inline form:

create the watering can
  a thing
  aka can, tin can, sprinkler
  in the Potting Shed

  A dented tin watering can with a long spout.

create the Potting Shed, a room

  Clay pots in stacks, and a smell of damp earth.

A region declares its rooms:

create the Grounds
  a region
  landing the Drive

  after the player entering
    phrase cold-returns
  end after

create the Drive
  a room
  in the Grounds

  A gravel drive.

create the Maze
  a region

  rooms Maze 1 to 12
    room name:
      Maze

    You are in a maze of twisty little passages, all alike.

A passage is a block with its own grammar:

create the Cable Trench
  a room, dark
  up to the Loading Dock

  passage to the Sorting Room
    grammar
      follow the cables
      crawl along the cables
    blocked while the grating is shut: grating-shut
  end passage

  A trench under the dock floor.

Density

  • Blocks fold: create <name>, <composition> and exits: / exits, one-way: lines.
  • A clause head lists its gerunds: on the player taking, touching.
create the Mine Entrance, a room
  exits, one-way: northeast to the Upper Tunnel, southeast to the Lower Tunnel, up to the Mine
  down is blocked: too-dark

  You are at the entrance to an abandoned mine. A dark corridor is below.

create the Upper Tunnel, a room
  exits: south to the Lower Tunnel

  A tunnel, sloping down.

create the view
  a thing, scenery
  in the Top of the Post

  The view is spectacular, but you don't have time to waste gawking.

  on the player taking, touching, pushing, pulling, climbing, searching
    refuse view-too-far
  end on

Vehicles and movement

  • The vehicle is a kind with a movement model: line, streets, flight, compass, open and none. admits, to outside, boarding, the driving statements and predicates.
  • use sailing: bearings in degrees, the naval commands, wind and sails.
  • use expanses: open movement on coordinates, landmarks, drift, edges, start <vehicle> heading <direction>.
  • Passages and hidden exits: a passage is a block with its own grammar and while, blocked and deadly lines. An exit exists while a condition holds. A thing's own pushing block moves it between rooms. [the] is optional in a pattern.
  • One rule, one home: traversal and visibility answer the walking player, a vehicle, a pushed thing and an NPC alike.

A vehicle on a line, driven by state:

create the bucket
  a vehicle
  in the Well Bottom
  movement: line
  carries: in
  drive: state
  stops: the Well Bottom, the Top of the Well
  direction: both
  holds 3

  A wooden bucket on a rope, big enough to stand in.

  position
    when the bucket holds the water: the Top of the Well
    otherwise: the Well Bottom
  end position

An expanse and a skiff on it:

create the Belt
  an expanse
  size: 20 by 8
  drift: 1 unit every 50 turns
  north is blocked: ice-fields
  aka belt, void

  Black, and the slow tumble of rock against it.

  landmarks
    the Mining Platform: 3, 3
    the Derelict: 14, 6
  end landmarks

create the skiff
  a vehicle
  in the Belt at 3, 3
  movement: open
  carries: in
  drive: player
  commands: compass, coordinates
  pace: 1 turn
  stride: 1 unit
  sight: 6
  seen from afar: a glint of hull against the dark
  aka craft

  A skiff: one seat, one console, a hull you can see through.

define sequence landfall
  when the Derelict comes into sight
    phrase land-ho
end sequence

A barque under sail:

create the Marigold
  a vehicle
  in the Sargasso at 20, 20
  movement: open
  carries: in
  drive: player
  commands: naval, compass
  stride: 1 unit
  sight: 8
  seen from afar: three masts leaning to the wind
  sails: furled, reefed, full
  sails start: furled
  aka ship, barque

  A barque, three masts, a wheel aft.

  sailing
    0 to 44 degrees: furled stopped, reefed stopped, full stopped
    45 to 74 degrees: furled stopped, reefed 6 turns, full 4 turns
    75 to 119 degrees: furled stopped, reefed 3 turns, full 2 turns
    120 to 180 degrees: furled 6 turns, reefed 2 turns, full 1 turn
    calm: stopped
  end sailing

An exit that exists while a condition holds:

create the Crawl
  a room
  north to the Passage while the boulder is rolled aside

create the Cable Trench
  a room, dark

  passage to the Sorting Room
    grammar
      follow the cables
    while the Cable Trench is not dark
  end passage

Things, containers, physical state

  • Containers say what they show and hold: transparent, holds <n>. in and out are exit directions.
  • attached to / detachable; breakable, fragile, starts broken, broken as a state, after the player breaking. Tying is a stock action.
  • Object-side adjectives: lowering and raising take the clause body as their implementation. flammable [with the <tool>] gates burning. settable makes a thing's reversible states a dial, with a setting head that takes to <value>.
  • Lamps: light, put out, light-source with, starts lit, powered by. dark is reserved as a state name off rooms.
create the specimen jar
  a container, openable, transparent
  holds 2
  in the Hold

  A squat glass jar with a screw lid.

create the route placard
  a thing, attached to the sorting machine, detachable
  in the Sorting Room

create the sample jar
  a container, transparent, breakable, fragile
  in the Sorting Room
  states, reversible: sealed, spilled

  after the player breaking
    change the sample jar to spilled
    phrase jar-spills
  end after

create the dead letter
  a thing, flammable with the disposal torch
  in the returns bin
  aka letter, envelope

create the guidance selector
  a thing, scenery, settable
  in the Cockpit
  aka selector, dial
  states, reversible: ceres, titan, kepler

  A three-position selector under the viewport.

  on the player setting to kepler
    refuse selector-kepler-last
  end on

create the ration bar
  a thing, costs 3 credits
  in the canteen kiosk

  after the player buying
    phrase kiosk-vends
  end after

create the blackout lantern
  a thing, light-source with the flint striker, starts unlit

create the work lamp
  a container, light-source, switchable, powered by the power cell

Scope and senses

  • A backdrop is one scenery thing in many rooms. night-vision. can see and can reach read the platform.
  • listener, after hearing the <sound>, define sound without a file. play sound is never gated on the client.
create the view of Ceres
  a thing, scenery
  in the Landing Pad, the Tram Platform and the Hold

  Ceres.

create the klaxon button
  a thing, scenery, pushable
  in the Loading Dock

  after the player pushing
    play sound depot-klaxon
  end after

create the loader robot
  a person, listener, night-vision
  in the Loading Dock
  aka robot, loader, unit

  after hearing the depot-klaxon
    move the mail sack to the Loading Dock
    phrase robot-fetches-sack
  end after

Verbs and conversation

  • Stock verbs with no object side: kissing, waving, jumping, saying yes / no / sorry, looking under, emptying.
  • Two-noun clauses: a head names its counterpart, as in on the player throwing at the sorting machine.
  • ask <person> for <thing> is a request. A readable thing carries define topics and answers consult. costs <n> <currency> prices a thing and gates buying.
  • A define action answers its topic slot with about rows, the same row form define topics uses.
create the Landing Pad
  a room
  aka pad, pad 14

  Pad 14 is a circle of old cement under a black sky.

  on the player jumping
    phrase pad-jump
  end on

create the pad master
  a person
  in the Landing Pad
  states: unconvinced, waved-through

  on the player saying_yes while the pad master is unconvinced
    phrase quint-takes-yes-as-the-card
  end on

  on the player asking_for the tram token
    refuse when the pad master is unconvinced: quint-no-token
    move the tram token to the player
    phrase quint-hands-token
  end on

create the dead letter
  a thing
  in the returns bin

  on the player throwing at the sorting machine
    phrase machine-spits-letter
  end on

A readable thing with a topic table, and an action that answers its topic slot the same way:

create the flight manual
  a thing, readable with text "UPPS COURIER FLIGHT MANUAL, REV. 9"
  in the Cockpit
  aka manual

define topics for the flight manual
  about "the fold", "the fold drive", "folding": phrase manual-fold
  about "the airlock", "the outer hatch": phrase manual-airlock
end topics

define action praying
  grammar
    pray for the subject
  the subject is a topic
  about "rain", "the crops":
    award faith, once
    phrase prayed
  otherwise refuse unheard
end action

State machines

  • define machine is core: states, on enter, when transitions, a terminal state, and roles bound to things in the story.
define machine ferry
  role capstan is the capstan
  starts moored

  state moored
    when turning the capstan: casting-off

  state casting-off
    on enter
      phrase rope-pays-out
    end on
    when signaled: underway

  state underway, terminal
    on enter
      phrase ferry-underway
    end on
end machine

Testing

  • A reached state can be locked as a claim: sharpee claim <line> "<fact>" proposes the necessary set from the played line, writes the claim and pins the card. A broken lock is a failed card named in the claim's words.
  • Claims under a necessary set prune the explorer to the winning path; an inert needs is a diagnostic.
  • The test tree is segmented on disk as <story>.tests/ with a manifest and stable card ids.
  • Derived rule tests: arrange(), END STATE cards prove endings, sharpee test reports branches, endings and rooms.
  • The IDE's Testing tab keeps stale results, names each failed card's cause, and walks failures one stop at a time.
claims
  needs rooms: the Iron Gates, the Gravel Drive, the Fountain Court, the Boiler Shed, the Entrance Hall, the Kitchen, the Greenhouse, the Folly Hill, the Folly
  needs things: Tobias, the stopcock, the primer plunger, the boiler, the garden shears, the sherry bottle, Mrs Kettle, the vine, the silver locket, the folly door, the fuse, the deed box, the deed
  needs verbs: ask, turn, push, turn on, take, give, prune, open, cut

  claim the story can be won
    the story ends in victory

  claim Tobias has been asked about the folly
    Tobias was asked about "the folly"
    needs rooms: the Iron Gates, the Gravel Drive
    needs things: Tobias
    needs verbs: ask

  never the deed box leaves the Folly
    the deed box is not in the Folly
    needs rooms: the Iron Gates, the Gravel Drive, the Fountain Court, the Boiler Shed, the Greenhouse, the Folly Hill, the Folly
    needs things: Tobias, the stopcock, the primer plunger, the boiler, the folly door, the deed box
    needs verbs: ask, turn, push, turn on, open, take
end claims

The same gesture from the command line. The first argument is a line of the test tree, named by its segment id (weefpbmr here, from Fernhill's tree) or by the first command typed on it; --at is the turn as you count them. Without a fact, the command lists what is true at the line's last turn. With one, --propose prints the claim block it would write, and without --propose it writes the claim and pins the card.

sharpee claim weefpbmr
sharpee claim weefpbmr "the deed box is open" --at 22 --propose
sharpee claim weefpbmr "the deed box is open" --at 22

What the player notices from the parser review

  • give the old man the sword, put jack in the box in chest and take salt and pepper shaker read right. and and a comma are list readings. unlock door with asks for the key.
  • A missing object is asked for by its seat, and a gate failure names the phrase and the reason.
  • your lantern is the player's own in the second-person voice. Parse-failure sentences belong to the language package.

Not in 4.0.0

  • Connectors replacing attachment is accepted but not landed. attached to and tying still ship as above.

Subscribe to The Sharpee Blog

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
jamie@example.com
Subscribe