esolang

Shinjusō

Mother-of-pearl. Rules rewrite a row of coloured beads, and an ironed bead never changes again.

sporeball, 2026 · Turing complete: unknown · ●●○ moderate · esolangs.org

Tested with 4 known programs · Test method

Run it

Expected: c

The idea

sporeball designed Shinjusō in 2026. The name means mother-of-pearl. It is a string rewriting system, but the rules and the data are rows of beads in eight colours. A bead is stock, which a rule may replace, or ironed, which nothing can touch. A program that ends with one row of ironed beads side by side accepts, and those beads are its output.

Read the story

The specification draws beads as coloured O and o and says a program on disk may use more glyphs. A capital letter is a stock bead and a small letter an ironed bead of the same colour.

The machine

LettersColour
K kblack
R rred
G ggreen
Y yyellow
B bblue
M mmagenta
C ccyan
W wwhite

A program is lines A -> B and one line with the data string. A and the data hold stock beads only, and an ironed bead in B keeps the colour of the bead at its place in A. The rules run in order, each once at its leftmost match, and after the last one the first comes again. The run stops after a round that leaves the string as it was.

The specification says the run stops once no rule can change the string. Read word for word, its own program would run forever on an invalid string like GGR, because its first rule always finds a green bead. The specification says invalid strings reject, so this implementation compares whole rounds.

Example

The 12 rules accept n green beads followed by n red ones.

The 12 rules accept n green beads followed by n red ones. One bead in its picture has no colour; it is black. On GGRR the string goes GGRR, YGGRR, YGKR, YK, C and c, the trace the specification shows, and the one ironed cyan bead is printed.

On GGGRRR it prints c as well. On GGR or GRGR it ends without an ironed bead and prints nothing.

When the ironed beads sit side by side, all of them are the output. With RGR as the data the green bead stays between the two red ones, and the program rejects.

Expected: rr

Patterns it teaches

  • String rewriting: rules applied in turn to one string, with beads that freeze once they are done.

Further

String-rewriting paradigm

Write your own in Run Convert a program from Shinjusō

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: shinjusou.

Command line

shib run shinjusou -e 'G -> YG
YYG -> YG
GR -> K
GKR -> K
YK -> C
MC -> M
RC -> M
KC -> M
CG -> M
CR -> M
CK -> M
C -> c
GGR'
shib manual shinjusou

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/shinjusou.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org