This is an amazing project! We need more fun projects like this in OCaml
Only one suggestion.
When I retire, one of the things I want to do is open my own pub. I was thinking about the name a lot and came up with Boozingham Palace. You can add it to the list of your names as well
Note that we changed the semantics of quoted string literals slightly in trunk (to be released in OCaml 5.2): \r\n sequences in the string literal are now interpreted as a single \n. (But this is not recursive, so for example \r\r\n becomes \r\n.) This is done to avoid the problem of “a Windows user checked out my OCaml project and their system converted \n into \r\n on the fly and the semantics of the string literals changed in the process”.
This might be something to keep in mind if you try to embed arbitrary content inside quoted string literals. (A devious trick suggested by Damien Doligez is to replace, at embedding time, all \n characters in the payload by \r\n, which guarantees that the file will normalize back to the original input.)
The way the names are generated, I can’t easily add names one-by-one… but I could add a TOPONYM variable to use in patterns so that “Boozingham” has a place in there.
A few years ago I wrote a general tool for generating things that takes BNF grammars, named BNFGen. I’ve been mostly using it for parser fuzzing, but it saw some fun use, such as this The Elder Scrolls character name generator.
Your project got me thinking about some missing features, though. I could throw together a pub grammar quite easily:
But there’s a glaring problem: posessives have a space in them and there’s no way to control that now. I need to think how to add whitespace control options to make it possible to do exactly what your custom generator does.
They probably should, it’s just a very quick prototype. Another thing is that the way I wrote it allows names like “The queen and the queen”, which looks pretty odd.
For the record, bnfgen does allow a hack to make possessives work, you can use --delimiter "" and embed whitespace in the terminals, but I think that’s quite a pretty ugly hack.