Re: Magic System - Parsing

From: Patrick Dughi (dughi@IMAXX.NET)
Date: 05/07/98


>
> As a form of discussion, I was wondering if anyone had input into the
> parsing issue. I am currently thinking about designs to allow for a very
> elegant spell parser and executor. My first hurdle is the parser...In
> particular, how to deal with multiple-word spells and multiple-word
> arguments. At current, I'm thinking about either tokenizing the input in a
> fashion similiar to C's argc and argv[] main parsing technique, or
> possibly
> hashing the SS list in a manner similiar to the way a UNIX shell does.

        I'm curious if there's any impetus to move to a ZIL like language
interpreter.  Otherwise, I'd say an easy way would just be to have the
expected number of arguments be part of the skill/spell definition.  Of
course, I'd probably write something that would require a bit less work
down the road, and end-up abusing the strtok() function.

>   Is there anything out there on command hashing/alternative parsing in
> relation to Circle? I've never really set up a hash table in C (PERL's
> associative arrays does it for you *grin*); anyone have pointers and
> pitfall
> warnings in regards to hashing in Circle that they'ld be willing to share?

        I haven't seen a problem, except that its generally difficult to
make a 'perfect' hash that really holds up - hard to make a hash and plan
for expandability, and all those annoying additions that will eventaully
come in, each one hitting an exception case... I used a hash in my dynamic
board code (hosted on georges web site) that started out basically random,
and actually turned out to be decent, so I only tailored it a small bit.
It works best when you have under, I think, 200-300 messages on a board
(ye gods!) but at such small numbers, I wasnt sure if I should have just
qsort'ed em.

                                                        PjD


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST