mud grammar

Chris Gray cg at ami-cg.GraySage.Edmonton.AB.CA
Wed Mar 12 07:17:46 CET 1997


: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...

Well, yes, but of course this is a computer program, so you can only use
synonyms that have been defined for the various terms. I don't find that
too different from a natural language - a listener only understands
synonyms that they are familiar with.

:"use gun on purple dinosaur"

Well, I think of 'use' as a very generic verb. It should do little other
than look up on the gun and the dinosaur, properties that tell it what it
should do. This could be any of the examples that you discuss. So, as you
say, the syntactic structure of the command is context free, but the
semantic content of it isn't. I'm not feeling too bright this morning
(the candidate I chose lost out in our provincial election yesterday!),
so I'll leave it to someone else to find a relevant context sensitive
example.

: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). 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.

I will comment that I, for one, would not find a lex/yacc system easier
to read than my home-grown one (obviously!). However, I would also claim
that the same would be true of anyone who has never used lex/yacc, and
of many who have. Given documenation that says that a "Verb1" form takes
commands like "verb [separator] [art] {adj} <noun> [punctuation]" and
"verb [art] {adj} <noun> [separator] [punctuation]", with examples like
"pick the big red book up." and "Pick up the big red book", it seems
pretty straightforward to add a new "put down" verb. Much easier for most
folks that reading documentation that talks about avoiding shift/reduce
conflicts!

--
Chris Gray   cg at ami-cg.GraySage.Edmonton.AB.CA



More information about the mud-dev-archive mailing list