SPL
- 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) |
To print text you can simply put it between "
and "
.
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.)
Examples
Hello World
The classic Hello, world! program is:
"Hello World "
The newline character is also printed.
Countdown
This asks a number and prints the numbers between it and zero:
"n: ",^[." "-^]" "
Cat program
An infinitely repeating cat program is implemented in the following:
,.^[" ",.^]
Truth-machine
This program implements a truth-machine:
,.^[.]
99 bottles of beer
The following provides a “99 bottles of beer” program:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ^ [ ++ ." bottles of beer on the wall. " . " bottles of beer. " "Take one down, pass it around, " - . " bottles of beer on the wall. " --^ ] "2 bottles of beer on the wall. 2 bottles of beer. Take one down, pass it around, 1 bottle of beer on the wall. 1 bottle of beer on the wall. 1 bottle of beer. Take one down, pass it around, No bottles of beer on the wall. "
See also
- Brainfuck: The language from which SPL is born.
External resources
- Author's home page (ITA) (Includes somewhat buggy implementation.) (dead link)
Interpreter
- Common Lisp implementation of the SPL programming language.