Infinite Goto

Infinite Goto is an esoteric programming language created by User:PythonshellDebugwindow.
==Memory model==
Programs in Infinite Goto have access to a tape of 45 unbounded nonnegative integer cells, each of which is initially set to zero. Cell numbering starts from zero. A cell pointer, which starts at cell 0, is used to keep track of the current cell.
==Syntax==
Each valid line of an Infinite Goto program must contain only an integer; all other lines, including empty ones, are considered invalid. Valid integers must consist exclusively of the digits 0 through 9, with the exception of an optional initial minus sign (-). The first digit of a valid integer cannot be 0 unless the integer contains no other digits.
While not required, it is considered good practice to leave unused lines blank, or in shorter programs to mark each unused line with a negative integer whose absolute value is equal to the number of the line.
Note that the number of a line is distinct from its integer; the former is its index in the program, while the latter is the integer which it contains.
==Semantics==
Flow control consists of jumping to various lines in the program. Lines are zero-indexed, so that numbering starts from zero instead of one. An instruction pointer keeps track of the current line; it starts at line 0.
The integer on a valid line indicates which line the instruction pointer should jump to. More specifically, the integer N indicates that the instruction pointer should jump to line N. If an invalid line is jumped to, the instruction pointer immediately jumps to the next line; if there is no next line, the instruction pointer instead jumps to line 0. Integers greater than or equal to the number of lines in the program are treated as one less than the number of lines in the program; negative integers are treated as zero.
For example, in the following program, the instruction pointer would jump from line 0 to line 1 and back until such time as the program is terminated:
 1
 0
The following program further demonstrates looping behaviour. The instruction pointer first attempts to jump to line 3, but since there are only two lines in the program, it instead jumps to the last line, which is line 1. It then attempts to jump to line -1, but since -1 is negative, the instruction pointer instead jumps to line 0. This loop repeats until the program is terminated.
 3
 -1
===Special effects===
Some lines have a special effect when jumped to. These effects are shown in the following table.
Line number	Effect
5 	Reads a line from standard input. If it is a nonnegative decimal integer, then the current cell is set to its integer value; otherwise, the current cell is set to zero.
16 	Outputs the value of the current cell as a decimal integer followed by a newline.
19 	Jumps to line 20 if the current cell is greater than zero, and to line 21 otherwise.
27 	Jumps to a random line from 28 to 32 inclusive.
35 	Sets the cell pointer to the previous value of the instruction pointer modulo 45. For example, jumping to this line from line 50 would cause the cell pointer to be set to 5, and jumping to this line from line 35 would cause the cell pointer to be set to 35.
All lines whose numbers are even and are not equal to any of 0, 16, 20, 28, 30, or 32 (modulo 45) will increment the current cell when jumped to.
All lines whose numbers are odd and are not equal to any of 5, 19, 21, 27, 29, 31, or 35 (modulo 45) will decrement the current cell if it is greater than zero when jumped to.
Every 45 lines, these special effects occur again; for example, lines 5, 50, and 95 share the same function. Note that jump targets (20, 21, and 28 through 32) are also adjusted, so that line 109 could jump to either line 110 or line 111.
If an invalid line is jumped to, its special effect will not be executed and the current cell will not be incremented or decremented.
At most one jump can be triggered by one jump to a line; this means that an integer on line 19 or 27 will not be used as a jump target for the instruction pointer.
==Examples==
===Numeric cat program===
5
-1
-2
-3
-4
16
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
5
===Random number generator===
This program outputs an infinite list of random numbers between 1 and 5 inclusive.
27
19
16
-3
2
-5
4
-7
6
-9
8
-11
-12
-13
-14
-15
1
-17
-18
19
1
0
-22
-23
-24
-25
-26
27
2
4
6
8
10
===Running total===
See Infinite Goto/Running total.
==Resources==
* An interpreter written in Python
Category:Languages Category:2020 Category:Turing complete Category:Cell-based Category:Implemented