meow

module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2026 License: MIT

README

    /\_____/\
   /  o   o  \
  ( ==  ^  == )
   )         (
  (           )
 ( (  )   (  ) )
(__(__)___(__)__)

███╗ ███╗███████╗ ██████╗ ██╗ ██╗ ████╗ ████║██╔════╝██╔═══██╗██║ ██║ ██╔████╔██║█████╗ ██║ ██║██║ █╗ ██║ ██║╚██╔╝██║██╔══╝ ██║ ██║██║███╗██║ ██║ ╚═╝ ██║███████╗╚██████╔╝╚███╔███╔╝ ╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚══╝╚══╝

The purrfect functional programming language 🐱

Build Status Go Reference Go Report Card Go Version License

Contributions Welcome Stars Issues PRs Welcome


Meow is a cat-themed functional programming language that transpiles .nyan files into Go source code. It's a joke language — but one that actually works. Write real programs with cat words, compile them to native binaries, and run them at full speed.

nyan name = "Tama"
meow greet(who) {
  bring "Hello, " + who + "!"
}
nya(greet(name))
$ meow run hello.nyan
Hello, Tama!

Features

  • Cat-themed syntax — Every keyword is a cat word (nyan, meow, sniff, purr, ...)
  • Transpiles to Go — Generates clean, readable Go code
  • Native binaries — Compiled output runs at full Go speed
  • Dynamic typing — All values are boxed via meow.Value interface
  • First-class functions — Lambdas with paw(x) { x * 2 }
  • List operationslick (map), picky (filter), curl (reduce)
  • Pattern matchingpeek expression with ranges and wildcards
  • Pipe operator — Chain operations with |=|
  • Cat error messagesHiss! "x" is not defined, nya~
  • Modern Go internals — Built with iter.Seq, iter.Pull, generics, go:embed

Installation

Homebrew

brew install 135yshr/homebrew-tap/meow

From Source

git clone https://github.com/135yshr/meow.git
cd meow
go install .

Go Install

go install github.com/135yshr/meow@latest

Requires Go 1.26+

Quick Start

Create hello.nyan:

nyan name = "Tama"
nya("Hello, " + name + "!")

Run it:

meow run hello.nyan
# => Hello, Tama!

Or build a binary:

meow build hello.nyan -o hello
./hello

Language Reference

Variables

nyan x = 42
nyan greeting = "Hello!"
nyan pi = 3.14
nyan cats_are_great = yarn      # true
nyan dogs_rule = hairball       # false
nyan nothing = catnap           # nil

Functions

meow add(a, b) {
  bring a + b
}

nya(add(1, 2))   # => 3

Control Flow

# if / else
sniff (x > 0) {
  nya("positive")
} scratch sniff (x == 0) {
  nya("zero")
} scratch {
  nya("negative")
}

# while loop
nyan i = 0
purr (i < 10) {
  nya(i)
  i = i + 1
}

Lambdas

nyan double = paw(x) { x * 2 }
nya(double(5))   # => 10

Lists

nyan nums = [1, 2, 3, 4, 5]

# map
lick(nums, paw(x) { x * 2 })         # => [2, 4, 6, 8, 10]

# filter
picky(nums, paw(x) { x % 2 == 0 })   # => [2, 4]

# reduce
curl(nums, 0, paw(acc, x) { acc + x }) # => 15

Error Handling

meow divide(a, b) {
  sniff (b == 0) { hiss("division by zero") }
  bring a / b
}

# Concise error recovery with ~>
nyan val = divide(10, 0) ~> 0
nya(val)   # => 0

# With a handler function
nyan val2 = divide(10, 0) ~> paw(err) { 42 }
nya(val2)  # => 42

# Verbose style with gag/isFurball
nyan result = gag(paw() { divide(10, 0) })
sniff (isFurball(result)) {
  nya("caught:", result)
} scratch {
  nya("ok:", result)
}
# => caught: Hiss! division by zero

Pattern Matching

nyan result = peek(score) {
  0 => "zero",
  1..10 => "low",
  11..100 => "high",
  _ => "off the charts"
}

Comments

# This is a line comment

-~ This is a
   block comment ~-

Language Cheat Sheet

Full reference: docs/reference.md

Keywords

Meow Meaning Example
nyan Variable declaration nyan x = 42
meow Function definition meow add(a, b) { bring a + b }
bring Return value bring x + 1
sniff If condition sniff (x > 0) { ... }
scratch Else branch } scratch { ... }
purr While loop purr (i < 10) { ... }
paw Lambda (anonymous function) paw(x) { x * 2 }
nya Print nya("Hello!")
lick Map over list lick(nums, paw(x) { x * 2 })
picky Filter list picky(nums, paw(x) { x > 0 })
curl Reduce list curl(nums, 0, paw(a, x) { a + x })
peek Pattern match peek(v) { 0 => "zero", _ => "other" }
hiss Raise error hiss("something went wrong")
gag Catch errors gag(paw() { risky() })
isFurball Check if error isFurball(result)
fetch Import (planned)
flaunt Export (planned)
yarn True (boolean literal) nyan ok = yarn
hairball False (boolean literal) nyan ng = hairball
catnap Nil (empty value) nyan nothing = catnap

