[DGD] Parser Design for DGD With Melville

David Jackson araborn at home.com
Tue Dec 4 21:27:47 CET 2001


Just thinking aloud...

Please forgive any strong mistakes in grammatical terms...it has been a 
long time since English 1001...

Target Sentence to Parse
---------------------------------------

"get green ring from the oak shelf, then put green ring into the yellow bag"

<verb><adjective><noun><preposition><article><adjective><noun>, 
<preposition><verb><adjective><noun><preposition><article><adjective><noun>

Pre-Step) If the verb is say, emote, tell, a channel command, or some other 
communication,
then parse these verbs passing the remainder of the input string as an 
argument.  Also, if
the command is "again" or "repeat", then the input string becomes the last 
input string and
is then parsed normally.

Step 1) Parse the sentence into words
Step 2) Obey the comma, or prepositions like "then" to seperate command 
groups and
then place the seperate command groups into a buffer.  Work on one command 
group at a time.
Step 3) Make distinct the verb, and then adjective/noun pairings
Step 4) Qualify the verbs by checking bin commands, wizard commands, and 
then soul commands
for existence, producing an error if non-existent
Step 5) Qualify the nouns with their adjectives by searching the 
environment or appropriate inventories,
using query_adjective() if an adjective is present.  Produce an error is 
non-existent.  Check for ambiguity,
and if the nouns are ambiguous, produce an error report that queries this 
ambiguity (i.e. "which bag do you mean,
the red bag, the blue bag, or Tinky Winky's bag?").
Step 6) If we have made it this far, call the verb function, with the 
object pointers defined in step 5 as arguments.
Step 7) Parse any commands after a comma or "then"

This of course means that we have to rewrite the existing verbs to allow 
for the passing of objects rather than strings.

The following sentence will fall apart under the above parsing...

"use trowel to plant pot in the orange pot"

<verb><noun><preposition><verb><noun><preposition><article><adjective><noun>

The command is "plant pot in orange pot", and naturally the "plant" verb 
would check for the existence of a trowel
in the player's inventory.  But what if it was part of the puzzle that the 
player needed to know what device to use to
accomplish his goal? (which is often the case).  But when I think about it, 
the command call would result in
plant(trowel, pot, orange pot) which is valid, and use would have to be 
stripped out, or used as a signifier that the
following word is an argument ot a verb.

Thoughts?

David Jackson

_________________________________________________________________
List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list