Meowlang
Every program is a cat talking. The more meows in a row, the higher the number.
Wixette · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 4 known programs · Test method
Run it
The idea
Wixette made Meowlang after Chicken. A program is a list of numbers, and each number is written as that many meows, ended by a semicolon. Meow; is 1 and a bare ; is 0. The cat may speak any of nine words, Meow, Miaow, Meaw, Miaou, Miao, Miau, 喵, ニャー and Мяу, and mix them freely. There is also a plain form with one number on each line.
Read the story
The list is the program and the only memory at once. A push adds to the end of the program and a pop takes from it, so a program can read, overwrite and even eat its own instructions.
The machine
The tail is the last element of the list, and N is the element after the instruction.
| Number | Name | Does |
|---|---|---|
| 0 | RET | Print a line feed |
| 1 | MEOW | Print as many cat emoji as the tail says |
| 2 N | PUSH | Push N |
| 3 | POP | Pop the tail |
| 4 N, 5 N | LOAD, SAVE | Push element N; copy the tail into element N |
| 6, 7 | ADD, SUB | Add or subtract the last two; never below 0 |
| 8 N, 9 N | JMP, JE | Jump to N; jump if the tail is 0 |
| 10, 11 | YOWL, SNIFF | Print a character; read one, 0 at the end |
| 12, 13 | NAP, SCRATCH | Sleep; clear the screen |
Anything from 14 up does nothing. The run ends when the pointer passes the end of the list.
Example
Meow; is MEOW and the three meows after it are the tail, so it prints three cats.
Meow; is MEOW and the three meows after it are the tail, so it prints three cats. Then the 3 runs as POP and eats itself.
In the plain form, PUSH 72 and YOWL print H, PUSH 105 and YOWL print i, and RET ends the line.
The echo reads until the 0 at the end of input and jumps to RET. That 0 stays on the list, runs as one more RET, and the output ends with two line feeds.
The Fibonacci program keeps the last two numbers in elements 2 and 3 of its own code. It prints ten rows of 1, 1, 2, 3, 5, 8, 13, 21, 34 and 55 cats, and at the end its YOWL pops the program's own last element, a 10, and prints it as one more line feed.
Patterns it teaches
- Camouflage: the source is a feline monologue.
- Self-modifying code: SAVE writes into the program.
- Code as data: the stack is the end of the program.
Further
See also
Pseudonatural
Self-modifying
Write your own in Run Convert a program from Meowlang
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: meowlang.
Command line
shib run meowlang -e '11 // [0] SNIFF — read one character from stdin
9 // [1] JE
6 // [2] → jump to index 6 if input is 0 (end of input)
10 // [3] YOWL — echo the character
8 // [4] JMP
0 // [5] → back to index 0
0 // [6] RET — final newline' --input 'cat'shib manual meowlangSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/meowlang.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org