[Home] [Groups] - Message: [Prev in Group] [Next in Group]

nu.kanga.list.mud-dev

29403: RE: [MUD-Dev] Parser engines

[Full Header] [Plain Text]
From: <ext.Christer.Enfors@tietoenator.com>
Newsgroups: nu.kanga.list.mud-dev
Date: Wed, 10 Mar 2004 13:26:34 +0100
Organization: Kanga.Nu
From: Brian Hook [mailto:brianhook@pyrogon.com]

> I've been looking at the various input parsers in different MUDs
> (although I haven't had a chance to look at commercial text MUDs),
> and by and large the parser technology seems to be roughly
> early-Infocom, if that.

Have you looked at the "natural language parser" used by MudOS
(LPMud driver) and Lima (mudlib)? It's the best one I've seen so
far. IIRC, it's able to handle things such as:

  > look at the first orc's second shiny sword

It also makes it easy to create "verbs". For each verb, you can add
a set of rules that the parser matches against the input, to see if
the input is correct. For example, the rules for the "search" verb
are as follows:

  "OBJ"
  "OBJ with OBJ"
  "for STR"
  "for STR in OBJ"
  "OBJ for STR"
  "OBJ with OBJ for STR"
  "OBJ for STR with OBJ"
  "for STR in OBJ with OBJ"

where OBJ means object, and STR means string (LIV, not used here,
means living (player / NPC)). In all these cases, OBJ can be things
like

  "sword"
  "my sword"
  "my third sword"
  "my rusty sword"
  "bubba's shiny sword"

and so on. The verb doesn't need to take this into account, the
parser handles it automatically. All the verb has to do is create a
function for each of its rules, that will receive the input if the
driver finds a match.

--=20
Christer Enfors, AKA Dannil
_______________________________________________
MUD-Dev mailing list
MUD-Dev@kanga.nu
https://www.kanga.nu/lists/listinfo/mud-dev