Instruction Tape:
Memory Tape:
Machine State:
Norf**k is an esoteric language which is somewhat like the language Brainf**k. Norf**k, however, is simpler, and has only 3 commands, whereas Brainf**k has 6 commands, not including I/O. The language is not, however, Turing complete. The language's primary function is to simulate NOR gates; NOR gates can be combined to yield any kind of finite logic system.
= MEMORY =
In Norf**k, there are 3 places where things are stored: the instruction tape, the memory tape, and the machine state.
The instruction tape contains all the commands entered by the user. Each command is a single character. Commands are executed in sequential order. After the last command has been executed, the machine will loop back to the beginning of the instruction tape.
The memory tape contains a set of cells which contain boolean values: T for true, or F for false. In this implementation, the length of the memory tape is cells long, but it can be longer if needed. A memory head, shown in red, points to a single cell. Data can only be written to and read from the cell at the head. The program can move the head from cell to cell.
Lastly, the machine state stores a single boolean value. The state is used to shuttle information from one part of the tape to another.
= COMMANDS =
There are 3 commands in Norf**k: >, <, and !.
>: Move the memory head 1 cell to the right.
<: If the value at the memory head is true, write true to the state. Move the memory head to the first cell.
!: Write the *inverse* of the state to the cell at the memory head. Set the state to false, and move the memory head to the first cell.
= EXAMPLE PROGRAMS =
Flip-flip program: A very basic program, simply changes the value of the first cell over and over again. To run the program, copy the code below (<!), and paste it into the instruction tape. Then press "Execute Automatically". Alternatively, you can press "Execute Next Command" for slower execution.
AND program: Simulates an AND gate. Click on the first 2 cells to change the input. The output is at the 5th cell. The output cell will only be true if and only if the 2 input cells are also true.
Binary counter program: Counts up to 7 in binary. The first 3 cells display the output, where each T represents a 1, and each F represents a 0. It takes a little time for it to count, so be patient.
Equality test program: Input two 3-bit binary numbers in the first 6 cells. If the numbers are equal, the program will write true on the last cell on the right (the 32nd cell). Else, it will write false.
Multiplexer program: Accesses 1 of 8 bits on the memory tape by using a 3 bit address. Input the address into the first 3 cells, and the 8 bits of memory into the 4th through 11th cells. The address determines which bit, starting from the right, will be read. The output of the multiplexer is on the rightmost cell (the 32nd cell). Because this program has so many commands, it takes a couple minutes to run. While you're waiting, enjoy the busybody work the interpreter does!
For a more advanced Norf**k implementation, with much faster processing power and a shorthand translation system, please go here:
Norf**k Compiler