Intolerant
Intolerant is a language that wipes the user's hard drive if an error occurs.
Structure
Programs are run as root by the 'Intolpreter', which executes each instruction, and will execute 'rm -rf /' if the program encounters an error, or it encounters invalid syntax. The program has access to 10 registers, which are accessed by prefixing their number (starting from 0) with a '%'. Programs also have access to a data stack, controlled by instructions 8 and 9, and a theoretically infinite memory space, which resizes itself based on the program's current highest used location. Programs can also change the minimum size for the main memory. Main memory is accessed using instructions 11 and 12, and if not previously accessed, can be assumed to be equal to 0. Instead of a numerical constant, a register can be supplied, as long as it is prefixed with a '$' sign. Programs can access the code space, and modify their own code. Code space is accessed using instructions 15 and 16. There are also two special "Block registers" which control the functioning of the block operations, and can be manipulated with instructions 13 and 14. Instructions and registers are 4 bytes in size. Code is loaded linearly into the code space, and the first instruction is at code location 0.
Commands
1 - NOP - No operation
2 - ADD [A] [B] - A = A + B
3 - SUB [A] [B] -
4 - MUL [A] [B] -
5 - DIV [A] [B] -
6 - PUT [A] - Put character represented by data in register A to the console
7 - GET [A] - Get character from console into register A
8 - PUSH [A] - Push data in register A onto the stack
9 - POP [A] - Pop data from the stack onto register A
10 - SREG [R] [D] - Set register R to contain value D
11 - WMEM [R] [L] - Write value in register R to memory location L
12 - RMEM [R] [L] - Read value in memory location L to register R
13 - SETSIZE [X] - Set block operation size
14 - CODER [R] [L] - Set register R to instruction L
15 - CODEW [R] [L] - Set instruction L to register R
16 - BCPY [S] [T] - Copy memory block of size in block register, starting at position S to position T
17 - CBCPY [S] [T] - Copy code block of size in block register, starting at position S to position T
18 - BSET [S] [V] - Set block of size in block register, starting at position S to value V
19 - CBSET [S] [V] - Set code block of size in block register, starting at position S to value V
20 - HLT - End program
21 - JMP [L] - Jump to location L
22 - JZ [L] - Jump if previous math operation resulted in 0
23 - JNZ [L] - Jump if previous math operation resulted in a nonzero value
24 - JNEG [L] - Jump if previous math operation resulted in a negative value
Potential Errors
Invalid code memory address
Invalid register
Invalid number
Math out of range
Division by zero
Program end reached without HLT
Invalid instruction
Stack overflow
Stack underflow
Invalid jump location
Over 10 NOPs in a row
Out of memory
Ctrl-C received