Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2000:
[Freeciv-Dev] Re: Compound City Names
Home

[Freeciv-Dev] Re: Compound City Names

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Erik Sigra <freeciv@xxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Compound City Names
From: Stan Shebs <shebs@xxxxxxxxxxxxxxxxx>
Date: Mon, 25 Sep 2000 22:45:04 -0700
Reply-to: shebs@xxxxxxxxxxxxxxxxx

Erik Sigra wrote:
> 
> >
> > The code for this is in kernel/mknames.c, function gen_name
> >
> > and gen_from_rule, about 2 pages in all.
> 
> This is the most elaborate solution I have ever seen. (I am not at all
> familiar with the syntax.) It looks very promising.

The syntax is pretty simple-minded; the parens are just used to
define nested lists a la Lisp/Scheme, and grammar rules basically
have the two possibilities:

        (nonterminal nonterminal-or-terminal-or-sublist ...)

        (nonterminal (or [weight] n-or-t-or-s [weight] n-or-t-or-s ...))

> Is it in a shared library that also Freeciv can use? If not, can it be
> but into one? Many games could use such a library, and the developers
> would get high quality city name generation without much effort, leaving
> more time to work on things specific to their particular games.

At two pages of code, perhaps one page if Xconq-specific bits are
removed, there's not much to make into a library!  The pseudo-Lisp
machinery is more extensive, but FreeCiv already has a language for
rulesets, it would make more sense to extend it rather than trying
to graft another language on.  The extension doesn't even need to
support recursive data structures; you could require every grammar
rule to be "flat" and not lose any expressive power, just need to
make the developer use more nonterminals (which don't appear in
the final output, so who cares).

BTW, this idea is not original with me, I remember reading a paper
about grammar-based synthesis years ago, probably in the context
of test generation for compilers...

Stan
shebs@xxxxxxxxxxxxxxxxx



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