๐Ÿพ Cat Programming Language โ€” Official Documentation

The MEOW
Language

A complete, expressive programming language where MEOW is the center of all output. Variables purr. Welcome to the internet's most cat-brained language โ€” now with advanced v2 features.

๐Ÿฑ Cat-Powered โœ… Interpreted โšก Fast ๐Ÿ”ง Full-Featured โœจ v2.1.2 Updated {April, 26} ๐Ÿง‘โ€๐Ÿ’ป GUI Support Added

Introduction

MEOW is a dynamically-typed, interpreted programming language designed entirely around cat behavior and vocabulary. Every keyword, construct, and concept maps to something a cat would do โ€” because all great languages start with a ๐Ÿฑ.

Version 2 adds dictionaries (den), string interpolation (${...}), user input (ask()), file operations, import, and many new built-in functions.

๐Ÿพ Core Philosophy

If a cat would do it, MEOW can express it. Variables purr into existence. Conditions psspss. Loops stalk their prey. Dicts den their secrets. And when something goes wrong? The cat scratches.

Language Features

  • Dynamic typing โ€” No type declarations, just like a cat ignoring rules
  • First-class functions โ€” Define and call with claw
  • Closures โ€” Functions capture their environment (like a cat in a box)
  • Arrays (Litters) โ€” Ordered collections
  • Dictionaries (Dens) โ€” Key-value stores v2
  • String interpolation โ€” Embed expressions with ${...} v2
  • User input โ€” Read from console with ask() v2
  • Import system โ€” Share code across tabs with import v2
  • File operations โ€” read_file() / write_file() v2
  • 25+ built-in functions โ€” Math, strings, arrays, dicts
  • Rich control flow โ€” Conditionals, two loop types, break/continue

Quick Start

Write your first MEOW program. Open the IDE and type:

๐Ÿพ hello.meow
# My first MEOW program
meow "Hello, World! ๐Ÿฑ"

purr name = "Whiskers"
meow "My cat's name is: " + name

purr lives = 9
meow "${name} has ${lives} lives"

Syntax Overview

MEOW has a clean, block-based syntax. Blocks are delimited by { }. There are no semicolons. Comments start with #.

.meow# This is a comment

purr x = 42           # variable declaration
meow x               # print output

psspss (x > 10) {      # if block
  meow "big number: ${x}"
}

File Extension

MEOW source files use the .meow extension. The IDE supports multiple open files and import between them.

Comments

# This is a single-line comment
meow "Hello" # Comments can follow code

Variables

Variables are declared using the purr keyword. Once declared, they can be reassigned without a keyword. MEOW also supports += and ++ / -- shorthand. v2

.meowpurr x = 10
purr name = "Luna"
purr isHungry = pawsitive
purr nothing = nap

# Reassignment
x = 20
x += 5         # x is now 25

# Compound assignment
name = name + " the cat"

meow x
meow name
๐Ÿ“ Variable Scoping

Variables declared inside blocks are scoped to that block. Outer variables are accessible from inner scopes. Reassigning an outer variable from an inner scope mutates it.

Types

MEOW is dynamically typed. There are six value types:

Type MEOW Literal Example Description
Number 42 / 3.14 purr n = 42 Integer or float
String "hello" purr s = "meow" Text in double/single quotes
Boolean pawsitive / clawful purr b = pawsitive True / False
Null nap purr x = nap Absence of value
Array litter [...] purr a = litter [1,2,3] Ordered collection
Dict den {...} purr d = den {"k":v} Key-value store v2

Truthiness

Falsy values: clawful, nap, 0, "". Everything else is truthy.

Type Checking

meow sniff(42)          # โ†’ "number"
meow sniff("hello")     # โ†’ "string"
meow sniff(pawsitive)  # โ†’ "bool"
meow sniff(litter [])  # โ†’ "array"
meow sniff(den {})     # โ†’ "dict"

Operators

Arithmetic

+
Add / Concat
-
Subtract
*
Multiply
/
Divide
%
Modulo
==
Equal
!=
Not Equal
<
Less Than
>
Greater Than
<=
Less / Eq
>=
Greater / Eq
+=
Add-Assign v2

Logical Operators

Operator Meaning Example
and Logical AND (short-circuits) psspss (x > 0 and x < 10)
or Logical OR (short-circuits) psspss (a == 1 or b == 2)
not Logical NOT psspss (not done)

String Concatenation

The + operator concatenates strings. Prefer string interpolation for embedded values โ€” see the Strings section.

meow "Hello " + "World"       # โ†’ "Hello World"
meow "Count: " + 42           # โ†’ "Count: 42"