Operators

Operator Meaning Example
+ - * / % Arithmetic 1 + 2, 10 % 3
== != Equality x == 0
< > <= >= Comparison x < 10
&& || ! Logical x > 0 && !done
|=| Pipe nums |=| lick(double)
~> Error recovery divide(10, 0) ~> 0
.. Range 1..10
=> Match arm 0 => "zero"
= Assignment nyan x = 1

Literals & Delimiters

Token Meaning
42, 3.14 Integer / Float
"hello" String
( ) { } [ ] Parens / Braces / Brackets
, Separator
# Line comment
-~ ... ~- Block comment

CLI Usage

Meow Language Compiler

Usage:
  meow run <file.nyan>              Run a .nyan file
  meow build <file.nyan> [-o name]  Build a binary
  meow transpile <file.nyan>        Show generated Go code
  meow <file.nyan>                  Shorthand for 'meow run'

Flags:
  --verbose, -v                     Enable debug logging

How It Works

.nyan → [Lexer] → iter.Seq[Token] → [Parser] → AST → [Codegen] → .go → go build → Binary

The compiler pipeline:

  1. Lexer (pkg/lexer) — Tokenizes source using iter.Seq[Token]
  2. Parser (pkg/parser) — Pratt parser with iter.Pull for push-to-pull conversion
  3. Codegen (pkg/codegen) — Transforms AST into Go source code
  4. Compiler (compiler) — Orchestrates the pipeline, runs go build
  5. Runtime (runtime/meowrt) — Provides Value interface, operators, and builtins

Examples

Check the examples/ directory:

File Description
hello.nyan Hello World with functions
fibonacci.nyan Recursive Fibonacci sequence
fizzbuzz.nyan Classic FizzBuzz with sniff/scratch chains
list_ops.nyan lick, picky, curl demo
error_handling.nyan hiss, gag, isFurball, ~> demo

Project Structure

meow/
├── main.go                  # CLI entry point
├── cmd/meow/                # Alternative CLI entry
├── compiler/                # Pipeline orchestration + E2E tests
├── pkg/
│   ├── token/               # Token types, keywords, positions
│   ├── lexer/               # iter.Seq-based tokenizer
│   ├── ast/                 # AST node definitions + tree walker
│   ├── parser/              # Pratt parser (iter.Pull)
│   └── codegen/             # AST → Go source generation
├── runtime/meowrt/          # Runtime: Value, operators, builtins
├── examples/                # Sample .nyan programs
└── testdata/                # Golden file tests

Contributing

Contributions are welcome! Whether it's a bug fix, new feature, or just a better cat pun — we'd love your help.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feat/amazing-feature)
  3. Write tests for your changes
  4. Ensure all tests pass (go test ./...)
  5. Commit your changes
  6. Push to the branch and open a Pull Request

Ideas for Contributions

  • More cat-themed error messages
  • String interpolation ("Hello, {name}!")
  • fetch / flaunt (import/export) for multi-file support
  • REPL mode (meow repl)
  • Syntax highlighting for popular editors
  • Homebrew formula
  • Playground website

Running Tests

# Run all tests
go test ./...

# Run with verbose output
go test ./... -v

# Update golden files
go test ./compiler/ -update

License

This project is licensed under the MIT License — see the LICENSE file for details.


  /\_/\
 ( o.o )  Made with 🐱 and Go
  > ^ <

If this project made you smile, consider giving it a ⭐

Directories

Path Synopsis
cmd
meow command
Command meow provides the CLI for compiling and running .nyan files.
Command meow provides the CLI for compiling and running .nyan files.
Package compiler orchestrates the Meow compilation pipeline: lexing, parsing, code generation, and invoking go build to produce a binary.
Package compiler orchestrates the Meow compilation pipeline: lexing, parsing, code generation, and invoking go build to produce a binary.
pkg
ast
Package ast defines the abstract syntax tree nodes for the Meow language.
Package ast defines the abstract syntax tree nodes for the Meow language.
codegen
Package codegen translates the Meow AST into Go source code.
Package codegen translates the Meow AST into Go source code.
lexer
Package lexer implements the lexical scanner for the Meow language.
Package lexer implements the lexical scanner for the Meow language.
parser
Package parser implements a Pratt (precedence-climbing) recursive descent parser for the Meow language.
Package parser implements a Pratt (precedence-climbing) recursive descent parser for the Meow language.
token
Package token defines the lexical token types, keywords, and source positions used throughout the Meow language compiler.
Package token defines the lexical token types, keywords, and source positions used throughout the Meow language compiler.
runtime
meowrt
Package meowrt provides the runtime support for compiled Meow programs.
Package meowrt provides the runtime support for compiled Meow programs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL