yatl is Scheme like lisp interpreter with a user friendly FFI. Any given c++ functor can be bound to the language by one line of code. Consider car
implementation example:
bind_function(m, "car", [&m](lisp_abi::pair& l) { return l.value.head; });
This single line checks that the first parameter of function is non nil
list, returs its head and binds this function to the interpreter. Variadic functions are supported aswell:
bind_function(m, "+", [&m](utility::rest_arguments<std::vector<std::reference_wrapper<lisp_abi::number> > > numbers) {
lisp_abi::number* result = m.alloc<lisp_abi::number>(0.0f);
std::for_each(numbers.args.begin(), numbers.args.end(), [&result](const lisp_abi::number& n) { result->value += n.value; });
return result;
});
Those lines check if arguments are list of numbers and does accumulation using standart libstdcxx functions.
The project is under heavy development, almost nothing is supported. The u-lisp.scm
demo shows that project reached Turing-completeness stage. For more details see: STATUS.md
.
mkdir _build
cd _build
cmake ..
cmake --build .