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!).
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
nest
structures for custom object definitionshowl
Complete documentation is available at animal.readthedocs.io.
Symbol | Animal Word | Meaning |
---|---|---|
+ |
meow |
Addition |
- |
woof |
Subtraction |
* |
moo |
Multiplication |
/ |
drone |
Division |
% |
squeak |
Modulo |
^ |
soar |
Exponentiation |
== |
sniff |
Equality |
!= |
growl |
Inequality |
-- 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
# 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 ./...
go install github.com/Klus3kk/animal/cmd/animal@latest
Try Animal without installation using online compiler.
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()