tesses-webserver-cpp/templater.cpp

37 lines
742 B
C++
Raw Normal View History

2024-09-02 03:19:22 +00:00
#include "tesseswebserver.hpp"
TESSESWEBSERVER_STATIC_DECLARATION
using namespace Tesses::WebServer;
using namespace Tesses::WebServer::ScriptEngine;
2024-09-02 03:21:20 +00:00
2024-09-02 03:19:22 +00:00
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,{});
}