Operator Precedence

Highest to lowest: not, - (unary), * / %, + -, < > <= >=, == !=, and, or.

Strings & Interpolation v2

Strings are enclosed in double "..." or single '...' quotes. Escape sequences: \n (newline), \t (tab), \\ (backslash).

String Interpolation

Embed any expression directly inside a string using ${expr}. This is the recommended way to compose strings with variable values.

๐Ÿพ interpolation.meow
purr name = "Luna"
purr age  = 3
purr score = 9.5

meow "My cat ${name} is ${age} years old!"
meow "Score: ${score * 10}/100"
meow "Next year she'll be ${age + 1}"
๐Ÿ’ก Interpolation vs. Concatenation

Prefer "Hello ${name}!" over "Hello " + name + "!". Interpolation works inside any double- or single-quoted string and supports full expressions โ€” function calls, arithmetic, comparisons.

String Built-ins

purr s = "Hello, Whiskers!"
meow fur(s)            # โ†’ 16 (length)
meow meow_upper(s)     # โ†’ "HELLO, WHISKERS!"
meow meow_lower(s)     # โ†’ "hello, whiskers!"

purr parts = scratch_split(s, ", ")
meow parts[0]          # โ†’ "Hello"
meow parts[1]          # โ†’ "Whiskers!"

Control Flow

psspss โ€” If Statement

.meowpsspss (condition) {
  # runs if truthy
}

psspss (x > 10) {
  meow "big"
} else {
  meow "small"
}

else if Chaining

๐Ÿพ grades.meow
purr score = 85
psspss (score >= 90) {
  meow "Grade A โ€” Magnificent cat! ๐Ÿ˜ป"
} else psspss (score >= 70) {
  meow "Grade B โ€” Pretty good kitty ๐Ÿ˜ธ"
} else {
  meow "Needs more napping... ๐Ÿ˜พ"
}

Loops

stalk โ€” While Loop

.meowpurr i = 0
stalk (i < 5) {
  meow "Stalking step ${i}"
  i = i + 1
}

pounce โ€” For Range Loop

pounce (i from 1 to 5) {
  meow "Pounce #${i}"
}
๐Ÿ“Œ Range is Inclusive

pounce (i from 1 to 5) iterates with i = 1, 2, 3, 4, 5. Both bounds are included.

scratch โ€” Break  |  knead โ€” Continue

# Print only odd numbers 1โ€“10
pounce (i from 1 to 10) {
  psspss (i % 2 == 0) { knead }
  meow whisker(i)
}

Functions

Functions are defined with claw and return values with paw.

.meowclaw functionName(param1, param2) {
  paw result
}
purr result = functionName(a, b)
๐Ÿพ functions.meow
claw greet(name, title) {
  paw "Hello, ${title} ${name}! ๐Ÿฑ"
}

claw power(base, exp) {
  purr result = 1
  pounce (i from 1 to exp) {
    result = result * base
  }
  paw result
}

meow greet("Whiskers", "Dr.")
meow "2^10 = ${power(2, 10)}"

Recursion

claw fib(n) {
  psspss (n <= 1) { paw n }
  paw fib(n - 1) + fib(n - 2)
}
meow "fib(10) = ${fib(10)}"  # โ†’ 55

Arrays (Litters)

Arrays are created with the litter [...] syntax. Indexed from zero.

.meowpurr cats = litter ["Whiskers", "Luna", "Shadow"]
meow cats[0]   # โ†’ "Whiskers"
meow cats[2]   # โ†’ "Shadow"

Array Operations

Operation Syntax Returns
Length fur(arr) Number of elements
Push (append) chase(arr, value) Modified array
Pop (remove last) pop(arr) Removed element v2
Join nuzzle(arr, sep) Joined string
Slice tail_slice(arr, start, end) New sub-array
Sort (numbers) sort(arr) Sorted copy v2
Reverse reverse(arr) Reversed copy v2
Max / Min max(arr) / min(arr) Largest / smallest v2
๐Ÿพ arrays.meow
purr cats = litter ["Pixel", "Luna", "Biscuit"]
meow "Count: ${fur(cats)}"
chase(cats, "Mochi")
meow "All: ${nuzzle(cats, ", ")}"

purr scores = litter [99, 41, 72, 55]
meow "Sorted: ${nuzzle(sort(scores), " < ")}"
meow "Max: ${max(scores)}  Min: ${min(scores)}"

Dictionaries (Dens) v2

Dictionaries are key-value stores created with the den { ... } syntax. Keys are strings; values can be any type, including nested dicts or arrays.

