Eek!

From Esolang
Jump to navigation Jump to search
Logo for Eek!

Eek! is an esoteric programming language created by User:Zero player rodent that only uses the characters "E", "e", and "k".

Commands

Command Outcome
E Moves the pointer to the right once.
e Increments the cell that the pointer is on by 1. Set the cell to 20 if the value stored in it is greater than 20.
k Move the pointer to the right once, then set the cell that the pointer is on to 21.

Explanation

In Eek!, the command "E" will move a pointer on an array of cells to the right once. The command "e" will increment the cell that the pointer is on. The language will then interpret the numbers in the array as instructions that it executes. It will start on cell 0, and move to the right before interpreting any commands. Any character in an Eek! program that is not "E", "e", or "k" will be treated as a comment. The language uses two stacks for memory, which will be referred to as "stack A" and "stack B". Below is the list of numbers that the language will interpret as instructions.

Numbers

Number Instruction
0 Increment the accumulator.
1 Increment the value at the top of stack A by 1.
2 Increment the value at the top of stack A by 10.
3 Print the ASCII character associated with the value at the top of stack A.
4 Set the value at the top of stack A to the ASCII value of one byte of input.
5 Move the pointer on the array that holds the instructions backwards a number of cells equal to the value in the accumulator.
6 Push 0 onto stack A.
7 Pop the value off the top of stack A a random amount of times, the highest possible amount of times is equal to the value in the accumulator minus 1.
8 Move the pointer on the array that holds the instructions forwards a number of cells equal to the value in the accumulator.
9 Pop the value off the top of stack A.
10 Move the pointer on the instruction array to the right 2 times if the value at the top of stack A is equal to the value in the accumulator.
11 Move the pointer on the instruction array to the right 2 times if the value at the top of stack A is not equal to the value in the accumulator.
12 Decrement the accumulator
13 Set the value in the accumulator to 0.
14 Set the value in the accumulator to the value at the top of stack A.
15 Push the value in the accumulator to the top of stack A.
16 Print the value stored at the top of stack A.
17 Push the value in stack A to stack B.
18 Push the value in stack B to stack A.
19 Pop the value off the top of stack B.
20 Decrement the value at the top of stack A by 1.
21 Terminate the program.

Note that the instruction pointer usually moves forward one cell before interpreting a number as an instruction. An exception to this is when you use the commands associated with the numbers 10 and 11. If the instruction pointer moves forward two cells after the command is interpreted, it will interpret the command it is on without moving forward again (although if the command is a 10 or 11, the instruction pointer will move forward without interpreting it.). Another thing to keep in mind is that when the command associated with the number 5 causes the instruction pointer to move backwards, the language will move forward one cell before interpreting an instruction if the instruction's number is lower than 5.

Computational class

Eek! is Turing complete because it can simulate a version of brainfuck with unbounded cells. The +-., commands have a direct counterpart in Eek!, and with 2 stacks, a tape of memory can be simulated as well as the >< brainfuck commands. Eek! is also capable of arbitrary conditional trampolines, which can simulate the [] commands.

Derivatives

There are a few Eek! derivatives, all being created or co-created by User:Zero player rodent. One of them is . It is the same as Eek! but it has different syntax. There's also PaRappa which is based on an older version of Eek!. There is a derivative called NOO! that comes bundled with the Eek! interpreter. It is a slightly modified version of Eek!, with the syntax altered.

Example programs

Cat program.

EEEEeeeeEeeeEeeeeek!

Reverse cat. It expects a newline after input.

EeeeeeeeeeeeeeEeeeeeeEeeeeEEEEEEEEEEEeeeeeeeeeeEeeeeeEeeeeeeeeeeeeeEeeeeeeeeeeek!
EEEEEEeeeEeeeeeeeeeEeeeeek!

Program that generates pseudorandom binary digits.

EeeeeeeeeeeeeeEeeeeeeEeEEEeeeeeeeEeeeeeeeeeeeeeeeeEEEEEEEEeeeeek!

Truth machine.

EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEeeeeEeeeEeeeeeeeeeek!
EeeeeeeeeeeeeeEEEeeeEeeeeek!

External Resources

In-browser interpreter (Javascript)

Original interpreter (Ruby)