1CP=1ICL

From Esolang
Jump to navigation Jump to search

1CP=1ICL stands for "1 CodePoint = 1 Instruction, Collaborative Language", and is pretty much exactly what it sounds like.

Feel free to add any instructions you want, but generally follow these rules:

  • Please stick to the format.
  • Include your username.
  • Don't include instructions massively depending on things outside of the esolang. "λ - Interpret haskell" is not an okay instruction.
  • Please don't make anything unimplementable, please don't be vague, please try not to have any undefined behaviour/implementation dependant details.
  • Commands should consist of precisely one unicode codepoint. This is roughly what you probably think a "character" is.
  • Please do not contradict other instructions, either. Imagine this is an esolang that actually has to be implemented.
  • Commands should be fairly simple.

Other than that, have fun!

Language specifications

There is a tape consisting of an infinite amount of cells, each initialized to 0. The possible range of values for these cells are 0 to 255.
The tape is unbounded in both directions, and there is a pointer pointing to a binary digit of a cell. "The current cell" or "the cell at the pointer" is the digit pointed to by the pointer and the seven digits after it. Moving the pointer by one cell moves it by 8 bits.
There are an unbounded number of accumulators containing unbounded integer values, initialized at 0. "The accumulator" is the first one of them.
There is a stack that only stores continuations, which are entire copies of the rest of the program state, excluding the continuation stack itself.
The direction of execution starts from left to right. If the end (or start when reversed) of the program is reached, it terminates.
The "program state" includes the tape, the accumulator, the program counter and the direction of execution.
The instructions are as follows:

Command Description Contributor
> Move the pointer to the right User:Heavpoot
< Move the pointer to the left User:Heavpoot
+ Increment the memory cell at the pointer User:Heavpoot
- Decrement the memory cell at the pointer User:Heavpoot
. Output the character signified by the cell at the pointer User:Heavpoot
, Input a character and store it in the cell at the pointer User:Heavpoot
[ Jump past the matching ] if the cell at the pointer is 0 User:Heavpoot
] Jump back to the matching [ if the cell at the pointer is nonzero User:Heavpoot
@ Break out of a loop defined by [ and ]. If not in a loop, then terminate the program. User:Heavpoot
a Add accumulator to current cell. User:Osmarks
c Copy current cell to accumulator. User:Osmarks
% Reverse the direction of program execution if the cell at the pointer is zero. Mirrors the functionality of [ and ], and "loops" created by them have their structure maintained. User:Palaiologos
^ Push the current program state to the continuation stack. User:IFcoltransG
v Pop a continuation from the continuation stack, set the program state to it, then change the accumulator to the value it had before the continuation was popped. (If the continuation stack is empty, instead revert to the initial state of the program, leaving the accumulator and continuation stack unchanged.) User:IFcoltransG
For the memory cell at the pointer and the next seven cells to the right, set that cell to X if the corresponding (little-endian) bit of X is set and 0 otherwise, where X is the the original value of the cell at the pointer. 'Corresponding' means for instance that the most significant bit maps to the cell at the pointer, and the least significant bit maps to the last cell of the seven. User:IFcoltransG
Replace the memory cell at the pointer with the byte represented by concatenating the bits that are represented by the cell at the pointer and the seven cells to the right. For the purpose of constructing the byte, a 0 cell represents a 0 and any other value represents a 1. The byte will then be treated as a little-endian unsigned integer. User:IFcoltransG
If the memory cell at the pointer is not equal to the accumulator, swap them. Otherwise, delete the first accumulator by copying each accumulator other than the first one to the accumulator before it. User:IFcoltransG
/ Before executing the program, apply a macro substitution to the source code with the rule /pattern/replacement/ and consume the / triplet. These should typically be placed at the start of the program. User:RocketRace
Apply a linear transformation, derived from the bitwise representation of the current cell and the first accumulator (in matrix form), on the next four cells (modulo 256 as necessary):
A visualization of the transformation.
User:RocketRace
σ Consider the distribution of nonzero cells in the whole tape. Any cell that falls outside one standard deviation of the mean in this distribution is set to zero. User:RocketRace
(U+2329) Move the pointer to the left by half a cell. This is equivalent to making every cell byte equal to the last nibble of the cell to the left, followed by the first nibble of the cell itself. User:Tokigun
(U+232A) Move the pointer to the right by half a cell. This is equivalent to making every cell byte equal to the last nibble of the cell itself, followed by the first nibble of the cell to the right. User:Tokigun
A
Add the current cell to the accumulator. User:SoundOfScripting
C
Copy the accumulator to the current cell. User:SoundOfScripting
=
Increment the accumulator. User:SoundOfScripting
_
Decrement the accumulator. User:SoundOfScripting
5
Reverse the direction of program execution if the accumulator is zero. Mirrors the functionality of [ and ], and "loops" created by them have their structure maintained. User:SoundOfScripting
{
Jump past the matching } if the accumulator is 0. User:SoundOfScripting
}
Jump back to the matching { if the accumulator is non-zero. User:SoundOfScripting
2
Break out of a loop defined by { and }. If not in a loop, then terminate the program. User:SoundOfScripting
:
Output the character signified by the accumulator User:SoundOfScripting
;
Input a character and store it in the accumulator User:SoundOfScripting
$
Swap the current cell and the accumulator. User:SoundOfScripting
«
Move the pointer to the right by a fourth of a cell User:SoundOfScripting
»
Move the pointer to the left by a fourth of a cell User:SoundOfScripting
ɸ
Move the pointer to the left by an eighth of a cell User:SoundOfScripting
Ɔ
Move the pointer to the right by an eighth of a cell User:SoundOfScripting
Θ
Swap the accumulator and the second accumulator. User:SoundOfScripting
Ψ
Swap the accumulator and the third accumulator. User:SoundOfScripting
θ
Swap the accumulator and the fourth accumulator. User:SoundOfScripting
"
Start or terminate a string, placing the codepoint of characters into consecutive cells. Putting characters with codepoints greater than 255 is an error. User:JonoCode9374
#
Terminate the program unconditionally. User:Camto
j
Jump to the (0-indexed) nth j where n is the value of accumulator. User:TwilightSparkle
'
Set the current cell value to the following character. Putting characters with codepoints greater than 255 is an error. User:TwilightSparkle
q
Change all the program's instructions to the next one in this list. Error if there is no next instruction. User:Camto
w
Change all the program's instructions to the previous one in this list. Error if there is no previous instruction. User:Camto

To be improved

Feel free to improve these and put them back in the main list under your name, or move things from the main list to here, provided there's a valid reason to do so.

Command Description Contributor Issue(s)
Skip past characters until the next , and copy the symbol id of those characters into the cell at the pointer. (Then skip the terminating space itself.) Having an odd number of spaces in source code is a syntax error. User:IFcoltransG Moved by request of User:IFcoltransG.