[Freeciv-Dev] Re: cityname patch
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
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
- [Freeciv-Dev] cityname patch, Vasco Alexandre Da Silva Costa, 2001/02/19
- [Freeciv-Dev] cityname patch, Vasco Alexandre Da Silva Costa, 2001/02/22
- [Freeciv-Dev] Re: cityname patch,
Stan Shebs <=
- [Freeciv-Dev] Re: cityname patch, Erik Sigra, 2001/02/24
- [Freeciv-Dev] Re: cityname patch, Vasco Alexandre Da Silva Costa, 2001/02/24
- [Freeciv-Dev] Re: cityname patch, Raimar Falke, 2001/02/24
- [Freeciv-Dev] Re: cityname patch, Erik Sigra, 2001/02/25
- [Freeciv-Dev] Re: cityname patch, Raimar Falke, 2001/02/25
- [Freeciv-Dev] Re: cityname patch, Erik Sigra, 2001/02/25
- [Freeciv-Dev] Re: cityname patch, Raimar Falke, 2001/02/25
- [Freeciv-Dev] Re: cityname patch, Erik Sigra, 2001/02/25
- [Freeciv-Dev] Re: cityname patch, Raimar Falke, 2001/02/25
- [Freeciv-Dev] Re: cityname patch, Erik Sigra, 2001/02/25
|
|