Passgen is a password generator with a regular-expression-like syntax. It is written in C as both a library and a command-line utility and allows for generating any kind of random sequence. For a quick overview of how it works, see usage.
If you want to download it, take a look at the releases section where you can find signed tarballs and packages for your platform and operating system.
For documentation on the syntax, see grammar.
If you want to help develop it, see development, where you can find resources and links.