[MUD-Dev] Re: (fwd) Re: command parsers: a modest proposa

Chris Gray cg at ami-cg.GraySage.Edmonton.AB.CA
Sat Jul 11 16:32:05 CEST 1998


[Richard Bartle:]

 > >for me, the concept of "part of speech" isn't really part
 > >of the server. So, my "tables" are just mappings of strings to
 > >database items, which includes objects, rooms, code, arrays, etc.
 >        I find parts of speech useful because they allow single words to
 >have different meanings depending on where they are used.
 >        WIND CLOCK              verb
 >        GET WIND CHIME          adjective
 >        SUMMON WIND             noun
 > 
 >        It's especially helpful with abbreviations:
 >        G K                     get key
 >        K G                     kill goblin
 >        G K F G                 get key from goblin
 >        F                       flee
 > 
 >        Using parts of speech, you can point to entirely different objects
 >from vocabulary entries by context.

Ah, but you can fake out that sort of thing with proper faking out of
part of speech. I assume that the first word in a command is a 'verb',
and so look it up in the grammar as such. A given word can be in a
grammar as either a verb, in one or more forms, or as a non-verb, which
has no additional information. For verbs like 'get X from Y', I would
store the word 'from' as one of these "non-verbs", and the description
of the 'get from' verb would reference it as its "separator word".
That's likely not a clear description. Here's a short, made-up example:

    Verb0(G, "down", function_for_down);
    Verb0(G, "in", function_for_in);
    Synonym(G, "down", "d");
    Synonym(G, "in", "i");
    Verb1(G, "put", FindWord(G, "down"), function_for_put_down);
    Verb2(G, "put", FindWord(G, "in"), function_for_put_in);
    Synonym(G, "put", "p");

With that framework, the following user commands would work:

    in; i
    down; d
    put <noun phrase>, <noun phrase> in <noun phrase>
    put <noun phrase> down
    p d <noun phrase>

It's all faked out, but works not bad. The first abbreviation conflict
shows up here, however - I use 'i' as an abbreviation for 'inventory',
instead of for 'in'. :-)

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




More information about the mud-dev-archive mailing list