An interpreter to learn
An easy interpreter to learn.
Modern C++ style(Based on C++17)
Support Linux and MacOS
Full comments
Support debug in repl
Higher-order functions supported
Closure supported
...
$ yum install readline-devel.x86_64
$ yum install -y devtoolset-8-toolchain
$ scl enable devtoolset-8 bash$ sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
$ sudo apt-get update -qq
$ sudo apt-get install -qq g++-8
$ apt-get install lib64readline-dev
$ export CXX="g++-8"
$ export CC="gcc-8"$ make$ ./autumn lexer$ ./autumn parser$ DEBUG_AUTUMN=1 ./autumn parser$ ./autumn evalAn example below showing how to write quick sort.
let filter = fn(arr, f) {
let iter = fn(arr, accumulated) {
if (len(arr) == 0) {
accumulated
} else {
let e = if (f(first(arr))) {
push(accumulated, first(arr));
} else {
accumulated
}
iter(rest(arr), e);
}
};
iter(arr, []);
};let quickSort = fn(arr) {
if (len(arr) == 0) {
return arr;
} else {
let head = first(arr);
let smaller = filter(rest(arr), fn(x) { x head });
return quickSort(smaller) + [head] + quickSort(bigger);
}
}let a = [4,5,3,4,6,6]
quickSort(a)Allen.
This project maintained under BSD 2.
QQ Group for Autumn: 985682510 QQ Group for Linuxers: 610441700
No open issues yet, or sync has not completed.