PIKOlang

From Esolang
Jump to navigation Jump to search

PIKOlang (Praise Innovative Kubernetes Operators)

PIKOlang (Python Is Kinda Overrated) is a simple, interpreted, esoteric 2-Dimensional programming language. To write PIKOlang (Professionally Interpreted Kernel Operations), you need to write a program in a 2D grid, where each cell is a command. The program in PIKOlang (Probably Incomplete Kotlin Object) is executed by a cursor that moves around the grid, executing the commands it encounters. You can either execute the entire program at once or step through it one command at a time. WARNING: If you try to execute at once a program that doesn't terminate, you will enter an endless loop and possibly crash your browser.

Online playground

You can try out the language at the Online Playground. At the top left you can select from a few sample programs to see how it works, before trying it out yourself.

Interpreter

Or you can download the interpreter using this command:

brew install matronator/tap/piko

Or if you don't have Homebrew, you can download the binaries directly from the interpreter's GitHub Releases page.

You can then use the interpreter with this command:

piko file-to-execute.piko

Syntax

Pointers

The program starts with # symbol placed anywhere on the grid. The grid can be arbitrarily large. The pointer always starts facing right and moves in the direction it is facing, executing the commands in order as they are encountered (the pointer moves over them). Currently, there can only be one pointer in the program, but in the future I want to implement concurrency with multiple pointers.

Memory

Each pointer has two memory registers and one output register:

  • Register - A single integer value that can be modified by the program.
  • String Register - An array of characters that can be modified by the program. When in String Mode™️, any characters and symbols the pointer moves over are added to the string register.
  • Output Register - Either a number or a string that is printed when the program exits. If the output register receives a string, the whole register gets converted to a string and any further number added will be appended as a string.
Symbol Description
# The pointer. Can only be once in the source file (at the current time, will change in the future) and always starts facing right
; Exit the program and print the current value of the output register or if it’s empty, print the current register value
v Change the direction of the pointer downwards
> Change the direction of the pointer to right. *Different in Condition Mode
^ Change the direction of the pointer upwards
< Change the direction of the pointer to left. *Different in Condition Mode
", ' Enter/exit string mode (the entrance and exit characters must be same)
+ Add to the value currently in register
- Subtract from the value currently in register
/ Divide the value currently in register
* Multiply the value currently in register
= Print the current value in the register. *Different in Condition Mode
_ Floors the current value in the register to the nearest integer
& Move the entire string register over to the output in FIFO mode
~ Pop the last element from the string register and append it to the output register
: Print the current value of the output register and clears it
! Clear all registers
? Enter or exit condition mode
[A-z0-9] If in string mode, add the character to the string register, otherwise set the register to the value if it’s a digit, or to the Unicode value of the character if it’s a letter
| (Not yet implemented) Split the pointer into two, one going the original direction and the other one 90° rotated. Will be implemented in the concurrency update

Condition mode

Symbol Description
= Check if the value in register is equal to the value in the next cell
> Check if the value in register is greater than the value in the next cell
< Check if the value in register is less than the value in the next cell
! Check if the value in register is not equal to the value in the next cell
? Evaluate the condition and if true, continue moving forward, otherwise rotate the pointer 90° clockwise

Code examples

Hello, World!

#"Hello, World!"&;

Loop to 10

 >?>9?;
     =
#1=  v
 +
 ^   <

Language name usage

When referring to PIKOlang (Programming In Keyboard Only), you should write out the full name of the language and add a unique backronym in parentheses after the name and the name must be formatted in combination of bold and italic (where possible) like in these examples for various languages:

Examples

Markdown:

**PIKOlang *(Pejorative Insults Kill Optimism)***

HTML:

<b>PIKOlang <i>(Polymorphic Ignorant Kind Organization)</i></b>
<!-- Or like this -->
<strong>PIKOlang <em>(Previously I Knew Oprah)</em></strong>

LaTeX:

\textbf{PIKOlang \textit{(Polymorphic Innocent Kinology Objective)}}

BBCode:

[b]PIKOlang [i](Parents In Kansas Overreact)[/i][/b]

Wiki:

'''PIKOlang''' ''(Police Is Killing Orphans)''

Backronym Rules

  1. The backronym must be a phrase that is grammatically and syntactically correct, but doesn’t have to necessarily make sense logically.
  2. The backronym must be unique for each use of the name PIKOlang (Previously Intelligent Kid Overdosed) in a document.

So to reiterate: Each use of the name PIKOlang (Perverse Innuendos Keep Ongoing) in the document should use different backronym. No two uses of the name PIKOlang (Potentially Insecure Koala Overlords) in the same document should have the same backronym.