.
D 2019-03-30T05:28:11.625
L procgen
N text/x-markdown
U lexi
W 2853
# procgen
`procgen` contains a large base of code originally written for the bot of a private irc channel i run, and is still used there. these programs procedurally generate various kinds of texts, ranging from esoteric political opinions to criminal accusations to cult names to i don't even remember all what else. a lot of the code is terrible; i'm sort of in the process of re-writing the important ones. you don't need to download and compile these generators if you want to see them in action; there's a small webserver running at [bot.hale.su](http://bot.hale.su) that you can visit to give them a whirl. it has a full list of the generators and what they do.
of possibly more interest are the Scheme libraries kept in `/lib`. these are written for Chicken Scheme and they all depend on `lisp-macro.scm`, a CS macro that implements lisp macro syntax. (most Schemes, Gambit excepted, don't support the lisp style, using only that hideous, tedious, and unexpressive `(define_syntax (syntax rules))` bullshit. which is a fucking tragedy because lisp is awful and Scheme is a pure and beautiful language that deserves only the best, chicken scheme especially.) there are one or two things that might be of broader interest here, although:
* `interlace.scm` might have some use also; it's a macro that lets you create lists, vectors, or call arbitrary functions with arguments that reference each other. it solves an extremely common and frustrating problem i've had in every PL i've ever used, C especially. it comes up a lot in text generation and game data code.
* `struct.scm` contains [a function to generate functional "structs."](wiki/struct.scm)
* `verb.scm` contains [helper functions and macros for generating verb phrases.](wiki/verb.scm)
* `bot.scm` is [the actual text-generation framework itself.](wiki/bot.scm)
most of the existing bot codebase is written in ocaml, while the bot herself is written in ruby, because i am a lazy piece of shit. i have a long-term intent to rewrite most of this codebase using the much more flexible, turing-complete text generation grammar i've developed on top of scheme, both so that they're consistent and so that they're dramatically more flexible. lacking macros, ocaml was extremely limiting, and you can see how abjectly hideous some of the code looks. `cclg` in particular: it's probably the generator i'm proudest of, but the code is an absolutely nightmare spaghetti atrocity. i started out writing it early on long before i was familiar with the dark corners of text generation, so it's build on faulty assumptions and full of horrible kludges to fix classes of problem i only discovered further down the road. i've forgotten how most of it works and it needs to die.
if you have any questions, give me a holler over on twitter: [@velartrill](https://twitter.com/velartrill)
Z f79117c71a8ce98a5311ab341d56d8c2