Kantate

From Esolang
Jump to navigation Jump to search

Kantate is an esolanguage with one instruction/operation that takes three arguments and then moves forward, never halting. The language was designed by Keymaker, invented in 2010 or so but finished (and proven Turing-complete) and published not until 2016.

Description

The language has no distinction between memory and program, it operates in data space consisting of unbounded non-negative integers, the list/array stretching into infinity. The program input initializes values from the beginning of the data. There is an execution pointer that points to a location in the data (initially to 0) and takes three arguments (source, length, destination), executes (see below), and then moves three positions forward. The process never ends.

The number at the position of the execution pointer is the first argument, the next two numbers are the next two arguments. The arguments are:

  • source - defines a position from which data will be read
  • length - defines how many numbers will be taken (if 0, the instruction does effectively nothing)
  • destination - defines a position where addition will happen

The instruction/operation, after taking the arguments, takes length amount of numbers from source, then adds those numbers to respective numbers starting from destination. If the arguments were (3,70,20), the instruction would take 70 numbers starting from position 3, then add those 70 numbers to the numbers in data starting from position 20.

Computational class

The Turing-completeness of the language can be, for instance, shown by translating Sequential tag system (or Cyclic tag system) to it. Here is a translator for the task: http://yiap.nfshost.com/esoteric/kantate/trans.c For example, given input data "10.11;0." (where the initial memory string is 10 and the program string 11;0), the translator creates:

% TRANSLATION oz oosz
6.-54. 48.--
48.--
48.-48. --48.
--48.---48.-48.--48.-----48.---48.-48.--48.--------48.---
0.--
57.45.105.
9.45.105.
0.1.66. 0.1.2. 66.1.75. 2.1.77. 0.1.0.
0.1.81. 0.1.2. 81.1.90. 2.1.92. 0.1.0.
3.1.0.
0.1.99. 0.1.2.

Observing the state of the STS simulation is not easy. (One can read more about it on the Kantate page, external resources.) For example, this is the state of the data after the first 200 Kantate operations:

534 0 1110 48 0 0 48 0 0 48 0 48 0 0 48 0 0 48 0 0 0 48 0 48 0 0 48 0 0 0 0 0 48 0 0 0 48 0 48 0 0 48 0 0 0 0 0 0 0 0 48 0 0 0 0 0 0 57 45 105 9 45 105 0 1 66 6 1 2 66 1 75 2 1 77 6 1 102 0 1 81 6 1 2 81 1 90 2 1 92 6 1 150 3 1 0 0 1 99 54 1 2 48 0 0 105 45 153 9 45 153 0 1 114 54 1 2 114 1 123 2 1 125 54 1 150 0 1 129 54 1 2 129 1 138 2 1 140 54 1 150 3 1 0 0 1 147 102 1 2 48 0 0 153 45 201 9 45 201 0 1 162 102 1 2 162 1 171 2 1 173 102 1 246 0 1 177 102 1 2 177 1 186 2 1 188 102 1 294 3 1 0 0 1 195 150 1 2 0 0 0 201 45 249 9 45 249 0 1 210 150 1 2 210 1 219 2 1 221 150 1 390 0 1 225 150 1 2 225 1 234 2 1 236 150 1 438 3 1 0 0 1 243 198 1 2 48 0 0 249 45 297 9 45 297 0 1 258 198 1 2 258 1 267 2 1 269 198 1 438 0 1 273 198 1 2 273 1 282 2 1 284 198 1 438 3 1 0 0 1 291 246 1 2 48 0 0 297 45 345 9 45 345 0 1 306 246 1 2 306 1 315 2 1 317 246 1 534 0 1 321 246 1 2 321 1 330 2 1 332 246 1 582 3 1 0 0 1 339 294 1 2 0 0 0 345 45 393 9 45 393 0 1 354 294 1 2 354 1 363 2 1 365 294 1 678 0 1 369 294 1 2 369 1 378 2 1 380 294 1 726 3 1 0 0 1 387 342 1 2 48 0 0 393 45 441 9 45 441 0 1 402 342 1 2 402 1 411 2 1 413 342 1 726 0 1 417 342 1 2 417 1 426 2 1 428 342 1 726 3 1 0 0 1 435 390 1 2 48 0 0 441 45 489 9 45 489 0 1 450 390 1 2 450 1 459 2 1 461 390 1 822 0 1 465 390 1 2 465 1 474 2 1 476 390 1 870 3 1 0 0 1 483 438 1 2 0 0 0 489 45 537 9 45 537 0 1 498 438 1 2 498 1 507 2 1 509 438 1 966 0 1 513 438 1 2 513 1 522 2 1 524 438 1 1014 3 1 0 0 1 531 486 1 2 48 0 0 537 45 585 9 45 585 0 1 546 486 1 2 546 1 555 2 1 557 486 1 1014 0 1 561 486 1 2 561 1 570 2 1 572 486 1 1014 3 1 0 0 1 579 534 1 2 48 0 0 585 45 633 9 45 633 0 1 594 534 1 2 594 1 603 2 1 605 534 1 0 0 1 609 0 1 2 609 1 618 2 1 620 0 1 0 3 1 0 0 1 627 0 1 2 0 0 0 633 45 681 9 45 681 0 1 642 0 1 2 642 1 651 2 1 653 0 1 0 0 1 657 0 1 2 657 1 666 2 1 668 0 1 0 3 1 0 0 1 675 0 1 2 48 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 48 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 48 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 48 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 48 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 48 
x = 600
sp=534 ep=1110 co=48
data: 1101101101100

(Here sp and ep refer to start and end positions of the simulated STS data string. co is the simulation's constant that is used to space the data and the program so that both may expand without becoming entangled.)

External resources

  • Kantate page (the specs, a STS-to-Kantate translator, an interpreter in Python)