Grawlix
Brainfuck with more swearing. A grawlix is the row of symbols a cartoon prints instead of a curse.
DMC, 2017 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
DMC made Grawlix in 2017 to add to brainfuck while keeping its spirit. Every brainfuck program is still a Grawlix program. On top come a stack, decimal input and output, a loop that runs while the cell is zero, shifts that double or halve a cell, and functions.
Read the story
The shifts make numbers cheap. +|||+||| is 1, then 8, then 9, then 72, the code of H.
The machine
| Command | Does |
|---|---|
> < + - , . [ ] | As in brainfuck, on 8-bit cells |
: ; | Push the cell, pop into the cell |
? = | Read a decimal number, print the cell as three digits |
/ | | Shift the cell right, left |
( ) | Loop while the cell is 0 |
{ } | Define a function, skipped where it stands |
@ | Pop a number and call that function |
^ | Halt |
Functions are numbered from 0 in the order their braces appear.
Example
The truth machine keeps two copies of a cell on the stack.
The truth machine keeps two copies of a cell on the stack. On 0 the zero loop pops them and prints 000. On 1 it skips the loop and prints 001 forever. The last line defines function 0, pushes a 0 from the cell next door, sets the first cell to 3 and calls it.
The Fibonacci prints the sequence in three digits until it rolls over 255, and stops at the 192nd number, the first that is 0 mod 256.
Patterns it teaches
- Turing tarpit: brainfuck underneath.
- Stack machines: a stack beside the tape.
Further
See also
Grawlix builds on Brainfuck.
Brainfuck derivatives
Cell-based
Write your own in Run Convert a program from Grawlix
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: grawlix.
Command line
shib run grawlix -e ':+:?(;;=^);[=]' --input '0'shib manual grawlixSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/grawlix.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org