In the second post, we covered noun phrases -- phrases like "all cubes except red" and "lamp, food, and bottle" that the player can type to refer to objects.
We also covered how the parser recognizes them and how it represents them in memory: the
PARSE-NOUN-PHRASEroutine scans the player's command and fills in a
NOUN-PHRASEstructure, which holds a list of adjective/noun pairs called
But how does the parser identify which objects the player is referring to?
MATCH-SYNTAXfinds a syntax line that matches the player's command, the
FIND-OBJECTSroutine combines the noun phrases with the find flag and search options from the syntax line, and decides what needs to be done for each object required by the syntax line.
There are a few possibilities, depending on what the player typed. It can:
- match a noun phrase,
- expand a pronoun,
- supply a missing object,
- ask the player to clarify,
- or fail, printing an error message.