Perchance Engine Architecture
This technical report documents the internal mechanics of the Perchance.org text generation engine. Unlike simple randomizers, Perchance operates on a hierarchical recursive grammar system combined with a JavaScript-based state machine. This application allows you to explore the probability curves, state persistence patterns (consumable lists), and the integration layer that bridges simple text lists with complex web APIs.
Recursive Grammar
Deep nesting support with syntax like [list.subItem] allowing for complex, branching narrative structures.
Event-Driven
The engine is wrapped in a reactive membrane, allowing DOM updates to trigger re-evaluation of specific list nodes.
Plugin System
Modular extension capabilities allowing integration with LLMs, text-to-speech, and external APIs via simple import syntax.