It Online
It Online is a language invented by User:A with a weird self-modification scheme. It is inspired by Backhand.
Inspiration
Someday in school in math class. Jerry is sitting in the front of Yolanda and in the back of Sophie. Due to her bad sitting habits, Yolanda pushes her desk forward; it seems like she is falling asleep. Since there is less space less for Jerry, Jerry also pushes his desk forward. Suddenly, Sophie pulls her desk backwards (she wants to stretch herself), leaving Jerry very unconfortable. The teacher realized this and said, "Please sit properly. Sophie is pulling her desk backwards. Yolanda is pushing her desk forwards."
Inspired by this, I decided to create a language where the instructions (students' desks) move yet the program counter (the teacher) does not move.
Overview
There are rules in It Online that decide how the atoms (instructions) move. First of all we have forces deciding how the atoms should move. The forces are represented by the left force <
and the right force >
. If there are no forces specified in the program, a left conveyor (<<
) is implicitly specified.
Rules
The program counter "consumes" the character whenever it sees one. Therefore you always need to copy the character for every instruction you execute. Obviously the program counter stays in position 1, although the program may change it or set its initial value using a flag of the interpreter.
Convergent rules
We call a code block convergent when two forces point to each other. These are the rules for converging:
>Aha<
Should result in>h<
. This drops two characters in the side.>h<
Should result in><
. This removes the whole string being converged.><
Should result in><
. No effect; you can't expect the two forces crushing each other.>oh<
Should result in><
. This drops two characters in the side.
Divergent rules
There is only one simple rule here.
<abc>
Should result in<abcabc>
Copy the string and append to the string itself.
Conserving rules
>abc>
Should result in>cab>
because the conveyor moves c to the back.<abc<
Should result in<bca<
because the conveyor moves a to the front.
Table of moving directions of atoms
Just a randomly-shuffled list in order to increase difficulty of programming. :)
[57, 70, 44, 77, 64, 26, 2, 86, 25, 63, 13, 29, 61, 56, 43, 21, 36, 58, 8, 35, 83, 9, 89, 60, 80, 30, 4, 0, 3, 84, 55, 22, 88, 27, 53, 48, 38, 6, 71, 16, 67, 7, 15, 45, 5, 62, 18, 33, 1, 51, 17, 78, 93, 92, 11, 12, 74, 85, 82, 54, 37, 42, 31, 59, 75, 34, 40, 81, 79, 68, 90, 46, 39, 65, 87, 32, 41, 28, 50, 69, 24, 10, 20, 23, 76, 47, 14, 52, 73, 49, 66, 72, 91, 19]
The index's ord code should be decremented by 32 when referenced. E.g. The direction of H
is 67, which means the character H will be moved 67 times. It Online is completely written in non-control ASCII (no tabs and newlines).
Currently It Online pushes every executed instruction onto the stack. More sophisticated instructions might be added later.