animal

Animal Language

Documentation Status Go Report Card Release

Animal is a programming language that uses animal sounds and characteristics as its core syntax elements. It brings a playful way to programming with a complete feature set of basic commands (and also new ones!).

Quick Start

go install github.com/Klus3kk/animal/cmd/animal@latest
animal
animal path/to/script.anml

Try this simple Animal program:

roar "Hello from the animal kingdom!"

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

roar "Total:", total

Features

Documentation

Complete documentation is available at animal.readthedocs.io.

Core Syntax

Operators

Symbol Animal Word Meaning
+ meow Addition
- woof Subtraction
* moo Multiplication
/ drone Division
% squeak Modulo
^ soar Exponentiation
== sniff Equality
!= growl Inequality

Control Flow

-- Conditionals
if sniff x == 10 {
    roar "x equals 10"
} else {
    roar "x does not equal 10"
}

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

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

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

Installation

Prerequisites

From Source

# Clone the repository
git clone https://github.com/Klus3kk/animal.git
cd animal

# Build from source
go build -o animal ./cmd/animal

# Run the tests
go test ./...

From Go Install

go install github.com/Klus3kk/animal/cmd/animal@latest

Online Compiler

Try Animal without installation using online compiler.

Examples

Simple Calculator

howl calculator() {
    roar "Simple Calculator"
    roar "Enter first number:"
    num1 -> input_number()
    
    roar "Enter second number:"
    num2 -> input_number()
    
    roar "Sum:", num1 meow num2
    roar "Difference:", num1 woof num2
    roar "Product:", num1 moo num2
    roar "Quotient:", num1 drone num2
}

calculator()