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.
There is a stack that holds stacks with tapes on it. Each tape has a limited number of cells and the cell is circular.
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 low nibble of the cell to the left, followed by the high 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 low nibble of the cell itself, followed by the high 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
For each instruction X in the program, if the index of X in this list of commands in N, then set it to L - N where L is the number of commands. Invalid commands are changed to . User:PythonshellDebugwindow
E
Restart the program. User:PythonshellDebugwindow
For each instruction X in the program, copy X directly in front of itself (e.g., duplicate all instructions in the program). User:PythonshellDebugwindow
Rickroll the user (can output text, play audio, play video, print video link, open video link, or anything else that counts as rickrolling). User:PythonshellDebugwindow
Begin a try-catch-finally block. This runs the first clause (try), and checks it for errors. Next, the third clause (finally) is run regardless of an error, even if the program would normally crash. Then, if and only if an error was found, the second clause (catch) is run. The try block stops execution as soon as an error is found. User:BoundedBeans
Ends a try-catch-finally block. User:BoundedBeans
Separates try and catch in a try-catch-finally block. User:BoundedBeans
Separates catch and finally in a try-catch-finally block. User:BoundedBeans
:
Prints the pointed cell's value as an integer. User:PrySigneToFry
;
Input a integer and dump it into the pointed cell. User:PrySigneToFry
make each cell two cells that are both the half of the original cell. if the cell is 0 just copy it User:Yayimhere
take the number at the pointer then add together all its digits(treating it like base 10) then convert back to binary and take the sum of those digits. then set the cell to that User:Yayimhere
⁅...⁆¬(name) add whats inside the ⁅⁆'s to the current cell. works like a function. you can use input variables. then you reference it by using /name(values) User:Yayimhere
{}-[name] make a variable named name defined as current cell. this can replace any number argument User:Yayimhere
add every non zero cell in front of this command(converted to ascii) User:Yayimhere
⅟any single character set current cell to the ascii value of that single character User:Yayimhere
n push a tape with length n onto tape stack with the pointer starting at the leftmost cell and all cells being set to 0 User:Yayimhere
⤂a program⤃ apply all tape modifying commands to the top of tape stack User:Yayimhere

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.

(All commands hasn't been implemented except the first 8 commands.)

Categories