Changed to compiler

This commit is contained in:
Bob Polis 2022-08-19 08:46:53 +02:00
parent db255d5cf2
commit 37ef764af7

View File

@ -1,11 +1,3 @@
//
// main.cpp
// curly
//
// Created by Bob Polis at 2020-09-01
// Copyright (c) 2020 SwiftCoder. All rights reserved.
//
#include <iostream> #include <iostream>
#include <cstdlib> #include <cstdlib>
#include <string> #include <string>
@ -15,7 +7,7 @@
#include <getopt.h> #include <getopt.h>
#include <libsclogging.hpp> #include <libsclogging.hpp>
#include "requester.hpp" #include "requester.hpp"
#include "interpreter.hpp" #include "compiler.hpp"
sc::logger logger {"curly", sc::loglevel::info}; sc::logger logger {"curly", sc::loglevel::info};
@ -56,17 +48,15 @@ int main(int argc, char* argv[]) {
throw std::runtime_error("unrecognized option"); throw std::runtime_error("unrecognized option");
} }
} }
interpreter proc; compiler proc;
bool done {false}; bool done {false};
if (optind == argc) { if (optind == argc) {
// here when no file args // here when no file args
std::string base_url {"https://www.swiftcoder.nl/cplus/"}; std::string base_url {"https://www.swiftcoder.nl/cplus/"};
std::string next_url {"start.txt"}; std::string next_url {"start.txt"};
std::string code;
requester req; requester req;
while (!done) { while (!done) {
code = req.get(base_url + next_url); std::istringstream in {req.get(base_url + next_url)};
std::istringstream in {code};
next_url = proc.eval(in, done); next_url = proc.eval(in, done);
SCInfo(logger, next_url); SCInfo(logger, next_url);
} }