.meowpurr cat = den {
  "name": "Luna",
  "age":  3,
  "purring": pawsitive
}

# Read a key
meow cat["name"]      # โ†’ "Luna"

# Write / update a key
cat["age"] = 4
meow cat["age"]       # โ†’ 4

Dict Operations

Operation Syntax Returns
Get all keys keys(d) Array of key strings
Get all values values(d) Array of values
Check key exists has(d, key) pawsitive / clawful
Delete a key del_key(d, key) Modified dict
๐Ÿพ dicts.meow
purr cat = den { "name": "Luna", "age": 3, "color": "silver" }
meow "Name: ${cat["name"]}"
cat["age"] = 4
meow "Updated age: ${cat["age"]}"
meow "Has color? ${has(cat, "color")}"
meow "Keys: ${nuzzle(keys(cat), ", ")}"
del_key(cat, "color")
meow "After delete: ${nuzzle(keys(cat), ", ")}"

Nested Dicts

purr zoo = den {
  "cat":  den { "sound": "meow", "legs": 4 },
  "bird": den { "sound": "tweet", "legs": 2 }
}
meow zoo["cat"]["sound"]   # โ†’ "meow"
meow zoo["bird"]["legs"]  # โ†’ 2

User Input v2

The ask(prompt) built-in displays a prompt and returns the user's input as a string. Use paw_num() to convert to a number if needed.

.meowpurr name = ask("What is your cat's name? ")
meow "Hello, ${name}! ๐Ÿฑ"

purr rawAge = ask("Cat's age? ")
purr age    = paw_num(rawAge)
meow "In human years that's ${age * 7}"
๐Ÿพ IDE Behavior

ask() opens a browser prompt dialog in the MEOW IDE. The value is always returned as a string โ€” convert with paw_num() when you need a number.

Import v2

The import "filename" statement runs another open tab's code in the current scope, making its functions and variables available. The .meow extension is optional.

.meow# In utils.meow:
claw square(n) { paw n * n }

# In main.meow:
import "utils"
meow whisker(square(7))   # โ†’ 49
๐Ÿ“Œ Tab Must Be Open

The imported file must exist as an open tab in the IDE. If the tab is not found, MEOW throws a runtime error: Cannot import 'name': file not found.

File Operations v2

MEOW's file built-ins let your program read from and write to IDE tabs as if they were files.

Function Description
read_file(name) Returns the full text content of the named tab as a string
write_file(name, content) Creates or overwrites a tab with the given content
.meow# Write content to a new tab called "log.txt"
purr log = ""
pounce (i from 1 to 5) {
  log = log + "Entry ${i}: item_${i}\n"
}
write_file("log.txt", log)
meow "Written! Open log.txt to see it."

# Read it back
purr content = read_file("log.txt")
meow content
โœ… Use Case

File operations are great for passing data between tabs, storing intermediate results, or simulating persistent storage within an IDE session.

GUI Programming v2.1.2

MEOW v2.1.2 introduces a built-in GUI Engine that allows you to create interactive visual programs. In the MEOW IDE, these programs appear in a floating, draggable overlay.

๐Ÿ›ฐ๏ธ The Floating Overlay

Unlike the text-based console, the GUI Engine provides a Live Preview window. This overlay appears automatically as soon as your script executes any gui_ command.

Layout & Nesting

MEOW uses a "Container Stack" for layouts. By default, elements are added vertically. Use gui_row() and gui_column() to create complex grids.

Function Description
gui_row() Starts a horizontal layout container. All next elements go side-by-side.
gui_column() Starts a vertical layout container (default).
gui_end() Ends the current layout container and returns to the parent.
gui_spacer(px) Adds a gap or flexible space between elements.
# A horizontal toolbar with a spacer pushing buttons apart
gui_row()
  gui_button("Save", "saveFn")
  gui_spacer()
  gui_button("Exit", "exitFn")
gui_end()

Visual Components

Use these built-ins to add interactivity and media to your programs.

Component Function Signature Description
Label gui_label(text) Adds a simple text label.
Button gui_button(text, fnName) Adds a button that triggers a MEOW function.
Input gui_input(hint, varName) Adds a text field that updates a MEOW variable.
Slider gui_slider(min, max, varName) Adds a range slider for numeric variables.
Image gui_image(url, w, h) Renders an image (optional width/height).
Modal gui_show_modal(msg) Shows a blurred glassmorphic overlay.

Interactive State

Callbacks in MEOW are powerful. When a user clicks a gui_button, the IDE executes the named claw function using the environment from the last successful "Run".

