Re: New Mob/World/Etc format: Bison and You

From: James Turner (turnerjh@XTN.NET)
Date: 05/02/98


Chris Jacobson <fear@ATHENET.NET> writes:

> `named' uses Bison to generate a parser for its preferences file.  I've
> been considering using Bison to generate a C-syntax-ish parser for my own
> lib files.
>
> Is there any interest in this out there?  Perhaps someone else already
> experienced with Bison able to give a few hints?  I've been reading the
> .info files for Bison, still am actually, but I hope to start working
> with it soon.

I think that such a change would be a very good thing for the
worldfiles in stock.  However, I don't think that bison would be a
good choice for this.  Writing a new handler for this kind of data is
not very hard -- I've done similar things on three occasions (pascal
compiler, new object file for another mud, the perl/c-like language I
mentioned before).  It doesn't take anything other than a little
forethought and a few hours of coding to get a parser to correctly
understand the language.

Something I've not done that I think would work well would be to use a
state-information table.  Basically a table listing every state the
parser can be in (reading direction data, reading a string, etc) and
associate with those states functions to handle the state.  Then call
the function when in that state, and it can perhaps switch to other
states.  Keep track of states with a stack.

Or you can use a more straight-forward recursive descent parser which
is similar to the above except that you let the runtime stack handle
your state information (ie you recurse into functions).  Either can
work well.

I don't recall if george as commented on this.  However, I think that
it would be valuable to have such a change be brought into the
codebase.  The current worldfiles are rather ugly and, though they
parse fairly quickly, they leave much to be desired in readability and
extensibility.  Not only that, but a format like he suggests would
pretty much document itself; as-is, it is very hard to look at a
worldfile and know the format or how to make a room (for someone not
already familiar with it).  A tagged format would be much nicer in
this respect.

--
James Turner               turnerjh@xtn.net
                           http://www.vuse.vanderbilt.edu/~turnerjh/


     +------------------------------------------------------------+
     | 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