[MUD-Dev] Parser engines

&lt &lt
Wed Mar 10 13:26:34 New Zealand Daylight Time 2004

From: Brian Hook [mailto:brianhook at 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 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

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

Christer Enfors, AKA Dannil
MUD-Dev mailing list
MUD-Dev at kanga.nu

More information about the MUD-Dev mailing list