๐Ÿพ gui_basics.meow
purr count = 0
claw clk() {
  count = count + 1
  gui_clear()
  gui_label("Clicks: ${count}")
  gui_button("Click Me!", "clk")
}
gui_button("Start Counter", "clk")

Styling Elements

Customize the look of your GUI elements on the fly.

  • gui_set_color(hex) โ€” Sets text color for next elements.
  • gui_set_padding(px) โ€” Sets padding for the active layout container.
  • gui_set_id(id) โ€” Assigns a CSS ID to the very next element created.

All Keywords

purr
Declare a variable
purr x = 42
meow
Print to output
meow "Hello!"
psspss
Conditional if block
psspss (x > 0) { }
else
Else / else-if branch
} else { }
stalk
While loop
stalk (alive) { }
pounce
For range loop
pounce (i from 1 to 5)
from / to
Range bounds in pounce
from 0 to 10
claw
Define a function
claw add(a,b) { }
paw
Return value from function
paw result
litter
Create an array
litter [1, 2, 3]
den
Create a dictionary
den {"key": val}
import
Import another tab's code
import "utils"
pawsitive
Boolean true
purr ok = pawsitive
clawful
Boolean false
purr bad = clawful
nap
Null / no value
purr x = nap
scratch
Break out of a loop
scratch
knead
Continue to next iteration
knead
and / or / not
Logical operators
psspss (a and b)
gui_row
Start horizontal layout
gui_row()
gui_label
Add GUI text
gui_label("txt")
gui_button
Add GUI button
gui_button("t", "fn")

Built-in Functions

MEOW provides 25+ built-in functions, all with cat-themed names. Never need to import โ€” always available.

Core

fur(x)
Length of string or array
whisker(x)
Convert any value to string
paw_num(x)
Convert string to number
sniff(x)
Get type name as string
ask(prompt)
Read a line of user input v2

Arrays

chase(arr, val)
Append value to array
pop(arr)
Remove & return last element v2
nuzzle(arr, sep)
Join array with separator
tail_slice(arr, start, end)
Slice sub-array
sort(arr)
Return numerically sorted copy v2
reverse(arr)
Return reversed copy v2
max(arr)
Largest value in array v2
min(arr)
Smallest value in array v2

Dictionaries v2

keys(d)
Array of all keys in dict
values(d)
Array of all values in dict
has(d, key)
Check if key exists โ†’ boolean
del_key(d, key)
Remove a key from dict

Math

catnap(n)
Random integer 0 to nโˆ’1
kibble(x)
Floor (round down)
treat(x)
Round to nearest integer
claw_up(x)
Ceiling (round up)
pounce_sqrt(x)
Square root
abs(x)
Absolute value v2
pow(base, exp)
Exponentiation v2

Strings

meow_upper(x)
Convert to uppercase
meow_lower(x)
Convert to lowercase
scratch_split(s, delim)
Split string by delimiter

File Operations v2

read_file(name)
Read content of named tab
write_file(name, content)
Write content to named tab

GUI Engine v2.1.2

gui_label(text)
Adds a text label to UI
gui_button(txt, fn)
Adds button calling MEOW fn
gui_input(hint, var)
Adds input field for var
gui_slider(m, M, v)
Adds numeric slider for var
gui_image(url, w, h)
Renders an image from URL
gui_row() / gui_column()
Start a layout container
gui_end()
End current layout container
gui_show_modal(msg)
Show popup message

Math Examples

meow whisker(kibble(3.7))       # โ†’ "3"
meow whisker(treat(3.5))        # โ†’ "4"
meow whisker(pounce_sqrt(16))   # โ†’ "4"
meow whisker(abs(-42))          # โ†’ "42"
meow whisker(pow(2, 8))          # โ†’ "256"
meow whisker(catnap(100))       # โ†’ random 0โ€“99

Grammar (EBNF)

The formal grammar of MEOW v2, in Extended Backus-Naur Form:

program ::= statement*

statement ::= declaration | assignment | idx_assignment | meow_stmt | if_stmt | while_stmt | for_stmt | func_decl | return_stmt | break_stmt | continue_stmt | import_stmt | expr_stmt

declaration ::= "purr" IDENT "=" expr
assignment ::= IDENT ("=" | "+=") expr
idx_assignment ::= IDENT "[" expr "]" "=" expr
meow_stmt ::= "meow" expr
import_stmt ::= "import" STRING

if_stmt ::= "psspss" "(" expr ")" block ("else" (if_stmt | block))?
while_stmt ::= "stalk" "(" expr ")" block
for_stmt ::= "pounce" "(" IDENT "from" expr "to" expr ")" block
func_decl ::= "claw" IDENT "(" params ")" block
return_stmt ::= "paw" expr

