IINC is an esoteric programming language by User:Zzo38.
A program is a sequence of "lines", separated by any whitespace, not necessarily by newlines. Each line is formatted as follows:
Numbers (line numbers and values) are unbounded non-negative integers. Pairs of numbers can be encoded as a single one, their mingle.
Lines can be numbered in any order and any numbers can be skipped. They are executed in the order they are listed in the program. There must be no duplicate line numbers.
A number can be an expression, which is evaluated by the preprocessor:
- (n) is the initial value at the line numbered n, which has to be before the current line in the program.
- (n,m) is the mingle of n and m.
- An omitted number is the same as zero.
A command can be a command name or a list of commands in parentheses and separated by commas (such as "(OUT,20OUT,INC,(1,3)DEC)"). The commands in a list are executed in order when their line is executed. The numbers before the commands are added to the current line's value to find the value for executing that command. A GOTO command is only allowed at the end of a list.
Comments begin with * and last until the next actual newline character.
(Note: Any command that cannot be performed or whose parameter is invalid has no effect.) The (Value) for a command is the value of its line, plus any value immediately before the command if it is in a list.
- INC: Increment the value at the line numbered (Value).
- DEC: Decrement the value at the line numbered (Value) if not already zero.
- GOTO: Go to line (Value).
- IN: Get a number from input and store as the value at the line numbered (Value).
- OUT: Output the number (Value).
- PUSH: Push the number (Value) to the stack.
- POP: Pop the stack and store the resulting number at the line numbered (Value).
- QUIT: End the program.
- MIN: Pop 2 numbers from the stack, push the mingled value.
- UN: Pop a number from the stack, unmingle it and push the 2 resulting numbers.
* This program inputs 2 numbers and adds them together. (0,1):((1,0)IN,(0,3)IN) (0,2):1PUSH (0,3):(PUSH,MIN) (0,4):(0,5)POP (0,5):GOTO (0,6):(1,0)INC (0,7):(0,3)DEC (0,8):(0,2)GOTO (1,0):(OUT,QUIT)