Cerberus
Jump to navigation
Jump to search
Every Cerberus program is 3 lines long. It uses a stack and executes commands based on the size of groups of .
and -
. The first column that doesn't contain only .
and -
is the end of the program, so anything after that is a comment.
The IP starts at the left side of the second line and moves right until the end of the program.
If there aren't enough items for a command, it is treated as a no-op.
Commands
Size of Group | Character | Meaning --------------+-----------+-------- 1 | . | Push 1 to stack 1 | - | Push -1 to stack 2 | . | Push input to stack 2 | - | Pop and print top of stack 3 | . | Pop A and B, push A-B 3 | - | Pop A. If positive, push A!, else push -((-A)!) 4 | . | Swap top 2 items 4 | - | Duplicate top item 5 | Any | No-op 6 | . | Pop A, set current IP location as A-marker 6 | - | Pop A, jump to A-marker (no-op if undefined)
Example Program: Truth-machine
.-...-..--.--....-..-.-- .-.---..-.--.----..-..-- --.-..-.--.-.....-.-..--