block ::= "{" statement* "}"
params ::= (IDENT ("," IDENT)*)?

primary ::= NUMBER | STRING | "pawsitive" | "clawful" | "nap" | IDENT | call_expr | "(" expr ")" | array_lit | dict_lit
array_lit ::= "litter" "[" (expr ("," expr)*)? "]"
dict_lit ::= "den" "{" (expr ":" expr ("," expr ":" expr)*)? "}"

Errors

Error Type When it Occurs Example Message
Syntax Error Invalid code structure Expected ')' but got '+' at line 3
Runtime Error Unknown variable or bad operation Unknown variable: 'x' ๐Ÿ˜ฟ
Division by Zero Dividing by 0 Division by zero!
Index Out of Bounds Array index too large Index 5 out of bounds (length 3)
Infinite Loop Loop exceeds 200,000 iterations Infinite loop detected ๐Ÿ˜พ
Not a Function Calling a non-function 'x' is not a function
Import Not Found Imported tab doesn't exist Cannot import 'name': file not found
Dict Type Error Calling dict builtin on non-dict keys() requires a dict
Null Index Indexing into nap Cannot index nap (null)
๐Ÿพ IDE Debug Mode

Use the โš™ Debug button in the IDE to step through execution trace-by-trace, inspect variable state at each step, and identify exactly where things go wrong.

Example Programs

FizzBuzz

๐Ÿพ fizzbuzz.meow
pounce (i from 1 to 20) {
  psspss (i % 15 == 0) { meow "PurrBuzz ๐Ÿฑ"
  } else psspss (i % 3 == 0) { meow "Purr ๐Ÿพ"
  } else psspss (i % 5 == 0) { meow "Buzz ๐ŸŸ"
  } else { meow whisker(i) }
}

Cat Profile โ€” using Dicts & Interpolation

๐Ÿพ catprofile.meow
purr cat = den {
  "name":  "Luna",
  "age":   3,
  "color": "silver",
  "score": 9.8
}

meow "=== Cat Profile ==="
purr ks = keys(cat)
pounce (i from 0 to fur(ks) - 1) {
  purr k = ks[i]
  meow "  ${k}: ${cat[k]}"
}
cat["age"] = cat["age"] + 1
meow "Happy birthday ${cat["name"]}! Now ${cat["age"]} years old ๐ŸŽ‚"

Bubble Sort

.meowclaw bubbleSort(arr, n) {
  pounce (i from 0 to n - 2) {
    pounce (j from 0 to n - i - 2) {
      psspss (arr[j] > arr[j + 1]) {
        purr tmp = arr[j]
        arr[j] = arr[j + 1]
        arr[j + 1] = tmp
      }
    }
  }
}

purr data = litter [64, 34, 25, 12, 22, 11]
bubbleSort(data, 6)
meow nuzzle(data, " โ†’ ")

Common Patterns

โœ… Pattern: Accumulator

Accumulate into a variable inside a loop:

purr sum = 0
pounce (i from 1 to 100) {
  sum = sum + i
}
meow "Sum 1โ€“100 = ${sum}"  # โ†’ 5050
๐Ÿ—‚๏ธ Pattern: Dict as Record

Use den to group related values, then iterate with keys():

purr stats = den { "wins": 12, "losses": 3, "draws": 5 }
purr ks = keys(stats)
pounce (i from 0 to fur(ks) - 1) {
  purr k = ks[i]
  meow "${k}: ${stats[k]}"
}
๐Ÿ”ฎ Pattern: Modular Code with Import

Split helpers into a separate tab and import them:

# helpers.meow
claw clamp(val, lo, hi) {
  psspss (val < lo) { paw lo }
  psspss (val > hi) { paw hi }
  paw val
}

# main.meow
import "helpers"
meow whisker(clamp(150, 0, 100))  # โ†’ 100
meow whisker(clamp(-5, 0, 100))   # โ†’ 0
๐Ÿ‘ค Advanced GUI: Cat Profile

This layout uses gui_row and gui_slider to build a full character sheet. Try it in the IDE!

purr catName = "Whiskers"
purr health = 85

claw draw() {
  gui_clear()
  gui_row()
    gui_set_color("#FF8C42")
    gui_label("๐Ÿพ CAT PROFILE")
  gui_end()
  gui_image("https://placekitten.com/400/200")
  gui_row()
    gui_label("Name: ")
    gui_input("Name...", "catName")
  gui_end()
  gui_label("Health: ${health}%")
  gui_slider(0, 100, "health")
}
draw()