Lisp: Add source

This commit is contained in:
Riyyi
2023-03-18 23:31:59 +01:00
parent 2904f24565
commit 46e037e39e
11 changed files with 1012 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
#include <cstdio>
#include <iostream> // std::cin
#include <string> // std::getline
#include <string_view>
#if 0
auto read(std::string_view data) -> std::string_view
{
return data;
}
auto eval(std::string_view data) -> std::string_view
{
return data;
}
auto print(std::string_view data) -> void
{
printf("%s\n", data.data());
}
auto rep(std::string_view data) -> void
{
print(eval(read(data)));
}
auto main() -> int
{
while (true) {
printf("user> ");
std::string line;
std::getline(std::cin, line);
// Exit with Ctrl-D
if (std::cin.eof() || std::cin.fail()) {
break;
}
rep(line);
}
return 0;
}
#endif