This is a recreational project, so the main goal is having fun, studying language design and exploring various subjects related to it.
Here a few snippets documenting the feature set of the ape programming language.
let age = 1;
let name = "Ape";
let result = 10 * (20 / 2);
let array = [1, 2, 3, 4, 5];
array[0] // => 1
let person = {"name": "John", "age": 25};
person["name"] // => "John"
let sum = fn(a, b) { return a + b; };
sum(1, 2);
let prod = fn(a, b) { a * b; };
prod(1, 2);
let fibonacci = fn(n) {
if (n == 0) {
0
} else {
if (n == 1) {
1
} else {
fibonacci(n - 1) + fibonacci(n - 2);
}
}
};
let twice = fn(f, x) {
return f(f(x));
};
let increment = fn(x) {
return x + 1;
};
twice(increment, 5); // => 7
Currently the lexer, ast, parser and an interpreter are implemented. A full-fledged compiler is currently in the works.
Currently the only editor supporting Ape is the one I am using for developing it. To add support to VSCode for Ape, install the official Ape Lang extension.
This project requires zero external dependencies, except the Go language compiler if you ever want to build it.
go build -o benchmark.out ./benchmark
./benchmark.out
./benchmark.out -engine=eval
As this language is still being actively designed and developed, contribution would not be practical. That said, fixes and improvements are always welcome.