an attempt at a whimsical programming language
C++ CMake
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
src
.gitignore
CMakeLists.txt
README.md
main.cpp

README.md

EKLIPS

an attempt at a whimsical programming language

Intro

EKLIPS is a programming language (+interpreter) I'm making just for the heck of it. I've never given a thought to programming language design before, so this should be fun, right?

EKLIPS serves no practical purpose and is deliberately weird. My main goal is to make the language easy to parse; that is, each command must only be one character long so no lookaround is required. All other properties of the language must be subordinate to that. (Producing short code isn't a goal either, so no code golfing suitability for you.)

EKLIPS stands for "Eric Kaisers leicht interpretierbare Programmiersprache, which is German for "Eric Kaiser's easily interpretable programming language". (A suitable English translation might be KEPLERKaiser, Eric; programming language; easily readable.) Again, the clumsy all-caps acrostics are deliberate.

I think EKLIPS is Turing complete, but I have no clue how to verify that.

I declare EKLIPS finished, even though it's still lacking input support. (Usefulness is not a main goal, remember?)

Premise

EKLIPS is based on a stack of integers, with one-character commands manipulating it. Unrecognized commands are ignored. There are 26 built-in variables, named a through z and marked as unset by default.

Command reference

Command Action
0 … 9 Push a one-digit number to the stack.
^ Remove the topmost element from the stack. If the stack is empty, the program is aborted.
% Duplicate the topmost element. If the stack is empty, the program is aborted.
" Swap the two topmost elements. If the stack contains less than two elements, the program is aborted.
_ Clear the stack.
+ - * / Perform a mathematical operation on the two topmost elements, removing them from the stack, and push the result. The topmost element is the second operand. If the stack contains less than two elements, or a division by zero occurs, the program is aborted.
. Output the integer representation of the topmost element. If the stack is empty, the program is aborted.
: Output the ASCII representation of the topmost element. If the stack is empty, the program is aborted.
A … Z Save the topmost element to a built-in variable. If the stack is empty, the program is aborted.
a … z Push the contents of a variable to the stack. If the variable isn't set, the program is aborted.
? Compare the two topmost elements, removing them from the stack, and push 1 if they're equal and 0 otherwise. If the stack contains less than two elements, the program is aborted.
[ Jump to after the next ] command if the topmost element is 0, do nothing otherwise. If the stack is empty, the program is aborted.
] Jump to after the next [ command if the topmost element not 0, do nothing otherwise. If the stack is empty, the program is aborted. Simply put, a block enclosed by [ and ] is run while the topmost element is nonzero. Note that nested loops aren't supported.

Sample programs

"Hello World!"

89*:25*%*1+:7+::3+O:48*:9%*6+:o:3+:6-:25*%*:3/:

Calculating a^b

ab1-B[I^a*i1-]^. (assumes a and b are set)