Kipple

From Esolang

Jump to: navigation, search

Kipple is a minimalistic esoteric programming language with a set of stacks, four operators, and a single control structure. Kipple was designed by Rune Berge in March, 2003.

Contents

[edit] Stacks

The stacks are named a-z and contain 32-bit signed integers. There is also a special stack, @, to make outputting numbers more convenient. When a number is pushed onto @, the ASCII values of that number's digits are in fact pushed instead. The @ stack is an example of a wimpmode.

Input is pushed onto stack i before the program is executed; after execution finishes, anything on stack o is popped to output. Since this is Kipple's only IO mechanism, interacting with a Kipple program is impossible.

[edit] Operators

An operand can either be a stack identifier or a nonnegative integer (0 to 2147483647).

> Push left operand onto right stack
< Push right operand onto left stack
+ Push the sum of the right operand and the topmost item on the left stack onto the stack
- Push the topmost stack item minus the right operand onto the stack
? Takes only one operand; clears the left stack if its topmost item is 0

< and > are the same operator, working in different directions.

[edit] Control structure

The control structure is

(stack-identifier code)

where stack-identifier is a-z and code is any sort of code, possibly including additional loops. The code will be run as long as the stack is not empty.

[edit] Examples

[edit] Hello, world!

This program prints "Hello World!":

33>o 100>o 108>o 114>o 111>o 87>o 32>o 111>o 108>o 108>o 101>o 72>o

Alternate version using the string preprocessor:

"Hello World!">o

[edit] Cat

A program that copies its input to output, like UNIX cat.

(i>o)

[edit] Fibonacci numbers

Prints the first 25 numbers of the Fibonacci sequence.

24>n 0>t 1>a
(n-1
  a+0
  t<a>b+a
  c<b>a<c
  n?
)
(t>@
  (@>o)
  32>o
)

The first loop generates the numbers, and the second loop converts them to ASCII.

[edit] Computational class

It should be fairly straightforward to prove by isomorphism that Kipple is Turing-complete. It is known that a Turing machine's infinite tape can be simulated by two stacks; for more information, see e.g. this page. Similarly, the finite-state automaton within the Turing machine should be easily simulatable by Kipple's control structure.

A more direct proof by simulation can be provided by this Brainfuck interpreter written in Kipple, since Brainfuck is known to be Turing-complete.

[edit] External resources

Personal tools