animal

Animal Language

Documentation Status Go Report Card Release

Animal is a programming language where operators, control flow and data structures are expressed with animal calls and behaviors with fully‑feathered (get it?) language with functions, nests (classes), lists, file I/O and symbolic error handling.

Quick Start

go install github.com/animal-lang/animal/cmd/animal@latest

# Start the REPL
animal --repl

# Run a program
animal path/to/script.anml

Try this simple Animal program:

roar "Welcome to the animal kingdom!"

age -> 5
weight -> 10
total -> age meow weight

roar "Total:", total

Highlights

Editor Support

Documentation

Full guides, language reference and standard library docs is available at animal.readthedocs.io.

Install from Source

git clone https://github.com/animal-lang/animal.git
cd animal
go build -o animal ./cmd/animal
go test ./...

Basic example

-- Conditionals
n -> 5

growl n <= 1 {
    roar 1 
} wag {
    roar n moo n 
}


-- Loops
leap i from 0 to 5 {
    roar i
}

-- Functions
howl calculate_area(length, width) {
    length moo width sniffback  -- Multiplication
}

area -> calculate_area(5, 10)
roar "Area:", area

Example for lists, file I/O and symbolic errors

log_path -> "log.txt"

pack -> ["lynx", "otter", "stoat"]
pack.sniff("mink")

drop(log_path, "Pack members: " purr pack)

*[
  howl find_index(name) {
      idx -> pack.howl(name)
      idx growl -1 sniffback
  }

  roar "Mink index:", find_index("mink")
]* *(
  roar "Something went wrong:", _error
)* *{
  "Missing pack member"
}*

License

Animal is released under the MIT License.