partial start of implementation for interpreter

This commit is contained in:
Bob Polis 2020-09-06 12:57:55 +02:00
parent 00d0eac893
commit df283d562d

View File

@ -10,9 +10,11 @@
#include <cstdlib> #include <cstdlib>
#include <string> #include <string>
#include <stdexcept> #include <stdexcept>
#include <sstream>
#include <getopt.h> #include <getopt.h>
#include <libsclogging.hpp> #include <libsclogging.hpp>
#include "requester.hpp" #include "requester.hpp"
#include "interpreter.hpp"
sc::logger logger {"curly", sc::loglevel::info}; sc::logger logger {"curly", sc::loglevel::info};
@ -63,10 +65,14 @@ int main(int argc, const char * argv[]) {
std::cerr << "curly: " << ex.what() << '\n'; std::cerr << "curly: " << ex.what() << '\n';
} }
} }
std::cout << "hello, curly\n";
requester req; requester req;
std::cout << req.get("https://www.swiftcoder.nl/") << '\n'; std::string code {req.get("https://www.swiftcoder.nl/cpp1/start.txt")};
std::cout << req.get("https://www.swiftcoder.nl/moneydance/") << '\n'; std::cerr << code << '\n';
std::istringstream in {code};
interpreter proc;
std::string result {proc.eval(in)};
std::cerr << result << '\n';
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
std::cerr << "curly: " << ex.what() << '\n'; std::cerr << "curly: " << ex.what() << '\n';