Page Menu
Home
Xreate
Search
Configure Global Search
Log In
Docs
Questions
Repository
Issues
Patches
Internal API
Files
F5338618
polymorphism-dt.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Nov 21, 7:34 AM
Size
1 KB
Mime Type
text/x-c++
Expires
Mon, Nov 23, 7:34 AM (8 h, 30 m)
Engine
blob
Format
Raw Data
Handle
316660
Attached To
rXR Xreate
polymorphism-dt.cpp
View Options
/* 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
Log In to Comment