mud grammar

Nathan Yospe yospe at hawaii.edu
Tue Mar 11 19:27:43 CET 1997


On Mon, 10 Mar 1997, Carter T Shock wrote:

:Hrmmm... I think we have a misunderstanding as to what a "context free
:grammar" is.
:
:As far as the purple dinosaur goes, in all of the examples, whether you are
:shooting in the next room, the left eye or whatever, the meaning of "shoot"
:doesn't change. lex/yacc grammars can easily capture the meaning of
:modifiers such as "with" or "in". The "whisper"/"say" example parses nicely
:as well.

OK. How about "Use the gun to kill the purple beast."
Say your guns are out of ammo. Under my system, the Character would set to
beating Barney over the head with the rifle. (unless you were _really_
good at pistol whipping)

:I agree that some commands should not be useful in all parts of the mud. It
:seems unfair to the player to have the mud simply refuse to recognize your
:news command when not in the post office. For a consistant interface with
:the player shouldn't the mud recognize the syntax of the command as valid,
:but simply deny the command's execution (tell them that the command doesn't
:work here as opposed to pretending the command doesn't exist). 

This is fine for normal commands, but what of new commands specific to a
situation? What of commands open to interpretation, based on context?

:A agree
:wholeheartedly with the lament about whether to use "push" or "press" for
:the damned button (that may or may not respond to the keyword "button", but
:that's another issue entirely). It is the grammar that is context free;
:individual sentences are of course context sensitive. (or am I _really_
:making a fool of myself?)

Not absolutely. If you have no gun, "Kill the soldier with the gun."
should at least make sure you _really_ want to make the foolhardy attempt
to take down an armed soldier (carrying a gun, of course) with your bare
hands. 

:The point about using a natural language processor is also well taken, but
:I don't think that's what you've implemented there. If you allowed natural
:language, I should be able to use any synonym of shoot and purple
:dinosaur...
:
:Let's consider when the user tries:
:
:"use gun on purple dinosaur"

ch.do(gun.implementStandardUsage() + "purple dinosaur");
works well enough for me.

:This is an example of context sensitive grammar. What does "use" mean?
:Shoot the dinosaur? Whack him over the head with it? Scratch his tummy with
:the butt of the rifle? It's ambiguous. Natural language processors try to
:do the "right thing" in these situations (is the dinosaur friend or foe? Is
:the rifle loaded? Are you a decent shot? Does his tummy itch?).

You don't use a rifle for much outside of mayhem, and certainly not with
the statement "use". If it isn't loaded, standardUsage becomes "bash ". Of
course, the catchall for this is "kill ".

:If, however, you allow exactly one meaning for "use" (let's say it means
:"shoot") then the sentence is unambiguous and the grammar context free.

Nah, "use " is a wonderful verb. Leave it.

:Finally, don't think that I'm some devotee of lex/yacc. No reason you can't
:cook up your own parser. I'm just suggesting that it offers a relatively
:easy and structured implementation of a grammar. Also, once created, it's
:easy to modify the grammar (change meanings, add new verbs, etc). 

As is my system, which uses a weighted reference database for everything.
Some ideas borrowed from neural net programming, mainly.

:It is
:similar to the question of how you handle your mud's contents. Depending on
:how you've implemented the mud's catalog of items, "where sword" may do an
:iterative search of the entire mud contents, or it may do an SQL query into
:a set of tables. Both work, the difference is a question of style and
:portability -- portability not in the sense of cross-platform compilation,
:but in the sense of when someone else looks at your code if they know
:lex/yacc they will be able to understand the mud command structure quickly
:rather than having to pore over your home-grown parser.

True. Of course, since _I_ don't know lex/yacc....

   __    _   __  _   _   ,  ,  , ,  
  /_  / / ) /_  /_) / ) /| /| / /\            First Light of a Nova Dawn
 /   / / \ /_  /_) / \ /-|/ |/ /_/            Final Night of a World Gone
Nathan F. Yospe - University of Hawaii Dept of Physics - yospe at hawaii.edu




More information about the mud-dev-archive mailing list