Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2001:
[Freeciv-Dev] Re: cityname patch
Home

[Freeciv-Dev] Re: cityname patch

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Vasco Alexandre Da Silva Costa <vasc@xxxxxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: cityname patch
From: Stan Shebs <shebs@xxxxxxxxxxxxxxxxx>
Date: Thu, 22 Feb 2001 22:00:20 -0800
Reply-to: shebs@xxxxxxxxxxxxxxxxx

Vasco Alexandre Da Silva Costa wrote:
> 
> Well i've had a really hard time with this patch.  The Lisp parser is
> particularly obscure.

Heh, it's some of Xconq's simpler code - for true hairiness, check
out the algorithm to draw contour lines...

> I haven't even understood what grammar it's
> parsing! :-)

It's described in the Xconq manual.

> I'm not certain i'll continue working on it though.  I think i could write
> a new parser in Freeciv style faster than to hand convert this one.

Xconq uses the Lisp syntax for all of its data reading and writing,
so it was the path of least resistance to use for grammars.  The key
thing is that it allows arbitrarily nested data, which is very
convenient for extensibility.  (XML would be a more modern albeit
much more complicated choice.)

> IMO we should start thinking of this in a different way.  I know people
> have wanted scripting in Freeciv for some time so we probably should
> decide what kind of language we're going to use.  But i guess it's kind of
> overkill to add a Lisp parser just for cityname generation.

There are many possible syntaxes to use for the grammar.  Textbook
BNF would be a good choice, or yacc syntax.  You need one extension to
the usual syntax, which is the ability to add numerical weights when
there is a choice of several productions, so that random names
will tend to reflect the linguistic/cultural norms on average.  It's
also important to support arbitrary strings, and useful to have special
actions, such as capitalization of the string generated for a
nonterminal.  Also be sure there are no limits on the size of the
grammar, practice shows that a good grammar may be several pages
long, with hundreds of productions.

Stan



[Prev in Thread] Current Thread [Next in Thread]