Skip to content

Feature request: richer spin syntax, open engine ready

spintaxspintax Belgrad

The internal spinner has been flat {a|b|c} for years. There is now an open spin superset spec (permutations, reusable variables, conditionals, plural agreement, includes) with a ready Object Pascal engine: zero dependencies, MIT, and it compiles under Free Pascal and the free Delphi edition. It passes the same shared conformance corpus as the JavaScript, PHP and Python engines, 164 of 168 with none failing.

What SER users get out of it: everything you already write keeps working. Flat and nested {a|b|c} render as today, and the engine leaves any %macro% it does not recognise exactly as written, case and all, so the %...% variables you already use in SER pass straight through untouched. On top of that you get variables you define once and reuse across a template, subset permutations with your own separator, conditionals, and correct plural forms. Author a template once with a cheap model using the published authoring prompt, then spin it locally at no marginal cost on every submit.

I run a couple of licenses and want nothing for this. Best case the engine lands in SER so templates render natively. Short of that, these are open and free:

Engine and source: https://github.com/investblog/spintax-win
Syntax reference: https://spintax.net/docs/syntax
Editor with a live render: https://apps.microsoft.com/detail/9mw3ch7b530p

Happy to answer technical questions.

Tagged:

Comments

  • spintaxspintax Belgrad
    A quick update: a lot has changed since August, and it should make embedding the engine much simpler now.

    Existing SER templates work as they are. There's now an optional SER front end (unit Spintax.Gsa) that reads SER's own syntax before the engine sees it:
    - {a|b|c} stays as it is. ~{a|b|c} becomes "all options in random order", exactly as the macro guide describes it.
    - Spintags {#T1 ...|#T2 ...} stay paired across the article (checked against SER's own preview).
    - Every macro comes out byte for byte for SER to resolve as usual: #file[...], #file_links[...], #openai[...], %spinfile-...%, %spinfolder-...%, #trans... BBCode like [b]...[/b] and URLs with # survive too.
    - Anything it can't map with certainty, such as {#.de ...|#.com ...} domain tags, is handed back exactly as written and listed. Nothing is guessed.

    Fast enough to spin on every submit. Parse once, render many times: a 3.7 KB article with 160 spin blocks renders in 0.04 ms per copy instead of about 1 ms.

    Safe on whatever users paste in. Deep nesting, self-referencing variables and expansion bombs end in a bounded result, not a crash or a hang.

    Conformance: 404 of the 408 shared test cases pass and none fail (the 4 skipped ones are RNG-only by design), up from 164 of 168 in August. On top of that come 102 checks for the SER front end. It builds with Free Pascal, and the same source compiles under Delphi.

    And it isn't just theory! The JavaScript engine from the same family has been building the article pools for our 80+ SER projects since August (details in the MCP/API thread). If you drive SER with AI agents, there's also an MCP server (@spintax/mcp) that validates and renders templates.

    Still MIT, and I still want nothing for it.

    P.S @Sven, if it would help, I'm happy to put together a minimal Delphi sample that converts and renders a SER template.

Sign In or Register to comment.