# KlingonCode

KlingonCode is an esoteric programming language invented by Tom Price-Nicholson in 2015. It is based on the Klingon language from Star Trek. Instructions, inputs, outputs and error warnings are all given in the Klingon language, using the Klingon alphabet.

## Klingon

The programming instructions must all be given in the Klingon language, using the Klingon alphabet. It doesn't matter which Klingon alphabet you use (there are three), and you can even use symbols from all three in the same program. Outputs are printed on the screen in the Klingon language and alphabet, and inputs must be given in the Klingon language, and will appear on the screen in the Klingon alphabet as you type. Error warnings are also given in the Klingon language and alphabet. It is permissable to use english characters if and only if there is no Klingon equivalent. This will usually be used to display punctuation marks.

## Syntax

The language has no shorthand. Each instruction must be given explicitly, for example Add two and three and show the result on the screen. Any instruction is valid, so long as it is explicit. Therefore, instructions like "get me a coffee" and "Klingons on the starboard bow, activate defense shields" are valid. There are many ways to accomplish the same goal. Some ways to accomplish common tasks are shown below (in english, you have to translate them to Klingon).

### Variables

Storing: "store this in the variable called test."

Using: "use the value in the variable called test."

### Input and output

Input: "show the phrase in brackets on the screen, but don't show the brackets (Input please: )

accept an input from the user

store the given input in the variable called input."

Output: "show the phrase in brackets on the screen (output)."

"show the value of the variable input on the screen."

### Arrays

"Create an array with n dimensions with x cels in the first dimension, y cells in the second dimension, z cells in the third dimension..."

### File input/output

"Find a file at this memory address. Read it, show it on the screen, store it's content in the variable called x, etc etc" "Store a file at this memory address. Call it this." "Destroy the file at this memory address."

### Sums

"subtract alpha from beta."

etc.

### Creating a class

"The following lines define a class called birdofprey. Only use the lines starting with ~ when birdofprey is used elsewhere in the code.

~Line one

~Line two

This is the final line. Lines after this are not part of the class birdofprey."

"Ignore this line. (comment)"

## Quine

A quine is quite easy in KlingonCode. A quine is a program where the output is the source code. In KlingonCode, a quine can be created very easily:

```"(program code)
(program code)
show the entire source code on the screen, including lines that would normally be ignored."
```

## Execution time

If a line has not finished it's execution by the time that a time period called execution time has passd, the program will ask you if you wish to continue with the line or move on to the next one. Execution time is ten minutes by default, but you can change it by typing "the execution time for this line is X minutes. (This is the code for this line)." X doesn't have to be minutes, it can be seconds, hours, days, weeks, years...

You can also type, at the start, "the execution time for this program is X minutes." This changes the execution time for every line in the program.

You can change what happens after the execution time has finished by adding an instruction at the end of the line. For example, "(do this). After the execution time is finished, (do that)."

## Example programs

If you come up with any example programs, feel free to post them here.