niblet is an esoteric programming language where nibbles are used to store data.
The project can be found on GitHub.
|cell||one of 30,000 locations data may be stored in a program|
|cell pointer||the current location out of the 30,000 available cells|
|source pointer||where the interpreter is in your program's source|
|stack||temporary location where a value is stored before putting in or merging with a cell|
|putting||storing the stack in the current cell before the current cell has been merged|
|merging||storing the stack in the current cell already containing a value|
|token||symbols used in the niblet language. see the "tokens" section for a list|
Cells and the stack
Similar to brainfuck, niblet gives the programmer 30,000 cells to store data. There are a few ways data can be stored into the cell at the cell pointer:
- putting using the Put token
- merging using the Put token as well
- input from the user using the Input token
Putting the stack in a cell, while the stack is a nibble, will be stored as a byte with four trailing zeros. For example, putting 1100 will be stored as 11000000.
Merging will perform the Bitwise OR operation on the current cell, which has four trailing zeros, with the stack, which has four leading zeros. For example, merging 11000000 (the current cell) and 1010 (the stack) will result in the current cell's value to be 11001010.
Once putting or merging has been completed, the Bitwise NOT operation will be performed on the stack. For example, after putting or merging a stack with the value of 1010, the stack will have the value of 0101.
If a cell has already been merged, the Put token will clear the current cell's value and put the stack rather than merging.
The Output token will print the value of the current cell as the character it represents.
Each time a command is run, the cell pointer is incremented by 1. The Back token may be used to return to the previous token, since it moves the cell pointer back twice.
Unlike other tokens, if a Back-source token is found by the interpreter, each proceeding Back-source token will be executed then skipped. This allows the creation of a loop using the Check token to go back multiple tokens.
||Back||move the cell pointer back 2|
||Back-source||move the source pointer back 1|
||Check||only execute the following token if the cell at the cell pointer is not 0|
||Input||get input from user and store in the cell at the cell pointer|
||Output||output the data at the cell pointer|
||Put||store a nibble or merge with existing at the cell pointer|
||Down||decrease the stack by 1|
||Up||increase the stack by 1|
++++<<<<v< ---<<<v<. -<v< ----<<<<v<. ----<<<<<v< +++<<<v<. +++<<<v< +++<<<v<. +++<<<v< ++++++<<<<<<v<. ++<<v< -<v<. -<v< -------------<<<<<<<<<<<<<v<. ----------<<<<<<<<<<v< ---<<<v<. --<<v< ++++++<<<<<<v<. +++++++<<<<<<<v< ------<<<<<<v<. -------<<<<<<<v< +++<<<v<. +++<<<v< -----<<<<<v<. ---------<<<<<<<<<v< ------------<<<<<<<<<<<<v<.