Integ
An esoteric programming language composed of nothing but parentheses.
kerbal, 2017 · Turing complete: unknown · ●●● hard · esolangs.org
Tested with 4 known programs · Test method
Run it
The idea
kerbal designed Integ in 2017; the current version is 1.3. The only data type is the integer, and the only storage is one tape of arbitrary-precision integers. Every operator is a single character written before its operands, and every operand sits in parentheses, so +(2)(3) is 5 and ](+(2)(70)) prints H. Loops and branches are operators too, and they evaluate their operands only when needed. Programs can define their own operators, each working on its own stretch of tape.
The machine
| Operator | Gives |
|---|---|
}(x)(y) | Write y to address x; gives y |
{(x) | The value at address x |
](x) [() | Print character x; read a character |
+ - * / % | Arithmetic, truncating division |
<(x)(y) | 0 if x < y, else 1 |
?(x)(y)(z) | y if x is 0, else z |
~(x)(y) | Evaluate y while x is 0 |
@() _(x) | The highest address in use; drop addresses from x up |
#...# | Comment |
() is the constant 0. Inside parentheses a run of operators is evaluated in order and gives the value of the last one.
Example
The truth machine stores the input at address 0.
The truth machine stores the input at address 0. If it is 0 it prints 0, and if it is 1 it loops forever on ~(), which is always 0, printing 1. The specification also has two quines. The shorter one keeps most of its own text as one integer of 296 digits.
Further
Ideas it shows
See also
Cell-based
Write your own in Run Convert a program from Integ
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: integ.
Command line
shib run integ -e '}()()~(?(-(](}({())([())))(13))(1)())(}()(+(1)({())))' --input 'meow
'shib manual integSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/integ.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org