#include "src/tesseswebserver.hpp" TESSESWEBSERVER_STATIC_DECLARATION using namespace Tesses::WebServer; using namespace Tesses::WebServer::ScriptEngine; int main(int argc,char** argv) { RootEnvironment* rEnv = new RootEnvironment(); rEnv->print = [](ScriptType arg)-> void { std::cout << ConvertToString(arg); }; if(argc == 1) { printf("USAGE: %s myscript.twss \n",argv[0]); return 1; } List* ls = new List(); rEnv->SetValue("args",ObjectType(ls)); if(argc > 1) { for(int i = 1;iitems.push_back(std::string(argv[i])); } } BytecodeCompiler bcc(ScriptParser::Parse(argv[1])); bcc.Compile(); auto rf = bcc.file->rootFunction; rf->env = rEnv; rf->isRoot=true; for(auto f : bcc.file->functions) { auto rf2 = f.second; rf2->env = rEnv; rf2->isRoot=false; rEnv->SetValue(f.first,ObjectType(f.second)); } auto res=rf->Execute(rEnv,{}); delete ls; delete rEnv; delete bcc.file; if(std::holds_alternative(res)) { return (int)std::get(res); } return 0; }