The purrfect programming language.
MeowScript is a small scripting language where purrhaps means if, pawction means function, and every program announces itself with a meow. The interpreter is written in Rust and runs right here, in your browser.
Cat to human
Every keyword is a pun, and every pun means exactly one ordinary thing. This is the whole vocabulary.
| Cat | Human | Looks like |
|---|---|---|
| scratch | declare a variable | scratch lives = 9; |
| amew | change it | amew lives = lives - 1; |
| pawction | function | pawction greet(name) { meow("Hi", name); } |
| tail | return | tail lives * 2; |
| purrhaps / meowtually | if / else | purrhaps hungry { meow("feed me") } meowtually { nap(10) } |
| furrever | loop, with an optional condition | furrever lives > 0 { amew lives = lives - 1; } |
| fur ~ | for each | fur toy ~ toys { meow(toy); } |
| hiss / continue | break / continue | purrhaps tired { hiss; } |
| purrfect / clawful | true / false | scratch asleep = purrfect; |
| mew | null | scratch owner = mew; |
| furreal | typeof | furreal "whiskers" // "whiskers" |
| pawckage | import | pawckage "nya:furrball"; |
| 's | property access | cat's name |
| ~ | is in | "Tom" ~ cats |
| whiskers | a string | "meow" |
| furrball | an array | ["yarn", "box", "sunbeam"] |
Put together, it reads like this:
pawckage "nya:furrball"; scratch cats = ["Tom", "Luna", "Salem"]; pawction introduce(cat) { purrhaps cat == "Salem" { tail cat + " (a witch's familiar)"; } tail cat;} fur cat ~ cats { meow("This is", introduce(cat));} meow("That's", length(cats), "cats, and", "Luna" ~ cats, "that Luna is one of them.");Batteries, in a bag of nya
meow, purr, and length are always there. Everything else is a pawckage away.
- nya:clawtility
Input, timing, objects, and other everyday tools.
length, kibble, nap, now, keys, values, remove, assert, apply
- nya:furrball
Everything for furrballs (arrays).
push, pounce, top, last, bottom, includes, index_of, map, filter, reduce, each, find, range, reverse, sort, join, slice, concat
- nya:whiskers
Everything for whiskers (strings).
in_whiskers, pawrse, replace, split, upper, lower, trim, starts_with, ends_with, includes, index_of, chars, repeat, pad_start, pad_end, reverse, slice
- nya:catculator
Maths. Angles are in radians.
random, round, ceil, floor, trunc, abs, sqrt, sin, cos, tan, log2, log10, ln, exp, pow, modulo, min, max, clamp, PI, TAU, E, INFINITY
- nya:rundamn
Random numbers, choices, and shuffles.
seed, random, uniform, randint, choice, shuffle
- nya:scratchpad
Reading and writing files. Not available in the browser.
read_file, write_file, append_file, exists
Run it on your own machine
The command line build adds a REPL and file access. Prebuilt binaries for Windows, macOS, and Linux are on the download page, or build it with cargo:
cargo install --git https://github.com/AlenVelocity/MeowScript meowscript-cli
meowscript # the REPL
meowscript hello.meow # run a file
meowscript packages # what's in the nya: pawckagesThe full language reference is in the docs.