tesses-webserver-cpp/templater.cpp

36 lines
741 B
C++

#include "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);
};
BytecodeCompiler bcc(ScriptParser::Parse("file.twss"));
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));
}
rf->Execute(rEnv,{});
}