Sesos – meaning brains (culinary) in Spanish ‐ is a recreational programming language based on brainfuck.
Unlike the latter, it is concise, can be typed easily, has somewhat flexible I/O, and is safe for work. However, programming in Sesos is not substantially easier than programming in its parent language.
The typable way of writing Sesos programs is SASM (sesos assembly). Each non-empty line of SASM must contain an assembler directive or an instruction. Every line can contain multiple commands, which must be separated by
,. Additionally, inline comments can be used by prefixing them with a
The tokens of each command – and the commands themselves – may be indented, followed and separated by any combination of tabulators and spaces. The lines themselves may be separated by any combination of linefeeds, carriage returns, vertical tabs and formfeeds.
There are three different assembler directives. All directives apply globally and may appear anywhere in the SASM file. Multiple occurrences of the same directive have the same effect as a single occurrence.
By default, the cells of Sesos' data tape can hold arbitrary precision integers. This directive applies the bit mask
0xff after cell-altering operations, thus replacing arbitrary precision arithmetic with unsigned 8-bit arithmetic.
By default, Sesos reads characters (or bytes, for unsigned 8-bit arithmetic) from STDIN. This directive changes that behavior; Sesos will read one signed integer literal per line instead.
By default, Sesos writes characters (or bytes, for unsigned 8-bit arithmetic) to STDOUT. This directive changes that behavior; Sesos will write one decimal integer per line instead.
Each Sesos program consist of a finite (but arbitrarily large) code tape representing the instructions and a doubly-infinite data tape of cells containing either arbitrary precision integers or unsigned 8-bit integers. All cells of the data tape initially contain zeros. Additionally, there are a code head that marks the current position on the code tape, and a data head that marks the current position on the data tape.
Sesos can interpret ten different instructions that modify the contents of the data tape's cells, move the code or data head, read input from STDIN, or write output to STDOUT. Four of the instructions require a single positive integer argument, in form of a signed integer literal. The remaining instructions do not take arguments.
Unless specified otherwise, all instructions move the code head to the next instruction after completing their task.
This instruction moves the data head n cells to the right. n must be a positive integer.
This instruction moves the data head n cells to the left. n must be a positive integer.
This instruction adds n to the cell under the data head. The exact behavior depends on the assembler directives. n must be a positive integer.
This instruction subtracts n from the cell under the data head. The exact behavior depends on the assembler directives. n must be a positive integer.
This instruction reads a single cell value from STDIN and writes it to the cell under the data head. The exact behavior depends on the assembler directives.
When EOF is reached, the cell under the data head is zeroed. For numeric input, an invalid signed integer literal will also zero the cell. For character input, a byte sequence that cannot be decoded in the default locale is a runtime error.
This instruction write the value of the cell under the data to STDOUT. The exact behavior depends on the assembler directives.
This instruction sets an entry marker at the current position of the code head, then unconditionally jumps to the corresponding exit marker set by either
This instruction sets an entry marker at the current position of the code head. Unlike
jmp, it does not jump to the corresponding exit marker.
This instruction sets an exit marker at the current position of the code head. If the cell under the data head is non-zero, it jumps to the right of the corresponding entry marker.
This instruction executes
get did not hit EOF, it jumps to the right of the corresponding entry marker.
Because of how the instructions are encoded in Sesos' binary files, certain instructions cannot be used under certain circumstances.
fwdmay not immediately follow
rwdmay not immediately follow
addmay not immediately follow
submay not immediately follow
getmay not immediately follow
jnzmay not immediately follow
jmpmay not immediately follow
jmpmust be followed by another instruction.
nopmust be followed by another instruction.
jmp instructions may be omitted if the corresponding exit marker (
jne) is present. Doing so will omit them from the generated binary file as well; the interpreter will add them as needed.
jnz instructions may be omitted if the corresponding entry marker (
nop) is present.
Finally, if the entry marker corresponding to a
jnz instruction is the first (possibly implicit) instruction of the program, it will be promoted to a
jne instruction. Specifying
jne in SASM will generate a different – but functionally equivalent – binary file.
SBIN (sesos binary) files can be created either by hand or by assembling the corresponding SASM.
A binary Sesos file consist of an arbitrary number of triads (consisting of three bits each) that encode directives, instructions, or instructions arguments. These triads are padded by adding or removing trailing 0 bits to reach an entire number of bytes.
Alternatively, an SBIN file can be viewed as a single non-negative integer n, expressed in base 256 in little-endian byte order.
Here, each tk represents a triad.
The first triad is a bit field. If
mask is set, so is the least significant bit of t0; if
numin is set, so is the middle bit of t0; if
numout is set, so is the most significant bit of t0.
The eight instructions that have a counterpart in Sesos' parent language are encoded as a single triad each. The remaining instructions (
jne) are encoded as a pair of triads.
rwd are encoded as zero or more triads, immediately after the corresponding instructions.
The arguments of
sub are encoded in big-endian bijective ternary with an offset of 1. The argument of both instructions start out as 1. For each additional triad, the the argument is tripled and the value of the triad is added to it. Triad 2 (
get) has a value of -1, triad 4 (
sub) a value of 0, and triad 5 (
add) a value of 1.
In similar fashion, the arguments of
rwd are encoded in big-endian bijective binary, also with an offset of 1. The argument of both instructions start out as 1. For each additional triad, the the argument is doubled and the value of the triad is added to it. Triad 6 (
rwd) has a value of 0 and triad 7 (
fwd) a value of 1.
Generating SBIN files
To generate an SBIN file with the interpreter, save the corresponding SASM in a file with extension
sasm, and run the interpreter with the
-a option and that file's basename as command-line arguments.
This will create a binary file with the same basename and extension
Executing SBIN files
To execute an SBIN file – which must have the extension
sbin – run the interpreter with the file's basename as command-line argument.
You can optionally set any combination of the following options.
||Count how many commands are executed.|
||Print debugging information for each executed command.|
The official Sesos online interpreter can be found on Try it online! To use it, simply write the desired SASM in the Code field, and the interpreter will generate and execute the corresponding SBIN file.
If the Debug option is set, the interpreter will print the generated binary code in form of a reversible hexdump.