From Esolang
Jump to: navigation, search
Paradigm(s) imperative
Designed by User:kerbal
Appeared in 2017
Memory system cell-based
Dimensions one-dimensional
Computational class Turing complete
Reference implementation [1]
File extension(s) .int


Integ is a tape-based esoteric programming language designed by User:kerbal in 2017. The current version is 1.3.

Language Overview

"An esoteric programming language
composed of nothing but parentheses"

Integ is an esoteric programming language in which the only datatype is the integer and the only storage is one large, arbitrary-length, one-way tape of arbitrary-precision integers. Cells on the tape are accessed through non-negative addresses, beginning at 0.


Integ has three major types of syntax features: Operators, Overcomments, and Integer Constants. Integ completely ignores tabs, spaces, and newlines; therefore, one is free to format one's code in any way one wants.


With operators, the program interacts with the tape and performs computations. Operators, which always have one character, use a parentheses-heavy form of prefix notation; the operator character comes first, followed by the operands in parentheses. Operators may be nested. They are implicitly sequenced; in code of the form xyz where x, y, and z are operators, x, y, and z will be evaluated in that order and z will be returned.

The following table lists the basic operators found in Integ.

Operator Description
}xy Writes the integer y to address x. Returns y.
{x Returns the integer at address x.
_x Deallocates all addresses between the maximum address and x, returning x.
@x x is a dummy operand. Returns the maximum assigned storage address.
]x Writes the character whose code is x if possible to the standard output. Returns x.
[x x is a dummy operand. Returns a character code where the character is from the input. Implementations that use a list of input characters instead of interactive input (like Integbot on #esoteric-blah) will select a random number between -1000 and 1000 if the list is exhausted.
+xy Returns x + y.
-xy Returns x - y.
*xy Returns x * y.
/xy Returns, using truncation division, x / y, discarding the remainder.
%xy Returns, using truncation division, the remainder of x / y.
"x x is a dummy operand. Returns the time in seconds since the start of the epoch, rounded down.
`xy Returns the random number between x and y, inclusive, where x and y do not have to be in any particular order. Exact source of randomness is implementation-dependent.
<xy Returns 0 if x < y and 1 otherwise.
?xyz Returns and evaluates y if x is 0 and returns and evaluates z otherwise.
~xy Evaluates y while x equals 0. Returns y unless y was not evaluated; in that case, returns 0.

Starting in Integ 1.2, programs may define their own operators. User-defined operators are always alphabetical characters and, in addition to any arguments explicitly required by the programmer, always require a special offset operand to handle any memory that the operator may use.


With overcomments, a program can, if appropriate, save information located in an overcomment while the overcomment itself is removed from the body of the program. Overcomments do not use prefix notation; instead, they use surround notation, which allows them to be placed almost anywhere within a program. The components of an overcomment are not surrounded by parentheses.

Currently, there are three types of overcomments: comments, operator definitions, and OpPack imports. Comments are of the form #x# where x is the text of the comment, and operator definitions are of the form :abc: where a is the number of operands with which the operator will be called minus one, b is an alphabetical character by which the operator will be called, and c is the code that will be executed by the operator. OpPack imports are of the form .x. where x is a unique identification number. Comments are parsed before OpPack imports, and OpPack imports are parsed before operator definitions.

No comment information is retained by the parser.

Operator definitions

The rules surrounding user-defined operators are fairly complex.

Operator definitions are treated similarly to comments; they can be positioned literally anywhere in Integ code as their contents will be noted and removed by the parser before code execution. Operator definitions may be positioned before, after, or even during calls to the operators they define; as a result, Integ does not allow the same operator to be defined multiple times. Note that because code executed during an interactive shell session is persistent until the session concludes, one must clear the user-defined operators that have already been defined to be able to redefine them. To do so, one must use , which is not an operator. , which must be written on its own line in the interactive prompt, will remove all of the user-defined operator definitions. Note that , only works in the interactive prompt, not in regular programs.

As mentioned, the first non-whitespace, non-hash character of an operator definition must be a non-negative integer of operands with which the operator will be called minus one. User-defined operators must be called with a special operand, the offset operand. As code executed by user-defined operators uses storage, the operator must be provided with an offset, which is basically the first position on Integ's array of integers that the operator is allowed to access. For instance, if the operator was called with an offset of 5, the operator would only be able to write and read to the array starting with address 5. Note that the offset is used to calculate relative addresses; to a user-defined operator and its definition, storage starts at 0. For instance, an address that would be considered address 3 by a user-defined operator called with offset 5 is actually 5 + 3 = absolute address 8. Therefore, if the operator tried to write to address 3, it would actually be writing to absolute address 8 and can be accessed at address 8 outside of the operator. Certain relative addresses have special significance for a user-defined operator. Relative address 0 is the output address; the value that it holds when the code in the body of the operator definition finishes executing is the value that the operator will return. Integ automatically writes the value 0 to this relative address when the operator is called; to give it a different value, one must simply write to it as one would write to a normal location in the body of the operator.

If the user specified a value of a (where :abc:) other than 0 (which is allowed; in this case, the only expected operand is the offset operand), a additional operands will be expected during an operator call. The values passed to these operands can be accessed by reading from relative storage addresses 1 - a. For instance, if a = 5, the operator will expect 5 operands that will be automatically written to addresses 1 - 5. The first operand in the call (besides the offset operand, which is not written anywhere) will go to 1, the second to 2, and so forth.

As mentioned, b in :abc: is the single alphabetical character by which the operator will be called. At the moment, this means that an Integ program may have a maximum of 52 user-defined operators.

c in :abc: is the code that will be executed when the operator is called. All of the regular Integ operators are available, but, as noted, addresses are offset to the starting address defined in the offset operator. Relative memory address 0 is reserved for output and relative memory addresses 1 - a are reserved for input. One can do what one wants with all other addresses greater than a, but one should be careful not to overwrite something important on the tape in the process; remember that relative addresses translate to absolute addresses. All user-defined operators (including the one being defined) are also available. Recursive calls are possible; however, the reference implementation generates an error if recursion exceeds a certain depth (determined by Python) because the underlying Python implementation generates an error if recursion exceeds a certain depth. Still, this matter is officially implementation dependent; implementations where recursion causes no issues are free to allow as much recursion as they wish.

This operator definition creates an operator, a, that prints its first non-offset operand and then calls itself again (this operator assumes that it will have an offset of 2):


This operator can then be called:


where 2 is the offset and 97 is the code of the character (a) that will be printed.

OpPack Imports

OpPacks (other Integ programs) are imported using the syntax .x. where x is the identification number of the OpPack not surrounded by parentheses. OpPacks are executed and removed before the program importing the OpPack is executed; as a result, OpPack imports may be placed almost anywhere within a program. Imports do not return a value; however, the OpPack will be executed like a regular program, so OpPacks can print to output and import other OpPacks. Most usefully, user-defined operators in an OpPack can be used by the importing program, hence the name OpPack. User-defined operators from OpPacks have the same properties and calling behavior as User-defined operators from the importing program. I recommend (but will not force) OpPack creators to use uppercase letters for operator characters so that importing programs can at least use the lowercase letters.

The Integ standard library has identification number 0 and therefore may be imported with 0.

To import an OpPack, the Integ interpreter connects to a GitHub repository (at [2]) and finds the file with the name corresponding to the OpPack's identification number. The file contains a URL to the OpPack's actual location online. Integ retrieves the file at the URL and executes it. Therefore, one must have an internet connection to use OpPacks. Also note that OpPacks must always be retrieved through the Internet.

Right now, Integbot in the #esoteric-blah freenode IRC channel allows users to add OpPacks to the GitHub and to get info on individual OpPacks.

Integer Constants

Integ supports positive, negative, and zero arbitrary-precision integer constants. As noted, it supports no other datatype. In an operand, an empty set of parentheses is read as the integer constant 0; therefore, }()() is equivalent to }(0)(0). However, in an operator definition, the first character must be an integer even if the integer is 0.

Computational class

Integ is probably Turing-complete; Integ handles memory very much like a Turing machine. However, there is no formal proof yet that Integ belongs to this computational class.


Hello, world!


Cat program




A shorter quine is






The Python reference implementation can be found at [3]. This implementation features an interactive interpreter (to exit the interpreter, type $ on its own line).

The Python reference implementation attempts to closely and flawlessly model the Integ standard listed here and in other places, such as the GitHub and the .py file containing the implementation.


Integbot is a bot written in Python designed to respond to Integ commands in IRC. Because it is designed to work in IRC, Integbot has a few limitations compared to the reference implementation; execution of a command will terminate after 5 seconds, and commands cannot print an unlimited number of characters to the output. Nonetheless, Integbot is often more convenient to use than the reference implementation; nothing must be downloaded to one's computer.

If Integbot is online, it will be in #esoteric-blah, the esolang community's bot testing channel.

External resources