#include "rigid_paradise/lispy/lispy.hpp"
|
|
#include <iostream>
|
|
|
|
int main() {
|
|
lispy::context ctx;
|
|
ctx.print_parse_results = true;
|
|
ctx.resolve_coords = [](lispy::sp_coords c) -> lispy::lvalue {
|
|
return (int64_t)c.x;
|
|
};
|
|
lispy_math::add_integer_functions(ctx);
|
|
lispy_math::add_floatingp_functions(ctx);
|
|
lispy_math::add_aggregate_functions(ctx);
|
|
lispy::lvalue v = lispy::eval("cat $AA12 @A12:C23 (+ $A1 @B2) (sum (13 1.2 15 1 (+. 16 2.3))) (/. (+ 3 (* 5 6)) 10) \"data \\ ひらがな \n\ttabulated\" \"\" \"test 2 \\x65\"", ctx);
|
|
|
|
lispy::print_types_visitor(std::cout, v, ctx);
|
|
std::cout << std::endl;
|
|
lispy::print_visitor(std::cout, v, ctx);
|
|
std::cout << std::endl;
|
|
v = lispy::eval("sum (1.2)", ctx);
|
|
ctx.print_parse_results = false;
|
|
|
|
std::string data;
|
|
while(std::getline(std::cin, data))
|
|
{
|
|
lispy::print_visitor(
|
|
std::cout,
|
|
lispy::eval(data, ctx),
|
|
ctx
|
|
);
|
|
std::cout << std::endl;
|
|
}
|
|
}
|