SPL

From Esolang
Jump to navigation Jump to search
For the functional stack language, see spl. For the Shakespearean language, see Shakespeare.

SPL is an esoteric programming language invented by StelK around December 2005. It is very similar to Brainfuck but it has some new instructions. It was made only as a hobby. SPL can handle only integers.

Command set

The SPL command set is that of Brainfuck with some alterations.

Command Description
> Move pointer right
< Move pointer left
+ Increment the byte at the pointer
- Decrement the byte at the pointer
. Output the byte at the pointer
, Input the byte at the pointer
[ Jump past matching ] if the accumulator is 0
] Jump back to matching [ unless the accumulator is 0

New instructions:

Command Description
^ Load the current byte into the accumulator
$ Wait for an input and put it into the accumulator
% Put in the current byte the result of the current byte%accumulator
m Multiply the current byte by the accumulator
a Add the accumulator to the current byte
s Subtract the accumulator from the current byte
d Divide the current byte by the accumulator
& Terminate the program immediately
"..." Print the string literal enclosed in the double quotation marks
#...# Comment (non-nestable)

Examples

To print text you can simply put it between " and ". So the classic Hello, world! program is:

"Hello World
"

The newline character is also printed. Text between # and # is a comment. Comments can't be nested. (The current implementation allows you to match an [ or ] inside comments for interesting results.)

This asks a number and prints the numbers between it and zero:

"n: ",^[." "-^]"
"

An infinitely repeating cat program is implemented in the following:

,.^["
",.^]

See also

  • Brainfuck: The language from which SPL is born.

External resources

Interpreter

  • Common Lisp implementation of the SPL programming language.