NoComment

NoComment is an esoteric programming language created by User:CaptainFoxtrot that aims to combine the simplicity of brainfuck, the efficiency of stacks, and the power of one-liners.
==Environment==
The environment that a NoComment program has access to consists of:
* Like in brainfuck: A static, flat memory space divided into bytes, initialized to all zeros, and a moveable pointer, initially at the 0th cell. 
* A stack consisting of byte-sized items.
==Terminology==
Some terminology to shorten some explanations.
Phrase 	Meaning
"Pointer" 	Either the memory pointer itself or its position.
"Value of the pointer"	The value of the memory cell at the pointer.
==Source code==
The extension of a source file does not matter but it is preferred that .noc is used. It is not possible (and it will not ever be possible) to import or include code from other source files.
===Commands===
In total, there are 10 commands. Each command is exactly one character, case sensitive ('a' is different from 'A').
Commands may not take any arguments.
After a command has been executed, program execution begins at the next character in the source code (in the reference implementation, the "instruction pointer" is simply incremented). The program simply terminates if the last character has been executed and it is not a jump.
Command	Function
i 	Increment the value of the pointer
d 	Decrement the value of the pointer
c 	Clears the value of the pointer (resets to 0)
l 	Decrements the pointer (left)
r 	Increments the pointer (right)
n 	Push the value of the pointer to the stack; the original memory cell is not affected. (on)
f 	Pop a value from the stack and overwrite the value of the pointer with it. (off)
s 	If the value of the pointer is non-zero, peek (do not pop) a value from the stack (let's call it x) and jump x spaces forward in the source code. In reality, you are jumping x + 1 spaces because the program always moves one command forward after a command has executed. Therefore, think of x as the number of instructions you are skipping.
b 	This is the same as above, but for backwards jumps. Be warned: the math works out slightly differently; in order to jump one space backwards you actually need to jump 2 spaces (-2 + 1 = -1).
o 	Output the value of the pointer as ASCII (e.g. 65 = 'A', 32 = ' ').
===Syntax===
NoComment does not really have a syntax. As you may have guessed from the name of the language, NoComment does not allow comments (which is defined to be any character not in the set of commands listed above). Comment characters will throw an error and terminate the program. This means that every single character in a valid NoComment program must be a command; not even spaces or newlines are allowed. Therefore, all valid NoComment programs are one-liners.
==Errors==
* Stack underflow
* Stack overflow, when the stack is static (as in the reference implementation)
* Unrecognized command in source code
* Jump outside of code space (with the s and b) commands
(Pointer overflow and underflow are completely legal and should not crash the program (the pointer will simply move to the opposite end of memory and execution will continue as normal); this is the reason why the memory space needs to be static.)
(Implementation note: The only requirement for errors is that they terminate the program and indicate that an error occurred, in order to differentiate from a normal program termination; they do not have to display the specific error that caused the termination.)
==Examples==
===Hello World!===
(Unoptimized version)
 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiioiiiiiiiiiiiiiiiiiiiiiiiiiiiiioiiiiiiiooiiioriiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiolnnddddddddddddddddddddddddofoiiiofdddoddddddddorioriiiiiiiiiio
===Copying cells===
Copy the value of the pointer to the cell immediately to the right.
 nrf
Values can be copied any number of spaces by replacing the r below with as many l or r commands as needed. e.g. to move a value two spaces to the left:
 nllf
===Add two cells===
If the pointer's position is n, add the cells at n and n + 1 and store the result in n, clearing the cell at n + 1.
(Note: Using this method to add something to zero will result in the correct answer but will be extremely slow, as there is no check for this particular situation before the add-loop. Essentially, 256 will be added to the first byte and subtracted from the second, which are both equivalent to doing nothing due to integer overflow.)
 lnciiiiiiiirrdlilnrrbllfr
===Subtract two cells===
This is the exact same as the add operation, except that it does subtraction, not addition.
 lnciiiiiiiirrdldlnrrbllfr
===Logical not===
If the value of the pointer is 0, push 1; else push 0.
 rnciiinclsrilrnlfrffl
To come: Multiplication, division
==Reference implementation==
Reference NoComment interpreter in C at the official GitHub: https://github.com/captainFoxtrot/noComment
Category:Languages
Category:2020
Category:Implemented
Category:Low-level
Category:Cell-based
Category:Stack-based