[MUD-Dev] Parser engines
ext.Christer.Enfors at tietoenator.com
ext.Christer.Enfors at tietoenator.com
Wed Mar 10 13:26:34 CET 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"
"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 at kanga.nu
https://www.kanga.nu/lists/listinfo/mud-dev
More information about the mud-dev-archive
mailing list