Karsten Schmidt<p>Over the past few days I've been working on extending & re-packaging the procedural text generation engine from one of the old examples into a new package and also just wrote/updated documentation for its various features:</p><p>- variable definitions, optionally with multiple value choices <br>- cyclic & recursive variable references/expansion<br>- variable assignments<br>- dynamic, indirect variable lookups (for context specific situations)<br>- optional preset & custom modifiers (i.e. pointfree/concatenative application of modifier sequences)<br>- controlled randomness during var expansion</p><p>The new package is called: <a href="https://thi.ng/proctext" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="">thi.ng/proctext</span><span class="invisible"></span></a> (6.5KB incl. all deps) The text format used relies on a simple parser grammar defined and processed via <a href="https://thi.ng/parse" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="">thi.ng/parse</span><span class="invisible"></span></a>. The resulting document AST is then interpreted via <a href="https://thi.ng/defmulti" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="">thi.ng/defmulti</span><span class="invisible"></span></a></p><p>Please see readme for notes/examples, as well as the refactored example project below. The tool is very useful for complex source code generation, but also could be useful for bots, interactive fiction etc. The generator is stateful and variable state can be optionally retained/re-used over multiple invocations. Making all modifiers async is also providing a lot of flexibility (e.g. loading external data sources, generating secondary/expanded descriptions etc.)</p><p>Demo (incl. 5 examples and can be used as playground):<br><a href="https://demo.thi.ng/umbrella/procedural-text/" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">demo.thi.ng/umbrella/procedura</span><span class="invisible">l-text/</span></a></p><p><a href="https://mastodon.thi.ng/tags/ThingUmbrella" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ThingUmbrella</span></a> <a href="https://mastodon.thi.ng/tags/RewriteSystem" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>RewriteSystem</span></a> <a href="https://mastodon.thi.ng/tags/ProcGen" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ProcGen</span></a> <a href="https://mastodon.thi.ng/tags/TextGeneration" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>TextGeneration</span></a> <a href="https://mastodon.thi.ng/tags/CodeGenerator" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>CodeGenerator</span></a> <a href="https://mastodon.thi.ng/tags/Parser" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Parser</span></a> <a href="https://mastodon.thi.ng/tags/DSL" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>DSL</span></a> <a href="https://mastodon.thi.ng/tags/Pointfree" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Pointfree</span></a> <a href="https://mastodon.thi.ng/tags/TypeScript" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>TypeScript</span></a> <a href="https://mastodon.thi.ng/tags/JavaScript" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>JavaScript</span></a> <a href="https://mastodon.thi.ng/tags/InteractiveFiction" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>InteractiveFiction</span></a></p>