#! shibboleth 3 seed=slashes syllables= plain=off reader=rewrite other=print /// as a front end: the program text rewrites itself. A character no rule reads goes to print; \ prints the next one; /pattern/replacement/ replaces the first occurrence in the rest of the program until there is none (REST, REWRITE). part reads up to an unescaped / into cell 1000 (the rest goes to 1001) and says 1 if it found one, 2 if the text ended "\\" => REST DUP SIZE IF UNCONS EMIT THEN REWRITE "/" => REST part 1 EQ IF 1000 LOAD 1002 STORE 1001 LOAD part 1 EQ IF 1000 LOAD 1003 STORE 1001 LOAD rewrite REWRITE ELSE HALT THEN ELSE HALT THEN print => EMIT keep => DUP -1 EQ IF DROP 2 ELSE 1000 LOAD SWAP CAT 1000 STORE 0 THEN step => DUP 47 EQ IF DROP 1 ELSE DUP 92 EQ IF DROP 1001 LOAD UNCONS SWAP 1001 STORE THEN keep THEN part => 1001 STORE [ ] 1000 STORE 0 BEGIN DROP 1001 LOAD UNCONS SWAP 1001 STORE step DUP UNTIL rewrite => BEGIN DUP 1002 LOAD FIND DUP 0 LT NOT IF SPLIT 1002 LOAD SIZE SPLIT SWAP DROP 1003 LOAD SWAP CAT CAT 1 ELSE DROP 0 THEN NOT UNTIL