[Freeciv-Dev] Re: Compound City Names
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
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
- [Freeciv-Dev] Compound City Names, Erik Sigra, 2000/09/23
- [Freeciv-Dev] Re: Compound City Names, Stan Shebs, 2000/09/25
- [Freeciv-Dev] Re: Compound City Names, Erik Sigra, 2000/09/25
- [Freeciv-Dev] Re: Compound City Names,
Stan Shebs <=
- [Freeciv-Dev] Re: Compound City Names, Reinier Post, 2000/09/26
- [Freeciv-Dev] I can do the Swedish part (was: Re: Re: Compound City Names), Erik Sigra, 2000/09/26
- [Freeciv-Dev] Re: Compound City Names, Stan Shebs, 2000/09/26
- [Freeciv-Dev] Re: Compound City Names, Gaute Strokkenes, 2000/09/26
- [Freeciv-Dev] Re: Compound City Names, Stan Shebs, 2000/09/26
- [Freeciv-Dev] Re: Compound City Names, Andrew McGuinness, 2000/09/27
[Freeciv-Dev] Re: Compound City Names, Erik Sigra, 2000/09/25
|
|