Skip to content

Instantly share code, notes, and snippets.

View iambrj's full-sized avatar

Bharathi Ramana Joshi iambrj

View GitHub Profile
In each iteration, the program checks if the current instruction is +/,/-/./</>/[/] (in that order). If it obtains a match, it executes the instruction, but does not restart the loop; eg if there is a "++" sequence, it executes the first one but compares the second one to a , then - etc, and cycles back to plus.
The tape is configured as follows:
1 = instruction counter (no of instructions executed in current iteration)*
2 & 3 = program counter PC
4 & 5 = tape counter TC
6 = bracket counter (for nested brackets) BC
7 = buffer (always 0 except for copying purposes)
8 = beginning of input program T1 (always 255 except for copying purposes)
9 etc = input program; each instruction takes 4 cells (x; x; 255; 255)