Meowlang is an esoteric programming language designed for cats.
Visit the online interpreter.
yarnRun a Meow program:
node . -i examples/hello.meownode . -i examples/fibonacci.meowTurn on debug info when running a Meow program:
node . -i examples/fibonacci.meow -dConvert a simplified Meow file to a Meow file:
node src/smeow2meow.js -i examples/fibonacci.smeowStart a local server with
yarn startThe simplest non-trivial program: cat.meow prints 20 cat emojis followed by a newline.
countdown.meow counts down from 10 to 1, printing that many cat emojis on each line.
Print the Fibonacci numbers with cat emojis:
The Fibonacci source code in English Meow:
MeowMeowMeowMeowMeowMeowMeowMeow;
MeowMeowMeowMeow;
Meow;
Meow;
MeowMeow;
MeowMeowMeowMeowMeowMeowMeowMeowMeowMeow;
MeowMeowMeowMeow;
MeowMeow;
Meow;
;
MeowMeowMeow;
MeowMeowMeowMeow;
MeowMeow;
MeowMeowMeowMeow;
MeowMeowMeow;
MeowMeowMeowMeowMeowMeow;
MeowMeowMeowMeow;
MeowMeowMeow;
MeowMeowMeowMeowMeow;
MeowMeow;
MeowMeowMeow;
MeowMeowMeowMeowMeow;
MeowMeowMeow;
MeowMeowMeow;
MeowMeow;
Meow;
MeowMeowMeowMeowMeowMeowMeow;
MeowMeowMeowMeowMeowMeowMeowMeowMeow;
MeowMeowMeowMeowMeowMeowMeowMeowMeowMeowMeowMeowMeowMeowMeowMeowMeowMeowMeowMeowMeowMeowMeowMeowMeowMeowMeowMeowMeowMeowMeow;
MeowMeowMeowMeowMeowMeowMeowMeow;
MeowMeowMeowMeowMeowMeow;
MeowMeowMeow;
MeowMeowMeowMeowMeowMeowMeowMeowMeowMeow;
The Fibonacci source code in Chinese Meow:
喵喵喵喵喵喵喵喵;
喵喵喵喵;
喵;
喵;
喵喵;
喵喵喵喵喵喵喵喵喵喵;
喵喵喵喵;
喵喵;
喵;
;
喵喵喵;
喵喵喵喵;
喵喵;
喵喵喵喵;
喵喵喵;
喵喵喵喵喵喵;
喵喵喵喵;
喵喵喵;
喵喵喵喵喵;
喵喵;
喵喵喵;
喵喵喵喵喵;
喵喵喵;
喵喵喵;
喵喵;
喵;
喵喵喵喵喵喵喵;
喵喵喵喵喵喵喵喵喵;
喵喵喵喵喵喵喵喵喵喵喵喵喵喵喵喵喵喵喵喵喵喵喵喵喵喵喵喵喵喵喵;
喵喵喵喵喵喵喵喵;
喵喵喵喵喵喵;
喵喵喵;
喵喵喵喵喵喵喵喵喵喵;
hello_ascii.meow demonstrates the YOWL instruction
(opcode 10), which pops the tail value and prints the corresponding ASCII character.
The program prints Hello, World! by pushing each character's ASCII code and calling
YOWL:
2 // PUSH
72 // 'H' = 72
10 // YOWL → prints 'H'
2 // PUSH
101 // 'e' = 101
10 // YOWL → prints 'e'
... // (and so on for each character)
0 // RET → newline
Run it:
node . -i examples/hello_ascii.meowecho.meow demonstrates the SNIFF instruction (opcode 11), which reads one character from stdin and pushes its ASCII code to the tail. Combined with YOWL it forms a real-time character echo loop: each key you press is immediately reflected back to the terminal. Press Ctrl+D to end input.
11 // [0] SNIFF — read one char from stdin, push its code
9 // [1] JE
6 // [2] → index 6 (if code is 0, jump to exit)
10 // [3] YOWL — pop code and print the character
8 // [4] JMP
0 // [5] → index 0 (loop)
0 // [6] RET — print final newline and exit
Run it:
node . -i examples/echo.meowmoving_cat.meow demonstrates the NAP instruction (opcode 12), which pauses execution for N milliseconds, and the SCRATCH instruction (opcode 13), which clears the screen. Together they animate a 🐈 emoji gliding across the terminal with a 100 ms delay between frames.
Run it:
node . -i examples/moving_cat.meowA valid Meowlang program is simply a text representation of a Meow List.
A Meow List is a sequence of Meow elements.
Every Meow element contains zero or more Meow tokens. The number of Meow tokens in a Meow element corresponds to a non-negative integer value, which is the value of the Meow element.
A Meow element can be treated either as a Meow instruction or a Meow operand, depending on the execution context:
- When a Meow element is treated as a Meow instruction, the value of the element is the opcode of the instruction.
- When a Meow element is treated as a Meow operand, the operand value is the value of the element.
In the Meowlang runtime, the loaded Meow List is a read/write list, which is both a list of Meow instructions, and the only in-memory data structure that Meow instructions can access.
In other words, code is data and data is code.
A Meow token is a cat cry in plain text. The following Meow tokens are valid and interchangeable in Meowlang programs.
Meowin English (orMiaowandMeawas alternatives)Miaouin French喵in ChineseMiaoin Chinese PinyinMiauin Germanニャーin Japanese Katakana (Katakana because it's onomatopoeia)Мяуin Russian
Meow tokens are case-insensitive. For example, Meow, meow, and MEOW are
the same.
The text representation of a Meowlang program uses semicolon ";" to end every
Meow element.
For example, the following code contains 5 Meow elements, whose values are 0, 1, 2, 3 and 4.
;
Meow;
Meow Meow;
Meow Meow Meow;
Meow Meow Meow Meow;
White spaces including " ", "\t" and "\n" are used for formatting purposes
only, and will be ignored when the program is executed. You may lay out your code
in many different and interesting ways. For example, the following code is an
equivalent representation of the above code:
; M e o w ; MeowMeow ; MeowMeowMeow ; MeowMeowMeowMeow ;
The Meow tokens in the supported languages can be mixed in the same program. For example:
;
喵;
Meow Miao;
Miaou Miaou Miaou;
Miaou 喵 Meow Miao;
The preferred file extension of the Meow file format is ".meow".
A Meow program can also be stored and loaded as a sequence of non-negative integer numbers, each number corresponding to the value of a Meow element. For example:
0
1
2
3
4
The preferred file extension of the simplified Meow file format is ".smeow".
| Opcode | Name | Cat Behavior | Description | IP Operation |
|---|---|---|---|---|
| 0 | RET |
- | Print an empty line "\n" to the output console. |
IP++ |
| 1 | MEOW |
- | Print T cat emoji characters to the output console. |
IP++ |
| 2 | PUSH |
- | Push N to the tail of the Meow List. |
IP += 2 |
| 3 | POP |
- | Pop the tail element from the Meow List. | IP++ |
| 4 | LOAD |
- | Push the value of E(N) to the tail of the Meow List. |
IP += 2 |
| 5 | SAVE |
- | Copy the value of the tail element to E(N). |
IP += 2 |
| 6 | ADD |
- | Add the values of the last two tail elements, pop them from the tail, then push the result to the tail. | IP++ |
| 7 | SUB |
- | Subtract the value of the last element from the value of the second to the last element, pop the last two elements from the tail, then push the result to the tail. If the result is negative, a zero is pushed. | IP++ |
| 8 | JMP |
- | Set IP to N. |
IP = N |
| 9 | JE |
- | If the value of the tail element is zero, set IP to N. Otherwise, skip the operand and continue execution. |
IP = (T == 0) ? N : IP + 2 |
| 10 | YOWL |
A loud sound. | ASCII Output: Pop the tail value and print the corresponding ASCII character. | IP++ |
| 11 | SNIFF |
Detecting a scent. | ASCII Input: Read one character from stdin and push its ASCII code to the tail. |
IP++ |
| 12 | NAP |
A cat's rest. | Sleep: Pop the tail value and pause for that many milliseconds. | IP++ |
| 13 | SCRATCH |
Cleaning territory. | Clear Screen: Clear the output console/screen. | IP++ |
| >=14 | NOP |
- | No operation. | IP++ |
IP: The Instruction Pointer.T: The value of the tail element.N: The value of the next element.E(N): The element indexed by the value of the next element.
