[MUD-Dev] Parser engines

Brian Hook brianhook at pyrogon.com
Sat Mar 13 11:38:43 CET 2004


Thanks to everyone for their replies.

It looks like my fundamental assumption -- that it just isn't
necessary to have a very elaborate parser -- is probably the most
accurate.  I doubt that better parsers were somehow eluding the
technical capabilities MUD server authors =3D)

My original parser was a very simple "force the user to adapt to me"
style coupled with "terse and effective style".  Everything was
decomposed into the basic format:

  <verb> [<dobj>] [[<prep>] <idobj>]

It handled a lot of the sentence simplification through plain text
substitution instead of some elaborate pattern matching.  I also
just flat out ignored all prepositions, originally thinking that the
parser would be simple enough that differentiating between "look
under box", "look in box", "look on box" and "look with box" would
just map to "look box" and get handled.

As for the pattern matching system some have mentioned, that's
basically what Hugo, TADS and Inform all do.  A verb is specified
with an ordered set of grammars that in turn map to a specific
function, e.g.

  Verb get
     "get" "out" --> Exit
     "get" "in" --> Enter
     "get" <multi> -- Take
     "get" <multi> "from" <obj> -- RemoveFrom
  etc. etc.

Then I realized that at some point complexity is unavoidable,
specifically with disambiguation (which sword?  which key?).  I'm
really not fond of unintuitive (to non MUD players) forms like:

  > get 2 sword
  > get 2.sword

That just strikes me as...messy.  Also, handling group w/ exceptions
was proving cumbersome when trying to hack into my simplistic
parser, i.e.

  > get all swords except the rusty sword from the backpack

So I'm writing a parser that lies somewhere between the full on
complexity and robustness of an IF-level parser, and the simplicity
of a typical MUD parser.

I still require most sentences to decompose into verb, direct
object, preposition and indirect object, but I don't use a grammar
to dispatch, I just have a high level parser for each verb type.

Thanks for all the responses!
_______________________________________________
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