polymorphism-dt.cpp
No OneTemporary

File Metadata

Created
Sat, Nov 21, 7:34 AM

polymorphism-dt.cpp

/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*
* polymorphism-dt.cpp
*
* Author: pgess <v.melnychenko@xreate.org>
* Created on 26/02/2020
*/
#include "xreatemanager.h"
#include "ast.h"
#include "pass/compilepass.h"
#include "compilation/targetinterpretation.h"
#include "gtest/gtest.h"
#include "llvmlayer.h"
using namespace xreate;
using namespace xreate::interpretation;
using namespace std;
TEST(PDT, BuildDTTable1){
Attachments::init<I12nFunctionSpec>();
FILE* code = fopen("scripts/dfa/build-table.xreate", "r");
assert(code != nullptr);
auto man = xreate::details::tier2::XreateManager::prepare(code);
CompilePass* compiler = new compilation::CompilePassCustomDecorators<>(man);
TargetInterpretation* targetI12n = new interpretation::TargetInterpretation(man, compiler);
ManagedFnPtr fn = man->root->findFunction("buildTable");
I12nFunctionSpec fnI12nReport;
fnI12nReport.flagPartialInterpretation = true;
fnI12nReport.signature.push_back(INTR_ONLY);
fnI12nReport.signature.push_back(INTR_ONLY);
Attachments::put<I12nFunctionSpec>(fn, fnI12nReport);
PIFnSignature fnSignature;
fnSignature.declaration = fn;
fnSignature.bindings.push_back(Expression());
fnSignature.bindings.push_back(Expression(Atom<Number_t>(1)));
PIFunction* fnI12n = targetI12n->getFunction(move(fnSignature));
llvm::Function* fnRaw = fnI12n->compile();
man->llvm->print();
// man->
// PIFunction
}

Event Timeline