No OneTemporary

File Metadata

Created
Sat, Mar 14, 4:51 AM
This file is larger than 256 KB, so syntax highlighting was skipped.
diff --git a/config/default.json b/config/default.json
index cb11b3f..7d84629 100644
--- a/config/default.json
+++ b/config/default.json
@@ -1,75 +1,75 @@
{
"containers": {
"id": {
"implementations": "impl_fulfill_cluster",
"clusters": "var_cluster",
"prototypes": "proto_cluster",
"linkedlist": "linkedlist"
},
"impl": {
"solid": "solid",
"onthefly": "on_the_fly"
}
},
"logging": {
"id": "logging"
},
"function-entry": "entry",
"transcend": {
"bindings" : {
"variable": "bind",
"function": "bind_func",
"scope": "bind_scope",
"function_demand" : "bind_function_demand",
"scope_decision": "bind_scope_decision"
},
"context" : {
"decisions":{
"dependent": "resolution_dependency"
}
},
"nonevalue": "nonevalue",
"ret": {
"symbol": "retv",
"tag": "ret"
}
},
"tests": {
- "template": "latex",
+ "template": "virtualization",
"templates": {
"current-fix":"*",
"default": "*-Adhoc.*:Containers.*:Compilation.full_IFStatementWithVariantType:Types.full_VariantType_Switch1:Context.full_LateContext:Context.pathDependentContext:CFA.testLoopContextExists",
"ast": "AST.*",
"effects": "Effects.*",
"basic": "Attachments.*",
"compilation": "Compilation.*-Compilation.full_IFStatementWithVariantType",
"communication": "Communication.*",
"cfa": "CFA.*",
"containers": "Containers.*",
"dfa": "DFA.*",
"diagnostic": "Diagnostic.*",
"dsl": "Association.*:Interpretation.*",
"exploitation": "Exploitation.*",
"ExpressionSerializer": "ExpressionSerializer.*",
"externc": "InterfaceExternC.*",
"loops": "Loop.*",
"latereasoning": "LateReasoning.Syntax1:LateReasoning.Pass_DFAPassDec_1",
"latex": "Latex.Compilation_TransitFn1",
"modules": "Modules.*",
"polymorphs": "Polymorphs.*",
"intrinsic-query": "Types.SlaveTypes*:Association.TypedQuery*",
"types": "Types.*",
- "virtualization": "Virtualization.test2",
+ "virtualization": "Virtualization.*",
"vendorsAPI/clang": "ClangAPI.*",
"vendorsAPI/xml2": "libxml2*"
}
}
}
diff --git a/cpp/src/CMakeLists.txt b/cpp/src/CMakeLists.txt
index 2be602b..f86a842 100644
--- a/cpp/src/CMakeLists.txt
+++ b/cpp/src/CMakeLists.txt
@@ -1,236 +1,236 @@
cmake_minimum_required(VERSION 2.8.11)
project(xreate)
cmake_policy(SET CMP0022 NEW)
message("MODULES" ${CMAKE_MODULE_PATH})
# LLVM
#======================
FIND_PACKAGE (LLVM REQUIRED)
set(LLVM_VERSION ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR})
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
message("LLVM LIB PATH:" ${LLVM_LIBRARY_DIRS})
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
INCLUDE_DIRECTORIES(${LLVM_INCLUDE_DIRS})
message(STATUS "INCLUDE DIR: ${LLVM_INCLUDE_DIRS}")
add_definitions(${LLVM_DEFINITIONS})
message(STATUS "LLVM DEFS: " ${LLVM_DEFINITIONS})
execute_process(
COMMAND llvm-config --libs
OUTPUT_VARIABLE LLVM_LIBS
OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS "LLVM LIBS: " ${LLVM_LIBS})
# CLANG
#======================
set(CLANG_LIBS
clangCodeGen
clangASTMatchers
clangQuery
clangTooling
clangFrontend
clangSerialization
clangDriver
clangParse
clangSema
clangAnalysis
clangAST
clangEdit
clangLex
clangBasic
)
# POTASSCO
#======================
set(POTASSCO_PATH "/opt/potassco/clingo" CACHE PATH "Path to potassco sources")
set(POTASSCO_INCLUDE_PATH
${POTASSCO_PATH}/libgringo
${POTASSCO_PATH}/libclasp
${POTASSCO_PATH}/libclingo
${POTASSCO_PATH}/libprogram_opts
${POTASSCO_PATH}/liblp
)
INCLUDE_DIRECTORIES(${POTASSCO_INCLUDE_PATH})
set(LIBCLASP_LIBS
clingo
clasp
gringo
program_opts
reify
lp
)
message("CLASP LIBS: " ${LIBCLASP_LIBS})
# OTHER DEPENDENCIES
#===========================
set(JEAYESON_INCLUDE_PATH
${CMAKE_HOME_DIRECTORY}/../vendors/jeayeson/include/
)
INCLUDE_DIRECTORIES(${JEAYESON_INCLUDE_PATH})
# COCO
#===========================
set(COCO_EXECUTABLE "" CACHE PATH "Path to coco executable")
set(COCO_FRAMES_PATH "" CACHE PATH "Path to coco frames")
set(COCO_GRAMMAR_PATH ${CMAKE_HOME_DIRECTORY}/../grammar/)
set(COCO_SOURCE_FILES_MAIN
${COCO_GRAMMAR_PATH}/main/Parser.cpp
${COCO_GRAMMAR_PATH}/main/Scanner.cpp
)
set(COCO_SOURCE_FILES_MODULES
${COCO_GRAMMAR_PATH}/modules/Parser.cpp
${COCO_GRAMMAR_PATH}/modules/Scanner.cpp
)
set(COCO_SOURCE_FILES ${COCO_SOURCE_FILES_MODULES} ${COCO_SOURCE_FILES_MAIN})
INCLUDE_DIRECTORIES(${COCO_GRAMMAR_PATH})
add_custom_command(OUTPUT ${COCO_SOURCE_FILES_MAIN}
COMMAND ${COCO_GRAMMAR_PATH}/gen-grammar main ${COCO_EXECUTABLE} ${COCO_FRAMES_PATH}
WORKING_DIRECTORY ${COCO_GRAMMAR_PATH}
MAIN_DEPENDENCY ${COCO_GRAMMAR_PATH}/xreate.ATG
)
add_custom_command(OUTPUT ${COCO_SOURCE_FILES_MODULES}
COMMAND ${COCO_GRAMMAR_PATH}/gen-grammar modules ${COCO_EXECUTABLE} ${COCO_FRAMES_PATH}
WORKING_DIRECTORY ${COCO_GRAMMAR_PATH}
MAIN_DEPENDENCY ${COCO_GRAMMAR_PATH}/modules.ATG
)
message(STATUS "COCO GRAMMAR BUILD STATUS:" ${COCO_OUTPUT})
# XREATE
#======================
set(SOURCE_FILES
+ compilation/interpretation-instructions.cpp
+ ExternLayer.cpp
analysis/cfagraph.cpp
compilation/latereasoning.cpp
analysis/interpretation.cpp
query/latex.cpp
query/polymorph.cpp
compilation/polymorph.cpp
aux/latereasoning.cpp
compilation/latex.cpp
- compilation/interpretation-instructions.cpp
analysis/typeinference.cpp
xreatemanager.cpp
transcendlayer.cpp
analysis/dfagraph.cpp
analysis/DominatorsTreeAnalysisProvider.cpp
llvmlayer.cpp
- ExternLayer.cpp
pass/compilepass.cpp
analysis/utils.cpp
pass/dfapass.cpp
compilation/targetinterpretation.cpp
pass/interpretationpass.cpp
ast.cpp
aux/xreatemanager-decorators.cpp
compilation/operators.cpp
compilation/transformations.cpp
compilation/transformersaturation.cpp
pass/versionspass.cpp
attachments.cpp
compilation/containers.cpp
compilation/advancedinstructions.cpp
utils.cpp
pass/abstractpass.cpp
pass/cfapass.cpp
contextrule.cpp
query/containers.cpp
aux/serialization/expressionserializer.cpp
modules.cpp
)
set(XREATE_INCLUDE_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/
)
INCLUDE_DIRECTORIES(${XREATE_INCLUDE_DIRS})
set(XREATE_PRIVATE_INCLUDE_DIRS
${XREATE_INCLUDE_DIRS}
${COCO_GRAMMAR_PATH}
${JEAYESON_INCLUDE_PATH}
${LLVM_INCLUDE_DIRS}
${POTASSCO_INCLUDE_PATH}
)
add_library(${PROJECT_NAME} SHARED ${COCO_SOURCE_FILES} ${SOURCE_FILES})
target_link_libraries(${PROJECT_NAME})
target_include_directories(${PROJECT_NAME} INTERFACE
${XREATE_INCLUDE_DIRS}
${COCO_GRAMMAR_PATH}
${JEAYESON_INCLUDE_PATH}
${LLVM_INCLUDE_DIRS}
${POTASSCO_INCLUDE_PATH}
)
get_directory_property(DEFINITIONS_ALL DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_DEFINITIONS)
message("definitions all: " ${DEFINITIONS_ALL})
target_compile_definitions(${PROJECT_NAME} INTERFACE ${DEFINITIONS_ALL})
get_directory_property(COMPILATION_OPTIONS_ALL DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_OPTIONS)
message("compilations all: " ${COMPILATION_OPTIONS_ALL})
target_compile_options(${PROJECT_NAME} INTERFACE ${COMPILATION_OPTIONS_ALL})
SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY
INTERFACE_LINK_LIBRARIES ${LIBCLASP_LIBS} ${CLANG_LIBS} ${LLVM_LIBS} tbb boost_system boost_filesystem
)
#${CLANG_LIBS}
#set (LINK_INTERFACE_LIBRARIES "")
# FUNCTION(PREPEND var prefix)
# SET(listVar "")
# FOREACH(f ${ARGN})
# LIST(APPEND listVar "${prefix}/${f}")
# ENDFOREACH(f)
# SET(${var} "${listVar}" PARENT_SCOPE)
# ENDFUNCTION(PREPEND)
#set(COTIRE_UNITY_SOURCE_MAXIMUM_NUMBER_OF_INCLUDES "-j4")
#cotire(xreate)
# MACRO (ADD_PCH_RULE _header_filename _src_list)
# SET(_gch_filename "${_header_filename}.gch")
# LIST(APPEND ${_src_list} ${_gch_filename})
# SET (_args ${CMAKE_CXX_FLAGS})
# LIST(APPEND _args -c ${_header_filename} -o ${_gch_filename})
# GET_DIRECTORY_PROPERTY(DIRINC INCLUDE_DIRECTORIES)
# foreach (_inc ${DIRINC})
# LIST(APPEND _args "-I" ${_inc})
# endforeach(_inc ${DIRINC})
# SEPARATE_ARGUMENTS(_args)
# add_custom_command(OUTPUT ${_gch_filename}
# COMMAND rm -f ${_gch_filename}
# COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} ${_args}
# DEPENDS ${_header_filename})
# ENDMACRO(ADD_PCH_RULE _header_filename _src_list)
# ADD_PCH_RULE (${CMAKE_HOME_DIRECTORY}/src/ast.h SOURCE_FILES)
# ADD_PCH_RULE (${CMAKE_HOME_DIRECTORY}/src/llvmlayer.h SOURCE_FILES)
# ADD_PCH_RULE (${CMAKE_HOME_DIRECTORY}/src/clasplayer.h SOURCE_FILES)
# ADD_PCH_RULE (${CMAKE_HOME_DIRECTORY}/src/pass/abstractpass.h SOURCE_FILES)
diff --git a/cpp/src/ExternLayer.cpp b/cpp/src/ExternLayer.cpp
index 02bdedb..5c39308 100644
--- a/cpp/src/ExternLayer.cpp
+++ b/cpp/src/ExternLayer.cpp
@@ -1,318 +1,315 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* ExternLayer.cpp
*
* Created on: 4/21/15
* Author: pgess <v.melnychenko@xreate.org>
*
* \file ExternLayer.h
* \brief Support of external C code. Wrapper over Clang
*/
#include "ExternLayer.h"
#include "clang/Tooling/Tooling.h"
#include "clang/Frontend/ASTUnit.h"
#include "clang/Frontend/CodeGenOptions.h"
#include "clang/ASTMatchers/ASTMatchers.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Basic/TargetInfo.h"
-#include "clang/Lex/PreprocessorOptions.h"
#include "clang/CodeGen/ModuleBuilder.h"
#include "clang/CodeGen/CodeGenABITypes.h"
#include <llvm/Support/DynamicLibrary.h>
#include <boost/format.hpp>
#include <boost/algorithm/string/join.hpp>
#include <cstdio>
#include <iostream>
+#include <clang/Frontend/CompilerInstance.h>
using namespace std;
using namespace clang;
using namespace clang::driver;
using namespace clang::tooling;
using namespace clang::ast_matchers;
using namespace llvm;
-namespace xreate {
-class FinderCallbackTypeDecl : public MatchFinder::MatchCallback {
-public :
+namespace xreate{
+
+class FinderCallbackTypeDecl : public MatchFinder::MatchCallback{
+public:
QualType typeResult;
- virtual void run(const MatchFinder::MatchResult &Result) {
- if (const TypedefDecl* decl = Result.Nodes.getNodeAs<clang::TypedefDecl>("typename")) {
+ virtual void
+ run(const MatchFinder::MatchResult &Result) {
+ if (const TypedefDecl * decl = Result.Nodes.getNodeAs<clang::TypedefDecl>("typename")) {
typeResult = decl->getUnderlyingType();
}
}
-};
+} ;
-class FinderCallbackFunction : public MatchFinder::MatchCallback {
-public :
+class FinderCallbackFunction : public MatchFinder::MatchCallback{
+public:
QualType typeResult;
- virtual void run(const MatchFinder::MatchResult &Result) {
- if (const FunctionDecl* decl = Result.Nodes.getNodeAs<clang::FunctionDecl>("function")) {
+ virtual void
+ run(const MatchFinder::MatchResult &Result) {
+ if (const FunctionDecl * decl = Result.Nodes.getNodeAs<clang::FunctionDecl>("function")) {
typeResult = decl->getType();
}
}
-};
+} ;
void
-ExternData::addLibrary(Atom<Identifier_t>&& name, Atom<String_t>&& package)
-{
+ExternData::addLibrary(Atom<Identifier_t>&& name, Atom<String_t>&& package) {
__dictLibraries.emplace(name.get(), package.get());
}
void
-ExternData::addIncludeDecl(Expression&& e)
-{
+ExternData::addIncludeDecl(Expression&& e) {
assert(e.op == Operator::LIST_NAMED);
- //TODO ?? implement Expression parsing(Array of Expr as vector<string>);
- for(size_t i=0, size=e.operands.size(); i<size; ++i)
- {
+ //TODO ?? implement Expression parsing(Array of Expr as vector<string>);
+ for(size_t i = 0, size = e.operands.size(); i < size; ++i) {
std::string library = e.bindings.at(i);
assert(__dictLibraries.count(library));
std::string package = __dictLibraries.at(library);
Expression listHeaders = e.operands.at(i);
assert(listHeaders.op == Operator::LIST);
std::vector<std::string> headers;
std::transform(listHeaders.operands.begin(), listHeaders.operands.end(), std::inserter(headers, headers.end()),
- [](const Expression& o){
- assert(o.__state == Expression::STRING);
- return o.getValueString();
- });
+ [](const Expression & o) {
+ assert(o.__state == Expression::STRING);
+ return o.getValueString();
+ });
entries.emplace_back(ExternEntry{package, std::move(headers)});
}
}
void
-ExternLayer::addExternalData(const std::vector<ExternEntry>& data){
+ExternLayer::addExternalData(const std::vector<ExternEntry>& data) {
entries.insert(entries.end(), data.begin(), data.end());
}
ExternLayer::ExternLayer(LLVMLayer *llvm)
- : __llvm(llvm)
-{}
-
+: __llvm(llvm) { }
std::vector<string>
-ExternLayer::fetchPackageFlags(const ExternEntry& entry){
+ExternLayer::fetchPackageFlags(const ExternEntry& entry) {
std::vector<string> args;
FILE* flags = popen((string("pkg-config --cflags ") + entry.package).c_str(), "r");
- size_t linesize=0;
- char* linebuf=0;
- ssize_t linelen=0;
- while ((linelen=getdelim(&linebuf, &linesize, ' ', flags))>0) {
- if (linebuf[0]=='\n') continue;
- if (linelen==1 && linebuf[0]==' ') continue;
-
- //cut unwanted symbols at the end
- char symbLast = linebuf[linelen-1 ];
- if (symbLast == ' ' || symbLast == '\n') linebuf[linelen-1] = 0;
-
- //print header for debug purposes
+ size_t linesize = 0;
+ char* linebuf = 0;
+ ssize_t linelen = 0;
+ while ((linelen = getdelim(&linebuf, &linesize, ' ', flags)) > 0) {
+ if (linebuf[0] == '\n') continue;
+ if (linelen == 1 && linebuf[0] == ' ') continue;
+
+ //cut unwanted symbols at the end
+ char symbLast = linebuf[linelen - 1 ];
+ if (symbLast == ' ' || symbLast == '\n') linebuf[linelen - 1] = 0;
+
+ //print header for debug purposes
llvm::outs() << '<' << linebuf << "> ";
args.push_back(linebuf);
free(linebuf);
linebuf = 0;
}
pclose(flags);
return (args);
}
std::vector<string>
-ExternLayer::fetchPackageLibs(const ExternEntry& entry){
- std::vector<string> libs;
-
- FILE* flags = popen((string("pkg-config --libs ") + entry.package).c_str(), "r");
- size_t linesize=0;
- char* linebuf=0;
- ssize_t linelen=0;
- while ((linelen=getdelim(&linebuf, &linesize, ' ', flags))>0) {
- if (linebuf[0]=='\n') continue;
- if (linelen==1 && linebuf[0]==' ') continue;
-
- //cut unwanted symbols at the end
- char symbLast = linebuf[linelen-1 ];
- if (symbLast == ' ' || symbLast == '\n') linebuf[linelen-1] = 0;
-
- //cut unwanted symbols at the beginning
- if (linelen>1 && linebuf[0] == '-' && linebuf[1] == 'l'){
- libs.push_back(linebuf + 2);
-
- } else {
- libs.push_back(linebuf);
- }
-
- //print lib name for debug purposes
- llvm::outs() << '<' << linebuf << "> ";
- free(linebuf);
- linebuf = 0;
- }
-
- pclose(flags);
- return (libs);
+ExternLayer::fetchPackageLibs(const ExternEntry& entry) {
+ std::vector<string> libs;
+
+ FILE* flags = popen((string("pkg-config --libs ") + entry.package).c_str(), "r");
+ size_t linesize = 0;
+ char* linebuf = 0;
+ ssize_t linelen = 0;
+ while ((linelen = getdelim(&linebuf, &linesize, ' ', flags)) > 0) {
+ if (linebuf[0] == '\n') continue;
+ if (linelen == 1 && linebuf[0] == ' ') continue;
+
+ //cut unwanted symbols at the end
+ char symbLast = linebuf[linelen - 1 ];
+ if (symbLast == ' ' || symbLast == '\n') linebuf[linelen - 1] = 0;
+
+ //cut unwanted symbols at the beginning
+ if (linelen > 1 && linebuf[0] == '-' && linebuf[1] == 'l') {
+ libs.push_back(linebuf + 2);
+
+ } else {
+ libs.push_back(linebuf);
+ }
+
+ //print lib name for debug purposes
+ llvm::outs() << '<' << linebuf << "> ";
+ free(linebuf);
+ linebuf = 0;
+ }
+
+ pclose(flags);
+ return (libs);
}
void
-ExternLayer::loadLibraries(vector<string>&& libs){
- string msgErr;
- for (const string& lib: libs) {
- const string& libName = string("lib")+lib+".so";
- if (!llvm::sys::DynamicLibrary::LoadLibraryPermanently(libName.c_str(), &msgErr)){
- llvm::errs()<<"\n"<<"Loading library "<<lib<<". " <<msgErr<<"\n";
- }
+ExternLayer::loadLibraries(vector<string>&& libs) {
+ string msgErr;
+ for (const string& lib : libs) {
+ const string& libName = string("lib") + lib + ".so";
+ if (!llvm::sys::DynamicLibrary::LoadLibraryPermanently(libName.c_str(), &msgErr)) {
+ llvm::errs() << "\n" << "Loading library " << lib << ". " << msgErr << "\n";
+ }
}
}
void
ExternLayer::init(const AST* root) {
addExternalData(root->__externdata);
- // TODO -EXTERN01.DIP, use default include path from 'clang -xc++ -E'
+ // TODO -EXTERN01.DIP, use default include path from 'clang -xc++ -E'
list<string> code;
std::vector<string> args{
"-I/usr/include"
- ,"-I/usr/local/include"
- ,"-I/usr/lib64/clang/5.0.1/include"
-// ,"-I/usr/lib/gcc/x86_64-linux-gnu/4.9/include"
-// ,"-I/usr/include/x86_64-linux-gnu"
+ , "-I/usr/local/include"
+ , "-I/usr/lib64/clang/5.0.1/include"
+ // ,"-I/usr/lib/gcc/x86_64-linux-gnu/4.9/include"
+ // ,"-I/usr/include/x86_64-linux-gnu"
};
std::vector<string> libs;
boost::format formatInclude("#include \"%1%\"");
- for(const ExternEntry& entry: entries)
- {
- llvm::outs()<<"[ExternC] Processing package: "<< entry.package << "\n";
- llvm::outs()<<"[ExternC] args: ";
+ for(const ExternEntry& entry : entries) {
+ llvm::outs() << "[ExternC] Processing package: " << entry.package << "\n";
+ llvm::outs() << "[ExternC] args: ";
vector<string>&& args2 = fetchPackageFlags(entry);
args.insert(args.end(), args2.begin(), args2.end());
- for(const string arg: args2) {
- llvm::outs()<< "<" << arg << "> ";
+ for(const string arg : args2) {
+ llvm::outs() << "<" << arg << "> ";
}
- llvm::outs()<<"\n[ExternC] libs: ";
+ llvm::outs() << "\n[ExternC] libs: ";
args2 = fetchPackageLibs(entry);
- for(const string arg: args2) {
- llvm::outs()<< "<" << arg << "> ";
+ for(const string arg : args2) {
+ llvm::outs() << "<" << arg << "> ";
}
libs.insert(libs.end(), args2.begin(), args2.end());
- llvm::outs()<<"\n[ExternC] headers: ";
+ llvm::outs() << "\n[ExternC] headers: ";
std::transform(entry.headers.begin(), entry.headers.end(), std::inserter(code, code.begin()),
[&formatInclude](const string header ) {
string line = boost::str(formatInclude % header);
- llvm::outs()<< "<" << line << "> ";
+ llvm::outs() << "<" << line << "> ";
return line;
- });
+ });
llvm::outs() << '\n';
}
loadLibraries(move(libs));
ast = buildASTFromCodeWithArgs(boost::algorithm::join(code, "\n"), args);
__llvm->module->setDataLayout(ast->getASTContext().getTargetInfo().getDataLayout());
+ __clang.reset(new CompilerInstance());
+ __clang->createDiagnostics();
__codegen.reset(CreateLLVMCodeGen(
- ast->getASTContext().getDiagnostics(),
+ __clang->getDiagnostics(),
__llvm->module->getName(),
- HeaderSearchOptions(),
- PreprocessorOptions(),
- CodeGenOptions(),
+ __clang->getHeaderSearchOpts(),
+ __clang->getPreprocessorOpts(),
+ clang::CodeGenOptions(),
__llvm->llvmContext
- ));
-};
-
+ ));
+ __codegen->Initialize(ast->getASTContext());
+};
bool
ExternLayer::isPointer(const clang::QualType &t) {
const clang::Type * tInfo = t.getTypePtr();
assert(tInfo);
return tInfo->isAnyPointerType();
}
llvm::Type*
-ExternLayer::toLLVMType(const clang::QualType& t){
+ExternLayer::toLLVMType(const clang::QualType& t) {
return CodeGen::convertTypeForMemory( __codegen->CGM(), t);
}
std::vector<std::string>
-ExternLayer::getStructFields(const clang::QualType& ty)
-{
+ExternLayer::getStructFields(const clang::QualType& ty) {
clang::QualType t = ty;
- if (isPointer(ty)){
+ if (isPointer(ty)) {
const clang::PointerType* tPtr = ty->getAs<clang::PointerType>();
t = tPtr->getPointeeType();
}
assert(t.getTypePtr()->isRecordType());
const RecordType *record = t->getAsStructureType();
assert(record);
std::vector<std::string> result;
//FieldDecl* field: record->getDecl()->fields()
- for (auto i=record->getDecl()->field_begin(); i!= record->getDecl()->field_end(); ++i){
+ for (auto i = record->getDecl()->field_begin(); i != record->getDecl()->field_end(); ++i) {
result.push_back(i->getName());
}
return result;
}
clang::QualType
-ExternLayer::lookupType(const std::string& id){
+ExternLayer::lookupType(const std::string& id) {
MatchFinder finder;
FinderCallbackTypeDecl callbackTypeDecl;
auto matcherTypeDecl = typedefDecl(hasName(id)).bind("typename");
finder.addMatcher(matcherTypeDecl, &callbackTypeDecl);
finder.matchAST(ast->getASTContext());
assert(! callbackTypeDecl.typeResult.isNull());
return callbackTypeDecl.typeResult;
}
-
llvm::Function*
-ExternLayer::lookupFunction(const std::string& name){
- if (__functions.count(name)){
- return __functions.at(name);
- }
+ExternLayer::lookupFunction(const std::string& name) {
+ if (__functions.count(name)) {
+ return __functions.at(name);
+ }
MatchFinder finder;
FinderCallbackFunction callback;
auto matcher = functionDecl(hasName(name)).bind("function");
finder.addMatcher(matcher, &callback);
finder.matchAST(ast->getASTContext());
- if (callback.typeResult.isNull()){
- cout <<"[External Layer] " << "Unknown function: "<<name << endl;
- assert(false && "Unknown external function");
+ if (callback.typeResult.isNull()) {
+ cout << "[External Layer] " << "Unknown function: " << name << endl;
+ assert(false && "Unknown external function");
}
const QualType& tyFuncQual = callback.typeResult;
llvm::Type *tyRaw = CodeGen::convertTypeForMemory(__codegen->CGM(), tyFuncQual);
llvm::FunctionType* tyRawFunc = llvm::dyn_cast<llvm::FunctionType>(tyRaw);
llvm::Function* function = llvm::Function::Create(
tyRawFunc,
llvm::GlobalValue::ExternalLinkage,
name,
__llvm->module.get());
__functions.emplace(name, function);
return function;
}
}//end of xreate namespace
diff --git a/cpp/src/ExternLayer.h b/cpp/src/ExternLayer.h
index fde7e6a..49fe4b3 100644
--- a/cpp/src/ExternLayer.h
+++ b/cpp/src/ExternLayer.h
@@ -1,63 +1,65 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* ExternLayer.h
*
* Created on: 4/21/15
* Author: pgess <v.melnychenko@xreate.org>
*/
#ifndef XREATE_EXTERNLAYER_H
#define XREATE_EXTERNLAYER_H
#include "llvmlayer.h"
#include <vector>
#include <string>
#include <map>
#include "ast.h"
#include "clang/AST/ASTContext.h"
#include "clang/Frontend/ASTUnit.h"
#include "clang/Frontend/CodeGenOptions.h"
#include "clang/CodeGen/CodeGenABITypes.h"
+#include "clang/Lex/PreprocessorOptions.h"
-namespace clang {
- class CodeGenerator;
+namespace clang{
+class CodeGenerator;
}
-namespace xreate {
- struct ExternData {
- void addLibrary(Atom<Identifier_t>&& name, Atom<String_t>&& package);
- void addIncludeDecl(Expression&& e);
+namespace xreate{
- std::vector<ExternEntry> entries;
- std::map<std::string, std::string> __dictLibraries;
- };
+struct ExternData{
+ void addLibrary(Atom<Identifier_t>&& name, Atom<String_t>&& package);
+ void addIncludeDecl(Expression&& e);
- class ExternLayer {
- public:
- ExternLayer(LLVMLayer* llvm);
+ std::vector<ExternEntry> entries;
+ std::map<std::string, std::string> __dictLibraries;
+};
- llvm::Function* lookupFunction(const std::string& name);
- clang::QualType lookupType(const std::string& id);
- std::vector<std::string> getStructFields(const clang::QualType& ty);
+class ExternLayer{
+public:
+ ExternLayer(LLVMLayer* llvm);
+ void init(const AST* root);
- llvm::Type* toLLVMType(const clang::QualType& t);
- bool isPointer(const clang::QualType& t);
+ llvm::Function* lookupFunction(const std::string& name);
+ clang::QualType lookupType(const std::string& id);
+ std::vector<std::string> getStructFields(const clang::QualType& ty);
+ llvm::Type* toLLVMType(const clang::QualType& t);
+ bool isPointer(const clang::QualType& t);
- void init(const AST* root);
- static std::vector<std::string> fetchPackageFlags(const ExternEntry& entry);
- static std::vector<std::string> fetchPackageLibs(const ExternEntry& entry);
- private:
+ static std::vector<std::string> fetchPackageFlags(const ExternEntry& entry);
+ static std::vector<std::string> fetchPackageLibs(const ExternEntry& entry);
- std::unique_ptr<clang::ASTUnit> ast;
- std::unique_ptr<clang::CodeGenerator> __codegen;
- LLVMLayer* __llvm;
- std::vector<ExternEntry> entries;
- std::map<std::string, llvm::Function*> __functions;
+private:
+ std::unique_ptr<clang::ASTUnit> ast;
+ std::unique_ptr<clang::CodeGenerator> __codegen;
+ std::unique_ptr<clang::CompilerInstance> __clang;
+ LLVMLayer* __llvm;
+ std::vector<ExternEntry> entries;
+ std::map<std::string, llvm::Function*> __functions;
- void addExternalData(const std::vector<ExternEntry>& data);
- void loadLibraries(std::vector<std::string>&& libs);
- };
+ void addExternalData(const std::vector<ExternEntry>& data);
+ void loadLibraries(std::vector<std::string>&& libs);
+};
}
#endif //XREATE_EXTERNLAYER_H
diff --git a/cpp/src/analysis/cfagraph.cpp b/cpp/src/analysis/cfagraph.cpp
index 9d3caa9..df29784 100644
--- a/cpp/src/analysis/cfagraph.cpp
+++ b/cpp/src/analysis/cfagraph.cpp
@@ -1,221 +1,220 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* File: CFAGraph.cpp
* Author: pgess <v.melnychenko@xreate.org>
*
* Created on June 27, 2016, 2:09 PM
*/
/**
* \file cfagraph.h
* \brief Control Flow Analysis(CFA) graph data
*
*/
#include "analysis/cfagraph.h"
#include "analysis/utils.h"
using namespace xreate::cfa;
using namespace std;
void
CFAGraph::print(std::ostringstream& output) const {
const std::string& atomBinding = Config::get("transcend.bindings.function");
const std::string& atomBindingScope = Config::get("transcend.bindings.scope");
output << endl << "%\t\tStatic analysis: CFA" << endl;
output << __outputPrecomputed.str();
//show function tags
int counterTags = 0;
std::ostringstream bufFunctionNames;
boost::format formatFunction("function(%1%).");
boost::format formatBind(atomBinding + "(%1%, %2%).");
for (auto function : this->__nodesFunction.left) {
const auto tags = this->__functionTags.equal_range(function.first);
if (tags.first == tags.second) {
//no tags
bufFunctionNames << "; " << function.second ;
continue;
}
output << formatFunction % (function.second) << std::endl;
for (const auto& tag_ : boost::make_iterator_range(tags)) {
const Expression& tag = tag_.second;
list<string> tagRaw = xreate::analysis::compile(tag);
assert(tagRaw.size() == 1);
output << formatBind
% (function.second)
% (tagRaw.front())
<< endl;
++counterTags;
}
}
if (bufFunctionNames.tellp()) {
output << formatFunction % (bufFunctionNames.str().substr(2)) << std::endl;
}
if (counterTags == 0) {
- output << "%no functtion tags at all" << endl;
+ output << "%no function tags at all" << endl;
}
//declare scopes
boost::format formatScope("scope(0..%1%).");
output << formatScope % (__transcend->getScopesCount() - 1) << std::endl;
//show context rules:
for (auto rule : this->__contextRules) {
output << ContextRule(rule.second).compile(rule.first) << std::endl;
};
//show scope tags:
counterTags = 0;
boost::format formatScopeBind(atomBindingScope + "(%1%, %2%, strong).");
for (auto entry : this->__scopeTags) {
ScopePacked scopeId = entry.first;
const Expression& tag = entry.second;
list<string> tagRaw = xreate::analysis::compile(tag);
assert(tagRaw.size() == 1);
output << formatScopeBind % scopeId % (tagRaw.front()) << endl;
++counterTags;
}
if (counterTags == 0) {
output << "%scope tags: no tags at all" << endl;
}
//parent connections
//TOTEST CFG parent function
boost::format formatFunctionParent("cfa_parent(%1%, function(%2%)).");
for (const auto &relation : this->__parentFunctionRelations) {
const string& function = this->__nodesFunction.left.at(relation.right);
output << formatFunctionParent % relation.left % function << endl;
}
//TOTEST CFG parent scope
boost::format formatScopeParent("cfa_parent(%1%, scope(%2%)).");
for (const auto &relation : this->__parentScopeRelations) {
output << formatScopeParent % relation.first % relation.second << endl;
}
//call connections
boost::format formatCall("cfa_call(%1%, %2%).");
for (const auto &relation : this->__callRelations) {
const ScopePacked scopeFrom = relation.left;
const string& functionTo = this->__nodesFunction.left.at(relation.right);
output << formatCall % (scopeFrom) % (functionTo) << endl;
}
- //function specializations descrtiption
- //SECTIONTAG late-context cfa_function_specializations
+ //function specializations description
boost::format formatSpecializations("cfa_function_specializations(%1%, %2%).");
const list<ManagedFnPtr>& functions = __transcend->ast->getAllFunctions();
for (auto f : functions) {
if (f->guard.isValid()) {
list<string> guardRaw = xreate::analysis::compile(f->guard);
assert(guardRaw.size() == 1);
output << formatSpecializations % (f->getName()) % (guardRaw.front()) << endl;
}
}
//Dependencies
boost::format formatDependencies("cfa_scope_depends(%1%, %2%).");
for(const auto relation : __dependencyRelations) {
output << formatDependencies % relation.first % relation.second << endl;
}
std::multimap<ScopePacked, ScopePacked> __dependencyRelations;
}
void
CFAGraph::addFunctionAnnotations(const std::string& function, const std::map<std::string, Expression>& tags) {
unsigned int fid = registerNodeFunction(function);
for (auto& tag : tags) {
__functionTags.emplace(fid, tag.second);
}
}
void
CFAGraph::addScopeAnnotations(const ScopePacked& scope, const std::vector<Expression>& tags) {
for (Expression tag : tags) {
__scopeTags.emplace(scope, tag);
}
}
void
CFAGraph::addContextRules(const ScopePacked& scope, const std::vector<Expression>& rules) {
for (Expression rule : rules) {
__contextRules.emplace(scope, rule);
}
}
void
CFAGraph::addCallConnection(const ScopePacked& scopeFrom, const std::string& functionTo) {
unsigned int idFuncTo = registerNodeFunction(functionTo);
__callRelations.insert(CALL_RELATIONS::value_type(scopeFrom, idFuncTo));
}
void
CFAGraph::addParentConnection(const ScopePacked& scope, const std::string& functionParent) {
__parentFunctionRelations.insert(PARENT_FUNCTION_RELATIONS::value_type(scope, registerNodeFunction(functionParent)));
}
void
CFAGraph::addParentConnection(const ScopePacked& scope, const ScopePacked& scopeParent) {
__parentScopeRelations.emplace(scope, scopeParent);
}
unsigned int
CFAGraph::registerNodeFunction(const std::string& fname) {
auto pos = __nodesFunction.left.insert(make_pair(__nodesFunction.size(), fname));
return pos.first->first;
}
void
CFAGraph::addDependency(const ScopePacked& scope, const ScopePacked& scopeDependency) {
__dependencyRelations.emplace(scope, scopeDependency);
}
bool
CFAGraph::isDependent(const ScopePacked& scope) const {
return __dependencyRelations.count(scope) > 0;
}
void
CFAGraph::transmitDependencies(const ScopePacked& scopeTo, const ScopePacked& scopeFrom) {
auto range = __dependencyRelations.equal_range(scopeFrom);
std::list<ScopePacked> dependencies;
for (auto pairI = range.first; pairI != range.second; ++pairI) {
dependencies.push_back(pairI->second);
}
for(auto dep : dependencies) {
__dependencyRelations.emplace(scopeTo, dep);
}
}
void
CFAGraph::addScope(CodeScope* scope) {
boost::format formatScopeBinding("ast_scope_binding(%1%, %2%, \"%3%\").");
ScopePacked scopeId = __transcend->pack(scope);
- for (int id, size = scope->__bindings.size(); id < size; ++id) {
+ for (int id=0, size = scope->__bindings.size(); id < size; ++id) {
__outputPrecomputed << formatScopeBinding
% scopeId
% id
% scope->__bindings.at(id)
<< endl;
}
-}
\ No newline at end of file
+}
diff --git a/cpp/src/analysis/typeinference.cpp b/cpp/src/analysis/typeinference.cpp
index 379739c..3583aca 100644
--- a/cpp/src/analysis/typeinference.cpp
+++ b/cpp/src/analysis/typeinference.cpp
@@ -1,79 +1,87 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* typeinference.cpp
*
* Author: pgess <v.melnychenko@xreate.org>
* Created on April 16, 2017, 10:13 AM
*/
/**
* \file typeinference.h
* \brief Type inference analysis
*/
#include "typeinference.h"
#include "llvmlayer.h"
+#include "transcendlayer.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/DerivedTypes.h"
-#include "transcendlayer.h"
using namespace std;
namespace xreate{
namespace typeinference{
//TODO type conversion:
//a) automatically expand types int -> bigger int; int -> floating
//b) detect exact type of `num` based on max used numeral / function type
-//c) warning if need to truncate (allow/dissalow based on annotations)
+//c) warning if need to truncate (allow/dissallow based on annotations)
llvm::Value*
doAutomaticTypeConversion(llvm::Value* source, llvm::Type* tyTarget, llvm::IRBuilder<>& builder) {
if(tyTarget->isIntegerTy() && source->getType()->isIntegerTy()) {
llvm::IntegerType* tyTargetInt = llvm::dyn_cast<llvm::IntegerType>(tyTarget);
llvm::IntegerType* tySourceInt = llvm::dyn_cast<llvm::IntegerType>(source->getType());
if(tyTargetInt->getBitWidth() < tySourceInt->getBitWidth()) {
return builder.CreateCast(llvm::Instruction::Trunc, source, tyTarget);
}
if(tyTargetInt->getBitWidth() > tySourceInt->getBitWidth()) {
return builder.CreateCast(llvm::Instruction::SExt, source, tyTarget);
}
}
if(source->getType()->isIntegerTy() && tyTarget->isFloatingPointTy()) {
return builder.CreateCast(llvm::Instruction::SIToFP, source, tyTarget);
}
+
+ if (source->getType()->isStructTy() && tyTarget->isIntegerTy()){
+ llvm::StructType* sourceST = llvm::cast<llvm::StructType>(source->getType());
+ if(sourceST->getNumElements() == 1) {
+ llvm::Value* sourceElRaw = builder.CreateExtractValue(source, llvm::ArrayRef<unsigned>({0}));
+ return doAutomaticTypeConversion(sourceElRaw, tyTarget, builder);
+ }
+ }
return source;
}
ExpandedType
getType(const Expression& expression, const AST& ast) {
if(expression.type.isValid()) {
return ast.expandType(expression.type);
}
if(expression.__state == Expression::IDENT) {
Symbol s = Attachments::get<IdentifierSymbol>(expression);
return getType(CodeScope::getDefinition(s), ast);
}
if(Attachments::exists<TypeInferred>(expression)) {
return Attachments::get<TypeInferred>(expression);
}
if(expression.__state == Expression::NUMBER) {
return ExpandedType(TypeAnnotation(TypePrimitive::I32));
}
assert(false && "Type can't be determined for an expression");
}
}
} //end of namespace xreate::typeinference
diff --git a/cpp/src/ast.cpp b/cpp/src/ast.cpp
index 8a91699..73dfef3 100644
--- a/cpp/src/ast.cpp
+++ b/cpp/src/ast.cpp
@@ -1,982 +1,977 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Author: pgess <v.melnychenko@xreate.org>
* File: ast.cpp
*/
/**
* \file ast.h
* \brief Syntax Tree and related code
*
* \sa xreate::AST
*/
#include "ast.h"
#include "ExternLayer.h"
#include "analysis/typeinference.h"
#include <stdexcept>
#include <iostream>
//TODO BDecl. forbid multiple body declaration (ExprTyped)
namespace std {
std::size_t
hash<xreate::ScopedSymbol>::operator()(xreate::ScopedSymbol const& s) const {
return s.id ^ (s.version << 2);
}
bool
equal_to<xreate::ScopedSymbol>::operator()(const xreate::ScopedSymbol& __x, const xreate::ScopedSymbol& __y) const {
return __x.id == __y.id && __x.version == __y.version;
}
size_t
hash<xreate::Symbol>::operator()(xreate::Symbol const& s) const {
return hash<xreate::ScopedSymbol>()(s.identifier) ^ ((long int) s.scope << 1);
}
bool
equal_to<xreate::Symbol>::operator()(const xreate::Symbol& __x, const xreate::Symbol& __y) const {
return __x == __y;
};
}
using namespace std;
namespace xreate {
Atom<Identifier_t>::Atom(const std::wstring& value) {
__value = wstring_to_utf8(value);
}
Atom<Identifier_t>::Atom(std::string && name) : __value(name) {
}
const std::string&
Atom<Identifier_t>::get() const {
return __value;
}
Atom<Number_t>::Atom(wchar_t* value) {
//DEBT reconsider number literal recognition
__value = wcstol(value, 0, 10);
}
Atom<Number_t>::Atom(int value)
: __value(value) {
}
double
Atom<Number_t>::get()const {
return __value;
}
Atom<String_t>::Atom(const std::wstring& value) {
assert(value.size() >= 2);
__value = wstring_to_utf8(value.substr(1, value.size() - 2));
}
Atom<String_t>::Atom(std::string && name) : __value(name) {}
const std::string&
Atom<String_t>::get() const {
return __value;
}
class ExpressionHints {
public:
static bool
isStringValueValid(const Expression& e) {
switch (e.__state) {
case Expression::INVALID:
assert(false);
case Expression::IDENT:
case Expression::STRING:
return true;
case Expression::NUMBER:
case Expression::BINDING:
return false;
case Expression::COMPOUND:
{
switch (e.op) {
case Operator::CALL:
return true;
default: return false;
}
}
}
return false;
}
static bool
isDoubleValueValid(const Expression& e) {
switch (e.__state) {
case Expression::NUMBER:
return true;
case Expression::INVALID:
assert(false);
case Expression::IDENT:
case Expression::STRING:
case Expression::BINDING:
return false;
case Expression::COMPOUND: {
switch (e.op) {
case Operator::VARIANT:
return true;
default: return false;
}
}
}
return false;
}
};
class TypesResolver {
private:
const AST* ast;
std::map<std::string, TypeAnnotation> scope;
std::map<TypeAnnotation, int> signatures;
ExpandedType expandType(const TypeAnnotation &t, const std::vector<TypeAnnotation> &args = std::vector<TypeAnnotation>()) {
return TypesResolver(ast, scope, signatures)(t, args);
}
std::vector<TypeAnnotation>
expandOperands(const std::vector<TypeAnnotation>& operands) {
std::vector<TypeAnnotation> pack;
pack.reserve(operands.size());
std::transform(operands.begin(), operands.end(), std::inserter(pack, pack.end()),
[this](const TypeAnnotation & t) {
return expandType(t);
});
return pack;
}
public:
TypesResolver(const AST* root, const std::map<std::string, TypeAnnotation>& scopeOuter = std::map<std::string, TypeAnnotation>(),
std::map<TypeAnnotation, int> signaturesOuter = std::map<TypeAnnotation, int>())
: ast(root), scope(scopeOuter), signatures(signaturesOuter) {
}
ExpandedType
operator()(const TypeAnnotation &t, const std::vector<TypeAnnotation> &args = std::vector<TypeAnnotation>()) {
//assert(args.size() == t.bindings.size()); // invalid number of arguments
for (size_t i = 0; i < args.size(); ++i) {
scope[t.bindings.at(i)] = args.at(i);
}
switch (t.__operator) {
case TypeOperator::LIST:
{
assert(t.__operands.size() == 1);
Expanded<TypeAnnotation> elTy = expandType(t.__operands.at(0));
return ExpandedType(TypeAnnotation(tag_array, elTy, 0));
}
case TypeOperator::LIST_NAMED:
{
std::vector<TypeAnnotation>&& packOperands = expandOperands(t.__operands);
auto typNew = TypeAnnotation(TypeOperator::LIST_NAMED, move(packOperands));
typNew.fields = t.fields;
return ExpandedType(move(typNew));
};
case TypeOperator::VARIANT:
{
std::vector<TypeAnnotation>&& packOperands = expandOperands(t.__operands);
auto typNew = TypeAnnotation(TypeOperator::VARIANT, move(packOperands));
typNew.fields = t.fields;
return ExpandedType(move(typNew));
};
case TypeOperator::CALL:
{
std::string alias = t.__valueCustom;
//find in local scope:
TypeAnnotation ty;
if (scope.count(alias)) {
ty = scope.at(alias);
} else if (ast->__indexTypeAliases.count(alias)) {
ty = ast->__indexTypeAliases.at(alias);
} else {
assert(false && "Undefined or external type");
}
std::vector<TypeAnnotation>&& operands = expandOperands(t.__operands);
TypeAnnotation signature(TypeOperator::CALL, move(operands));
signature.__valueCustom = alias;
if (signatures.count(signature)) {
auto link = TypeAnnotation(TypeOperator::LINK,{});
link.conjuctionId = signatures.at(signature);
return ExpandedType(move(link));
}
int cid = signatures.size();
signatures[signature] = cid;
TypeAnnotation tyResult = expandType(ty, operands);
tyResult.conjuctionId = cid;
return ExpandedType(move(tyResult));
};
case TypeOperator::CUSTOM:
{
if (signatures.count(t)) {
return ExpandedType(TypeAnnotation(TypeOperator::LINK, {t}));
}
signatures.emplace(t, signatures.size());
std::string alias = t.__valueCustom;
//find in local scope:
if (scope.count(alias)) {
return expandType(scope.at(alias));
}
//find in general scope:
if (ast->__indexTypeAliases.count(alias)) {
return expandType(ast->__indexTypeAliases.at(t.__valueCustom));
}
//if type is unknown keep it as is.
return ExpandedType(TypeAnnotation(t));
};
case TypeOperator::ACCESS:
{
std::string alias = t.__valueCustom;
ExpandedType tyAlias = ExpandedType(TypeAnnotation());
//Find in local scope:
if (scope.count(alias)) {
tyAlias = expandType(scope.at(alias));
//Find in global scope:
} else if ((ast->__indexTypeAliases.count(alias))) {
tyAlias = expandType(ast->__indexTypeAliases.at(alias));
} else {
assert(false && "Undefined or external type");
}
assert(tyAlias->__operator == TypeOperator::LIST_NAMED);
for (const string& field : t.fields) {
auto fieldIt = std::find(tyAlias->fields.begin(), tyAlias->fields.end(), field);
assert(fieldIt != tyAlias->fields.end() && "unknown field");
int fieldId = fieldIt - tyAlias->fields.begin();
tyAlias = expandType(tyAlias->__operands.at(fieldId));
}
return tyAlias;
}
case TypeOperator::NONE:
{
return ExpandedType(TypeAnnotation(t));
}
case TypeOperator::SLAVE:
{
return ExpandedType(t);
}
default:
assert(false);
}
assert(false);
return ExpandedType(TypeAnnotation());
}
};
TypeAnnotation::TypeAnnotation()
: __operator(TypeOperator::NONE), __value(TypePrimitive::Invalid) {
}
TypeAnnotation::TypeAnnotation(TypePrimitive typ)
: __value(typ) {
}
TypeAnnotation::TypeAnnotation(TypeOperator op, std::initializer_list<TypeAnnotation> operands)
: __operator(op), __operands(operands) {
}
TypeAnnotation::TypeAnnotation(TypeOperator op, std::vector<TypeAnnotation>&& operands)
: __operator(op), __operands(operands) {
}
TypeAnnotation::TypeAnnotation(llvm_array_tag, TypeAnnotation typ, int size)
: TypeAnnotation(TypeOperator::LIST,{typ}) {
__size = size;
}
bool
TypeAnnotation::isValid() const {
return !(__value == TypePrimitive::Invalid && __operator == TypeOperator::NONE);
}
bool
TypeAnnotation::operator<(const TypeAnnotation& t) const {
if (__operator != t.__operator) return __operator < t.__operator;
if (__operator == TypeOperator::NONE)
return __value < t.__value;
if (__operator == TypeOperator::CALL || __operator == TypeOperator::CUSTOM || __operator == TypeOperator::ACCESS) {
if (__valueCustom != t.__valueCustom)
return __valueCustom < t.__valueCustom;
}
return __operands < t.__operands;
}
/*
TypeAnnotation (struct_tag, std::initializer_list<TypeAnnotation>)
{}
*/
void
TypeAnnotation::addBindings(std::vector<Atom<Identifier_t>>&& params) {
bindings.reserve(bindings.size() + params.size());
std::transform(params.begin(), params.end(), std::inserter(bindings, bindings.end()),
[](const Atom<Identifier_t>& ident) {
return ident.get(); });
}
void
TypeAnnotation::addFields(std::vector<Atom<Identifier_t>>&& listFields) {
fields.reserve(fields.size() + listFields.size());
std::transform(listFields.begin(), listFields.end(), std::inserter(fields, fields.end()),
[](const Atom<Identifier_t>& ident) {
return ident.get(); });
}
unsigned int Expression::nextVacantId = 0;
Expression::Expression(const Atom<Number_t>& number)
: Expression() {
__state = NUMBER;
op = Operator::INVALID;
__valueD = number.get();
}
Expression::Expression(const Atom<String_t>& a)
: Expression() {
__state = STRING;
op = Operator::INVALID;
__valueS = a.get();
}
Expression::Expression(const Atom<Identifier_t> &ident)
: Expression() {
__state = IDENT;
op = Operator::INVALID;
__valueS = ident.get();
}
Expression::Expression(const Operator &oprt, std::initializer_list<Expression> params)
: Expression() {
__state = COMPOUND;
op = oprt;
if (op == Operator::CALL) {
assert(params.size() > 0);
Expression arg = *params.begin();
assert(arg.__state == Expression::IDENT);
__valueS = std::move(arg.__valueS);
operands.insert(operands.end(), params.begin() + 1, params.end());
return;
}
operands.insert(operands.end(), params.begin(), params.end());
}
void
Expression::setOp(Operator oprt) {
op = oprt;
switch (op) {
case Operator::INVALID:
__state = INVALID;
break;
default:
__state = COMPOUND;
break;
}
}
void
Expression::addArg(Expression &&arg) {
operands.push_back(arg);
}
void
Expression::addTags(const std::list<Expression> tags) const {
std::transform(tags.begin(), tags.end(), std::inserter(this->tags, this->tags.end()),
[](const Expression & tag) {
return make_pair(tag.getValueString(), tag);
});
}
void
Expression::addBindings(std::initializer_list<Atom<Identifier_t>> params) {
addBindings(params.begin(), params.end());
}
void
Expression::bindType(TypeAnnotation t) {
type = move(t);
}
void
Expression::addBlock(ManagedScpPtr scope) {
blocks.push_back(scope.operator->());
}
const std::vector<Expression>&
Expression::getOperands() const {
return operands;
}
double
Expression::getValueDouble() const {
return __valueD;
}
const std::string&
Expression::getValueString() const {
return __valueS;
}
void
Expression::setValue(const Atom<Identifier_t>&& v) {
__valueS = v.get();
}
void Expression::setValueDouble(double value) {
__valueD = value;
}
bool
Expression::isValid() const {
return (__state != INVALID);
}
bool
Expression::isDefined() const {
return (__state != BINDING && __state != INVALID);
}
Expression::Expression()
: __state(INVALID), op(Operator::INVALID), id(nextVacantId++) {
}
namespace details { namespace inconsistent {
AST::AST() {
Attachments::init<versions::VariableVersion>();
Attachments::init<IdentifierSymbol>();
Attachments::init<SymbolAlias>();
Attachments::init<TypeInferred>();
}
void
AST::addInterfaceData(const ASTInterface& interface, Expression&& data) {
__interfacesData.emplace(interface, move(data));
}
void
AST::addDFAData(Expression &&data) {
__dfadata.push_back(data);
}
void
AST::addExternData(ExternData &&data) {
__externdata.insert(__externdata.end(), data.entries.begin(), data.entries.end());
}
void
AST::add(Function* f) {
__functions.push_back(f);
__indexFunctions.emplace(f->getName(), __functions.size() - 1);
}
void
AST::add(MetaRuleAbstract *r) {
__rules.push_back(r);
}
void
AST::add(TypeAnnotation t, Atom<Identifier_t> alias) {
if (t.__operator == TypeOperator::VARIANT) {
for (int i = 0, size = t.fields.size(); i < size; ++i) {
__dictVariants.emplace(t.fields[i], make_pair(t, i));
}
}
__indexTypeAliases.emplace(alias.get(), move(t));
}
ManagedScpPtr
AST::add(CodeScope* scope) {
this->__scopes.push_back(scope);
return ManagedScpPtr(this->__scopes.size() - 1, &this->__scopes);
}
std::string
AST::getModuleName() {
const std::string name = "moduleTest";
return name;
}
ManagedPtr<Function>
AST::findFunction(const std::string& name) {
int count = __indexFunctions.count(name);
if (!count) {
return ManagedFnPtr::Invalid();
}
assert(count == 1);
auto range = __indexFunctions.equal_range(name);
return ManagedPtr<Function>(range.first->second, &this->__functions);
}
std::list<ManagedFnPtr>
AST::getAllFunctions() const {
const size_t size = __functions.size();
std::list<ManagedFnPtr> result;
for (size_t i = 0; i < size; ++i) {
result.push_back(ManagedFnPtr(i, &this->__functions));
}
return result;
}
//TASK select default specializations
std::list<ManagedFnPtr>
AST::getFunctionSpecializations(const std::string& fnName) const {
auto functions = __indexFunctions.equal_range(fnName);
std::list<ManagedFnPtr> result;
std::transform(functions.first, functions.second, inserter(result, result.end()),
[this](auto f) {
return ManagedFnPtr(f.second, &this->__functions);
});
return result;
}
template<>
ManagedPtr<Function>
AST::begin<Function>() {
return ManagedPtr<Function>(0, &this->__functions);
}
template<>
ManagedPtr<CodeScope>
AST::begin<CodeScope>() {
return ManagedPtr<CodeScope>(0, &this->__scopes);
}
template<>
ManagedPtr<MetaRuleAbstract>
AST::begin<MetaRuleAbstract>() {
return ManagedPtr<MetaRuleAbstract>(0, &this->__rules);
}
void
AST::recognizeVariantConstructor(Expression& function) {
assert(function.op == Operator::CALL);
std::string variant = function.getValueString();
if (!__dictVariants.count(variant)) {
return;
}
auto record = __dictVariants.at(variant);
const TypeAnnotation& typ = record.first;
function.op = Operator::VARIANT;
function.setValueDouble(record.second);
function.type = typ;
}
Atom<Number_t>
AST::recognizeVariantConstructor(Atom<Identifier_t> ident) {
std::string variant = ident.get();
assert(__dictVariants.count(variant) && "Can't recognize variant constructor");
auto record = __dictVariants.at(variant);
return Atom<Number_t>(record.second);
}
void
AST::postponeIdentifier(CodeScope* scope, const Expression& id) {
bucketUnrecognizedIdentifiers.emplace(scope, id);
}
void
AST::recognizePostponedIdentifiers() {
for (const auto& identifier : bucketUnrecognizedIdentifiers) {
if (!identifier.first->recognizeIdentifier(identifier.second)) {
//exception: Ident not found
std::cout << "Unknown symbol: " << identifier.second.getValueString() << std::endl;
assert(false && "Symbol not found");
}
}
}
xreate::AST*
AST::finalize() {
//all finalization steps:
recognizePostponedIdentifiers();
return reinterpret_cast<xreate::AST*> (this);
}
} } //namespace details::incomplete
Expanded<TypeAnnotation>
AST::findType(const std::string& name) {
// find in general scope:
if (__indexTypeAliases.count(name))
return expandType(__indexTypeAliases.at(name));
//if type is unknown keep it as is.
TypeAnnotation t(TypeOperator::CUSTOM,{});
t.__valueCustom = name;
return ExpandedType(move(t));
}
Expanded<TypeAnnotation>
AST::expandType(const TypeAnnotation &t) const {
return TypesResolver(this)(t);
}
ExpandedType
AST::getType(const Expression& expression) {
return typeinference::getType(expression, *this);
}
Function::Function(const Atom<Identifier_t>& name)
: __entry(new CodeScope(0)) {
__name = name.get();
}
void
Function::addTag(Expression&& tag, const TagModifier mod) {
string name = tag.getValueString();
__tags.emplace(move(name), move(tag));
}
const std::map<std::string, Expression>&
Function::getTags() const {
return __tags;
}
CodeScope*
Function::getEntryScope() const {
return __entry;
}
void
-Function::addBinding(Atom <Identifier_t>&& name, Expression&& argument) {
- __entry->addBinding(move(name), move(argument));
+Function::addBinding(Atom <Identifier_t>&& name, Expression&& argument, const VNameId hintBindingId) {
+ __entry->addBinding(move(name), move(argument), hintBindingId);
}
const std::string&
Function::getName() const {
return __name;
}
ScopedSymbol
-CodeScope::registerIdentifier(const Expression& identifier) {
+CodeScope::registerIdentifier(const Expression& identifier, const VNameId hintBindingId) {
versions::VariableVersion version = Attachments::get<versions::VariableVersion>(identifier, versions::VERSION_NONE);
- auto result = __identifiers.emplace(identifier.getValueString(), __vCounter);
- if (result.second) {
- ++__vCounter;
- return { __vCounter - 1, version };
- }
-
+ auto result = __identifiers.emplace(identifier.getValueString(), hintBindingId? hintBindingId: __identifiers.size() + 1);
return { result.first->second, version };
}
bool
CodeScope::recognizeIdentifier(const Expression& identifier) const {
versions::VariableVersion version = Attachments::get<versions::VariableVersion>(identifier, versions::VERSION_NONE);
const std::string& name = identifier.getValueString();
//search identifier in the current block
if (__identifiers.count(name)) {
VNameId id = __identifiers.at(name);
Symbol s;
s.identifier = ScopedSymbol{id, version};
s.scope = const_cast<CodeScope*> (this);
Attachments::put<IdentifierSymbol>(identifier, s);
return true;
}
//search in the parent scope
if (__parent) {
return __parent->recognizeIdentifier(identifier);
}
return false;
}
ScopedSymbol
CodeScope::getSymbol(const std::string& alias) {
assert(__identifiers.count(alias));
VNameId id = __identifiers.at(alias);
return {id, versions::VERSION_NONE };
}
void
-CodeScope::addBinding(Expression&& var, Expression&& argument) {
+CodeScope::addBinding(Expression&& var, Expression&& argument, const VNameId hintBindingId) {
argument.__state = Expression::BINDING;
__bindings.push_back(var.getValueString());
- ScopedSymbol binding = registerIdentifier(var);
+ ScopedSymbol binding = registerIdentifier(var, hintBindingId);
__declarations[binding] = move(argument);
}
Symbol
CodeScope::addDefinition(Expression&& var, Expression&& body) {
ScopedSymbol s = registerIdentifier(var);
__declarations[s] = move(body);
return Symbol{s, this};
}
CodeScope::CodeScope(CodeScope* parent)
: __parent(parent) {
}
CodeScope::~CodeScope() {
}
void
CodeScope::setBody(const Expression &body) {
assert(__declarations.count(ScopedSymbol::RetSymbol)==0 && "Attempt to reassign scope body");
__declarations[ScopedSymbol::RetSymbol] = body;
}
const Expression&
CodeScope::getBody() const{
return __declarations.at(ScopedSymbol::RetSymbol);
}
const Expression&
CodeScope::getDefinition(const Symbol& symbol, bool flagAllowUndefined){
const CodeScope* self = symbol.scope;
return self->getDefinition(symbol.identifier, flagAllowUndefined);
}
const Expression&
CodeScope::getDefinition(const ScopedSymbol& symbol, bool flagAllowUndefined) const{
static Expression expressionInvalid;
if (!__declarations.count(symbol)){
if (flagAllowUndefined) return expressionInvalid;
assert(false && "Symbol's declaration not found");
}
return __declarations.at(symbol);
}
void
RuleArguments::add(const Atom<Identifier_t> &arg, DomainAnnotation typ) {
emplace_back(arg.get(), typ);
}
void
RuleGuards::add(Expression&& e) {
push_back(e);
}
MetaRuleAbstract::
MetaRuleAbstract(RuleArguments&& args, RuleGuards&& guards)
: __args(std::move(args)), __guards(std::move(guards)) {
}
MetaRuleAbstract::~MetaRuleAbstract() {
}
RuleWarning::
RuleWarning(RuleArguments&& args, RuleGuards&& guards, Expression&& condition, Atom<String_t>&& message)
: MetaRuleAbstract(std::move(args), std::move(guards)), __message(message.get()), __condition(condition) {
}
RuleWarning::~RuleWarning() {
}
void
RuleWarning::compile(TranscendLayer& layer) {
//TODO restore addRuleWarning
//layer.addRuleWarning(*this);
}
bool operator<(const ScopedSymbol& s1, const ScopedSymbol& s2) {
return (s1.id < s2.id) || (s1.id == s2.id && s1.version < s2.version);
}
bool operator==(const ScopedSymbol& s1, const ScopedSymbol& s2) {
return (s1.id == s2.id) && (s1.version == s2.version);
}
bool operator<(const Symbol& s1, const Symbol& s2) {
return (s1.scope < s2.scope) || (s1.scope == s2.scope && s1.identifier < s2.identifier);
}
bool operator==(const Symbol& s1, const Symbol& s2) {
return (s1.scope == s2.scope) && (s1.identifier == s2.identifier);
}
bool operator<(const Expression&a, const Expression&b) {
if (a.__state != b.__state) return a.__state < b.__state;
assert(a.__state != Expression::INVALID);
switch (a.__state) {
case Expression::IDENT:
case Expression::STRING:
return a.getValueString() < b.getValueString();
case Expression::NUMBER:
return a.getValueDouble() < b.getValueDouble();
case Expression::COMPOUND:
{
assert(a.blocks.size() == 0);
assert(b.blocks.size() == 0);
if (a.op != b.op) {
return a.op < b.op;
}
bool flagAValid = ExpressionHints::isStringValueValid(a);
bool flagBValid = ExpressionHints::isStringValueValid(b);
if (flagAValid != flagBValid) {
return flagAValid < flagBValid;
}
if (flagAValid) {
if (a.getValueString() != b.getValueString()) {
return a.getValueString() < b.getValueString();
}
}
flagAValid = ExpressionHints::isDoubleValueValid(a);
flagBValid = ExpressionHints::isDoubleValueValid(b);
if (flagAValid != flagBValid) {
return flagAValid < flagBValid;
}
if (flagAValid) {
if (a.getValueDouble() != b.getValueDouble()) {
return a.getValueDouble() < b.getValueDouble();
}
}
if (a.operands.size() != b.operands.size()) {
return (a.operands.size() < b.operands.size());
}
for (size_t i = 0; i < a.operands.size(); ++i) {
bool result = a.operands[i] < b.operands[i];
if (result) return true;
}
return false;
}
case Expression::BINDING:
case Expression::INVALID:
assert(false);
}
return false;
}
bool
Expression::operator==(const Expression& other) const {
if (this->__state != other.__state) return false;
if (ExpressionHints::isStringValueValid(*this)) {
if (this->__valueS != other.__valueS) return false;
}
if (ExpressionHints::isDoubleValueValid(*this)) {
if (this->__valueD != other.__valueD) return false;
}
if (this->__state != Expression::COMPOUND) {
return true;
}
if (this->op != other.op) {
return false;
}
if (this->operands.size() != other.operands.size()) {
return false;
}
for (size_t i = 0; i<this->operands.size(); ++i) {
if (!(this->operands[i] == other.operands[i])) return false;
}
assert(!this->blocks.size());
assert(!other.blocks.size());
return true;
}
const ScopedSymbol
ScopedSymbol::RetSymbol = ScopedSymbol{0, versions::VERSION_NONE};
} //end of namespace xreate
diff --git a/cpp/src/ast.h b/cpp/src/ast.h
index 7052451..768092f 100644
--- a/cpp/src/ast.h
+++ b/cpp/src/ast.h
@@ -1,741 +1,740 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Author: pgess <v.melnychenko@xreate.org>
* File: ast.h
*/
#ifndef AST_H
#define AST_H
#include "attachments.h"
#include <vector>
#include <stdlib.h>
#include <string>
#include <list>
#include <unordered_map>
#include <unordered_set>
#include <climits>
#include "utils.h"
#include <algorithm>
namespace llvm {
class Value;
}
namespace xreate {
struct ScopedSymbol;
struct Symbol;
}
namespace std {
template<>
struct hash<xreate::ScopedSymbol> {
std::size_t operator()(xreate::ScopedSymbol const& s) const;
};
template<>
struct equal_to<xreate::ScopedSymbol> {
bool operator()(const xreate::ScopedSymbol& __x, const xreate::ScopedSymbol& __y) const;
};
template<>
struct hash<xreate::Symbol> {
size_t operator()(xreate::Symbol const& s) const;
};
template<>
struct equal_to<xreate::Symbol> {
bool operator()(const xreate::Symbol& __x, const xreate::Symbol& __y) const;
};
}
namespace xreate {
struct String_t {
};
struct Identifier_t {
};
struct Number_t {
};
struct Type_t {
};
template<typename A>
class Atom {
};
//DEBT store line:col for all atoms/identifiers
template<> class
Atom<Identifier_t> {
public:
Atom(const std::wstring& value);
Atom(std::string && name);
const std::string& get() const;
private:
std::string __value;
};
template<>
class Atom<Number_t> {
public:
Atom(wchar_t* value);
Atom(int value);
double get()const;
private:
double __value;
};
template<>
class Atom<String_t> {
public:
Atom(const std::wstring& value);
Atom(std::string && name);
const std::string& get() const;
private:
std::string __value;
};
enum class TypePrimitive {
Invalid, Bool, I8, I32, I64, Num, Int, Float, String
};
enum class TypeOperator {
NONE, CALL, CUSTOM, VARIANT, LIST, LIST_NAMED, ACCESS, LINK, SLAVE
};
struct llvm_array_tag {
};
struct struct_tag {
};
const llvm_array_tag tag_array = llvm_array_tag();
const struct_tag tag_struct = struct_tag();
/**
* \brief Represents type to support type system
*
* This class represents type in denormalized form, i.e. without arguments and aliases substitution
* \sa AST::expandType()
*/
class TypeAnnotation {
public:
TypeAnnotation();
TypeAnnotation(const Atom<Type_t>& typ);
TypeAnnotation(TypePrimitive typ);
TypeAnnotation(llvm_array_tag, TypeAnnotation typ, int size);
TypeAnnotation(TypeOperator op, std::initializer_list<TypeAnnotation> operands);
TypeAnnotation(TypeOperator op, std::vector<TypeAnnotation>&& operands);
void addBindings(std::vector<Atom<Identifier_t>>&& params);
void addFields(std::vector<Atom<Identifier_t>>&& listFields);
bool operator<(const TypeAnnotation& t) const;
// TypeAnnotation (struct_tag, std::initializer_list<TypePrimitive>);
bool isValid() const;
TypeOperator __operator = TypeOperator::NONE;
std::vector<TypeAnnotation> __operands;
TypePrimitive __value;
std::string __valueCustom;
int conjuctionId = -1; //conjunction point id (relevant for recursive types)
uint64_t __size = 0;
std::vector<std::string> fields;
std::vector<std::string> bindings;
private:
};
enum class Operator {
INVALID, UNDEF, ADD, SUB, MUL, DIV,
EQU, NE, NEG, LSS,
LSE, GTR, GTE, LIST,
LIST_RANGE, LIST_NAMED,
- CALL, CALL_INTRINSIC,
+ CALL, CALL_INTRINSIC, QUERY, QUERY_LATE,
IMPL/* implication */, MAP,
FOLD, FOLD_INF, INDEX,
IF, SWITCH, SWITCH_VARIANT, SWITCH_LATE,
CASE, CASE_DEFAULT, LOGIC_AND,
CONTEXT_RULE, VARIANT, SEQUENCE
};
class Function;
class AST;
class CodeScope;
class MetaRuleAbstract;
typedef ManagedPtr<Function> ManagedFnPtr;
typedef ManagedPtr<CodeScope> ManagedScpPtr;
typedef ManagedPtr<MetaRuleAbstract> ManagedRulePtr;
const ManagedScpPtr NO_SCOPE = ManagedScpPtr(UINT_MAX, 0);
/**
* \brief Represents every instruction in Xreate's syntax tree
* \attention In case of any changes update xreate::ExpressionHints auxiliary helper as well
*
* Expression is generic building block of syntax tree able to hold node data
* as well as child nodes as operands. Not only instructions use expression for representation in syntax tree
* but annotation as well.
*
* Additionally, `types` as a special kind of annotations use Expression-like data structure TypeAnnotation
* \sa xreate::AST, xreate::TypeAnnotation
*/
//
struct Expression {
friend class CodeScope;
friend class TranscendLayer;
friend class CFAPass;
friend class ExpressionHints;
Expression(const Operator &oprt, std::initializer_list<Expression> params);
Expression(const Atom<Identifier_t>& ident);
Expression(const Atom<Number_t>& number);
Expression(const Atom<String_t>& a);
Expression();
void setOp(Operator oprt);
void addArg(Expression&& arg);
void addBindings(std::initializer_list<Atom<Identifier_t>> params);
void bindType(TypeAnnotation t);
template<class InputIt>
void addBindings(InputIt paramsBegin, InputIt paramsEnd);
void addTags(const std::list<Expression> tags) const;
void addBlock(ManagedScpPtr scope);
const std::vector<Expression>& getOperands() const;
double getValueDouble() const;
void setValueDouble(double value);
const std::string& getValueString() const;
void setValue(const Atom<Identifier_t>&& v);
bool isValid() const;
bool isDefined() const;
bool operator==(const Expression& other) const;
/**
* \brief is it string, number, compound operation and so on
*/
enum {
INVALID, COMPOUND, IDENT, NUMBER, STRING, BINDING
} __state = INVALID;
/**
* \brief Valid for compound State. Holds type of compound operator
*/
Operator op;
/**
* \brief Unique id to identify expression within syntax tree
*/
unsigned int id;
/**
* \brief Exact meaning depends on particular instruction
* \details As an example, named lists/structs hold field names in bindings
*/
std::vector<std::string> bindings;
std::map<std::string, size_t> __indexBindings;
/**
* \brief Holds child instructions as arguments
*/
std::vector<Expression> operands;
/**
* \brief Holds type of instruction's result
*/
TypeAnnotation type;
/**
* \brief Holds additional annotations
*/
mutable std::map<std::string, Expression> tags;
/**
* \brief Child code blocks
* \details For example, If statement holds TRUE-branch as first and FALSE-branch as second block here
*/
std::list<CodeScope*> blocks;
private:
std::string __valueS;
double __valueD;
static unsigned int nextVacantId;
};
bool operator<(const Expression&, const Expression&);
template<class InputIt>
void Expression::addBindings(InputIt paramsBegin, InputIt paramsEnd) {
size_t index = bindings.size();
std::transform(paramsBegin, paramsEnd, std::inserter(bindings, bindings.end()),
[&index, this] (const Atom<Identifier_t> atom) {
std::string key = atom.get();
this->__indexBindings[key] = index++;
return key;
});
}
typedef std::list<Expression> ExpressionList;
enum class TagModifier {
NONE, ASSERT, REQUIRE
};
enum class DomainAnnotation {
FUNCTION, VARIABLE
};
class RuleArguments : public std::vector<std::pair<std::string, DomainAnnotation>>
{
public:
void add(const Atom<Identifier_t>& name, DomainAnnotation typ);
};
class RuleGuards : public std::vector<Expression> {
public:
void add(Expression&& e);
};
class TranscendLayer;
class LLVMLayer;
class MetaRuleAbstract {
public:
MetaRuleAbstract(RuleArguments&& args, RuleGuards&& guards);
virtual ~MetaRuleAbstract();
virtual void compile(TranscendLayer& layer) = 0;
protected:
RuleArguments __args;
RuleGuards __guards;
};
class RuleWarning : public MetaRuleAbstract {
friend class TranscendLayer;
public:
RuleWarning(RuleArguments&& args, RuleGuards&& guards, Expression&& condition, Atom<String_t>&& message);
virtual void compile(TranscendLayer& layer);
~RuleWarning();
private:
std::string __message;
Expression __condition;
};
typedef unsigned int VNameId;
namespace versions {
typedef int VariableVersion;
const VariableVersion VERSION_NONE = -2;
const VariableVersion VERSION_INIT = 0;
}
template<>
struct AttachmentsDict<versions::VariableVersion> {
typedef versions::VariableVersion Data;
static const unsigned int key = 6;
};
struct ScopedSymbol {
VNameId id;
versions::VariableVersion version;
static const ScopedSymbol RetSymbol;
};
struct Symbol {
ScopedSymbol identifier;
const CodeScope * scope;
};
struct IdentifierSymbol{};
struct SymbolAlias{};
template<>
struct AttachmentsDict<IdentifierSymbol> {
typedef Symbol Data;
static const unsigned int key = 7;
};
template<>
struct AttachmentsDict<SymbolAlias> {
typedef Symbol Data;
static const unsigned int key = 9;
};
typedef std::pair<Expression, TagModifier> Tag;
bool operator<(const ScopedSymbol& s1, const ScopedSymbol& s2);
bool operator==(const ScopedSymbol& s1, const ScopedSymbol& s2);
bool operator<(const Symbol& s1, const Symbol& s2);
bool operator==(const Symbol& s1, const Symbol& s2);
/**
* \brief Represents code block and single scope of visibility
*
* Holds single expression as a *body* and set of variable assignments(declarations) used in body's expression
* \sa xreate::AST
*/
class CodeScope {
friend class Function;
friend class PassManager;
public:
CodeScope(CodeScope* parent = 0);
~CodeScope();
/** \brief Set expression as a body */
void setBody(const Expression& body);
/** \brief Returns current code scope body */
const Expression& getBody() const;
/** \brief Adds variable definition to be used in body as well as in other declarations */
Symbol addDefinition(Expression&& var, Expression&& body);
/** \brief Returns symbols' definition */
static const Expression& getDefinition(const Symbol& symbol, bool flagAllowUndefined = false);
const Expression& getDefinition(const ScopedSymbol& symbol, bool flagAllowUndefined = false) const;
/** \brief Adds variable defined elsewhere */
- void addBinding(Expression&& var, Expression&& argument);
+ void addBinding(Expression&& var, Expression&& argument, const VNameId hintBindingId = 0);
std::vector<std::string> __bindings;
std::map<std::string, VNameId> __identifiers;
CodeScope* __parent;
//TODO move __definitions to SymbolsAttachments data
//NOTE: definition of return type has index 0
std::unordered_map<ScopedSymbol, Expression> __declarations;
std::vector<Expression> tags;
std::vector<Expression> contextRules;
private:
- VNameId __vCounter = 1;
- ScopedSymbol registerIdentifier(const Expression& identifier);
+ ScopedSymbol registerIdentifier(const Expression& identifier, const VNameId hintBindingId = 0);
public:
bool recognizeIdentifier(const Expression& identifier) const;
ScopedSymbol getSymbol(const std::string& alias);
};
/**
* \brief Represents single function in Xreate's syntax tree
*
* Holds an entry code scope and `guardContext` required for function to operate
* \sa xreate::AST
*/
class Function {
friend class Expression;
friend class CodeScope;
friend class AST;
public:
Function(const Atom<Identifier_t>& name);
/**
* \brief Adds function arguments
*/
- void addBinding(Atom <Identifier_t>&& name, Expression&& argument);
+ void addBinding(Atom <Identifier_t>&& name, Expression&& argument, const VNameId hintBindingId=0);
/**
* \brief Adds additional function annotations
*/
void addTag(Expression&& tag, const TagModifier mod);
const std::string& getName() const;
const std::map<std::string, Expression>& getTags() const;
CodeScope* getEntryScope() const;
CodeScope* __entry;
std::string __name;
bool isPrefunction = false; //SECTIONTAG adhoc Function::isPrefunction flag
Expression guard;
private:
std::map<std::string, Expression> __tags;
};
class ExternData;
struct ExternEntry {
std::string package;
std::vector<std::string> headers;
};
typedef Expanded<TypeAnnotation> ExpandedType;
struct TypeInferred{};
template<>
struct AttachmentsDict<TypeInferred> {
typedef ExpandedType Data;
static const unsigned int key = 11;
};
enum ASTInterface {
CFA, DFA, Extern, Adhoc
};
struct FunctionSpecialization {
std::string guard;
size_t id;
};
struct FunctionSpecializationQuery {
std::unordered_set<std::string> context;
};
template<>
struct AttachmentsId<Expression>{
static unsigned int getId(const Expression& expression){
return expression.id;
}
};
template<>
struct AttachmentsId<Symbol>{
static unsigned int getId(const Symbol& s){
return s.scope->__declarations.at(s.identifier).id;
}
};
template<>
struct AttachmentsId<ManagedFnPtr>{
static unsigned int getId(const ManagedFnPtr& f){
const Symbol symbolFunction{ScopedSymbol::RetSymbol, f->getEntryScope()};
return AttachmentsId<Symbol>::getId(symbolFunction);
}
};
template<>
struct AttachmentsId<CodeScope*>{
static unsigned int getId(const CodeScope* scope){
const Symbol symbolScope{ScopedSymbol::RetSymbol, scope};
return AttachmentsId<Symbol>::getId(symbolScope);
}
};
template<>
struct AttachmentsId<unsigned int>{
static unsigned int getId(const unsigned int id){
return id;
}
};
class TypesResolver;
namespace details { namespace inconsistent {
/**
* \brief Syntax tree under construction in inconsistent form
*
* Represents Syntax Tree under construction(**inconsistent state**).
* \attention Clients should use rather xreate::AST unless client's code explicitly works with Syntax Tree during construction.
*
* Typically instance only created by xreate::XreateManager and filled in by Parser
* \sa xreate::XreateManager::prepare(std::string&&)
*/
class AST {
friend class xreate::TypesResolver;
public:
AST();
/**
* \brief Adds new function to AST
* \param f Function to register
*/
void add(Function* f);
/**
* \brief Adds new declarative rule to AST
* \param r Declarative Rule
*/
void add(MetaRuleAbstract* r);
/** \brief Registers new code block */
ManagedScpPtr add(CodeScope* scope);
/**
* \brief Add new type to AST
* @param t Type definition
* @param alias Typer name
*/
void add(TypeAnnotation t, Atom<Identifier_t> alias);
/** \brief Current module's name */
std::string getModuleName();
/**
* \brief Looks for function with given name
* \param name Function name to find
* \note Requires that only one function exists under given name
* \return Found function
*/
ManagedPtr<Function> findFunction(const std::string& name);
/** \brief Returns all function in AST */
std::list<ManagedFnPtr> getAllFunctions() const;
/**
* \brief Returns all specializations of a function with a given name
* \param fnName function to find
* \return list of found function specializations
*/
std::list<ManagedFnPtr> getFunctionSpecializations(const std::string& fnName) const;
/**
* \return First element in Functions/Scopes/Rules list depending on template parameter
* \tparam Target either Function or CodeScope or MetaRuleAbstract
*/
template<class Target>
ManagedPtr<Target> begin();
/**
* \brief Performs all necessary steps after AST is built
*
* Performs all finzalisation steps and move AST into consistent state represented by xreate::AST
* \sa xreate::AST
* \return AST in consistent state
*/
xreate::AST* finalize();
typedef std::multimap<std::string, unsigned int> FUNCTIONS_REGISTRY;
std::vector<ExternEntry> __externdata;
std::list<Expression> __dfadata; //TODO move to more appropriate place
std::list<std::string> __rawImports; //TODO move to more appropriate place
std::multimap<ASTInterface, Expression> __interfacesData; //TODO CFA data here.
private:
std::vector<MetaRuleAbstract*> __rules;
std::vector<Function*> __functions;
std::vector<CodeScope*> __scopes;
FUNCTIONS_REGISTRY __indexFunctions;
protected:
std::map<std::string, TypeAnnotation> __indexTypeAliases;
public:
/**
* \brief Stores DFA scheme for later use by DFA Pass
*
* Treats expression as a DFA scheme and feeds to a DFA Pass later
* \paramn Expression DFA Scheme
* \sa xreate::DFAPass
*/
void addDFAData(Expression&& data);
/** \brief Stores data for later use by xreate::ExternLayer */
void addExternData(ExternData&& data);
/**
* \brief Generalized function to store particular data for later use by particular pass
* \param interface Particular Interface
* \param data Particular data
*/
void addInterfaceData(const ASTInterface& interface, Expression&& data);
/**\name Symbols Recognition */
///@{
public:
//TODO revisit enums/variants, move to codescope
/**
* \brief Tries to find out whether expression is Variant constructor
*/
void recognizeVariantConstructor(Expression& function);
Atom<Number_t> recognizeVariantConstructor(Atom<Identifier_t> ident);
private:
std::map<std::string, std::pair<TypeAnnotation, int>> __dictVariants;
public:
std::set<std::pair<CodeScope*, Expression>> bucketUnrecognizedIdentifiers;
public:
/**
* \brief Postpones unrecognized identifier for future second round of recognition
* \param scope Code block identifier is encountered
* \param id Identifier
*/
void postponeIdentifier(CodeScope* scope, const Expression& id);
/** \brief Second round of identifiers recognition done right after AST is fully constructed */
void recognizePostponedIdentifiers();
///@}
};
template<>
ManagedPtr<Function>
AST::begin<Function>();
template<>
ManagedPtr<CodeScope>
AST::begin<CodeScope>();
template<>
ManagedPtr<MetaRuleAbstract>
AST::begin<MetaRuleAbstract>();
} } // namespace details::incomplete
/**
* \brief Xreate's Syntax Tree in consistent state
*
* Syntax Tree has two mutually exclusive possible states:
* - inconsistent state while AST is under construction. Represented by xreate::details::inconsistent::AST
* - consistent state when AST is built and finalize() is done.
*
* This class represents consistent state and should be used everywhere unless client's code explicitly works with AST under construction.
* Consistent AST enables access to additional functions(currently related to type management).
* \sa xreate::details::inconsistent::AST
*/
class AST : public details::inconsistent::AST {
public:
AST() : details::inconsistent::AST() {}
/**
* \brief Computes fully expanded form of type by substituting all arguments and aliases
* \param t Type to expand
* \return Expdanded or normal form of type
* \sa TypeAnnotation
*/
ExpandedType expandType(const TypeAnnotation &t) const;
/**
* Searches type by given name
* \param name Typename to search
* \return Expanded or normal form of desired type
* \note if type name is not found returns new undefined type with this name
*/
ExpandedType findType(const std::string& name);
/**
* Invokes Type Inference Analysis to find out expanded(normal) form expressions's type
* \sa typeinference.h
* \param expression
* \return Type of expression
*/
ExpandedType getType(const Expression& expression);
};
}
#endif // AST_H
diff --git a/cpp/src/compilation/interpretation-instructions.cpp b/cpp/src/compilation/interpretation-instructions.cpp
index 4b0da50..7c4845f 100644
--- a/cpp/src/compilation/interpretation-instructions.cpp
+++ b/cpp/src/compilation/interpretation-instructions.cpp
@@ -1,61 +1,116 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/*
* Author: pgess <v.melnychenko@xreate.org>
* Created on June 15, 2018, 5:32 PM
*
*/
#include "compilation/interpretation-instructions.h"
#include "analysis/interpretation.h"
#include "transcendlayer.h"
#include "targets.h"
+#include "aux/latereasoning.h"
+#include "latereasoning.h"
+#include "aux/transcend-decorators.h"
+#include "compilation/targetinterpretation.h"
using namespace std;
+using namespace xreate::latereasoning;
namespace xreate{
namespace interpretation{
Expression
IntrinsicQueryInstruction::process(const Expression& expression) {
- AST* ast = static_cast<TargetInterpretation*> (__scope->function->man)->ast;
- TranscendLayer* transcend = static_cast<TargetInterpretation*> (__scope->function->man)->pass->man->transcend;
- InterpretationFunction* function = static_cast<InterpretationFunction*> (__scope->function);
+ AST* ast = static_cast<TargetInterpretation*> (__fnI12n->man)->ast;
+ TranscendLayer* transcend = static_cast<TargetInterpretation*> (__fnI12n->man)->pass->man->transcend;
- ExpandedType targetT = ast->expandType(expression.type);
+ ExpandedType targetT = ast->getType(expression);
assert(expression.operands.size() == 1);
assert(expression.operands.front().__state == Expression::STRING);
assert(targetT->__operator == TypeOperator::LIST);
std::string namePredicate = expression.operands.front().getValueString();
- StaticModel model = (static_cast<TargetInterpretation*> (function->man))->pass->man->transcend->query(namePredicate);
+ StaticModel model = (static_cast<TargetInterpretation*> (__fnI12n->man))->pass->man->transcend->query(namePredicate);
Expression result(Operator::LIST,{});
result.operands.reserve(model.size());
ExpandedType elementT = targetT->__operands.at(0).__operator == TypeOperator::SLAVE
- ? dereferenceSlaveType(ExpandedType(targetT->__operands.at(0)), transcend)
- : ExpandedType(targetT->__operands.at(0));
+ ? dereferenceSlaveType(ExpandedType(targetT->__operands.at(0)), transcend)
+ : ExpandedType(targetT->__operands.at(0));
if(model.size()) {
if (elementT->__operator == TypeOperator::LIST_NAMED) {
//edge case, content's type is LIST_NAMED:
for(const auto& row : model) {
result.operands.push_back(representTransExpression(row.second, elementT, transcend));
}
} else {
for (const auto& row : model) {
assert(row.second.args().size);
result.operands.push_back(representTransExpression(row.second.args()[0], elementT, transcend));
}
}
}
return result;
}
+
+llvm::Value*
+IntrinsicQueryInstruction::processLate(const Expression& expression, const compilation::Context& context) {
+ assert(expression.blocks.size());
+ CodeScope* body = expression.blocks.front();
+ PassManager* man = static_cast<TargetInterpretation*> (__fnI12n->man)->pass->man;
+ compilation::ICodeScopeUnit* bodyBrute = context.function->getScopeUnit(body);
+
+ llvm::Type* instructionT = man->llvm->toLLVMType(man->root->getType(expression));
+ Expression atomNameE = __fnI12n->getScope(context.scope->scope)->process(expression.operands.front());
+ assert(atomNameE.__state == Expression::STRING);
+ string atomName = atomNameE.getValueString();
+ std::string argName = expression.bindings.front();
+ ExpandedType argT = man->root->getType(body->getDefinition(body->getSymbol(argName)));
+ if (argT->__operator == TypeOperator::SLAVE){
+ argT = dereferenceSlaveType(argT, man->transcend);
+ }
+
+ auto transcend =
+ Decorators<LateReasoningTranscendDecoratorTag>::getInterface(man->transcend);
+ LateReasoningCompiler* compiler =
+ new latereasoning::LateReasoningCompiler(__fnI12n, context);
+ SymbolPacked targetSP = transcend->pack(Attachments::get<SymbolAlias>(expression));
+
+ LateAnnotationsGroup feedbackAG = transcend->queryLate(atomName);
+ for(const auto& feedback : feedbackAG.annotations) {
+ SymbolPacked targetExpectedSP = ParseImplAtom<SymbolPacked>::get(feedback.first);
+ if (targetExpectedSP == targetSP) {
+ const LateAnnotation& annotation = feedback.second;
+ return compiler->compileAutoExpand(annotation, instructionT, "",
+ [transcend, &argT, this, body, bodyBrute, &argName](const Gringo::Symbol & atomRaw) {
+ InterpretationScope* bodyI12n = __fnI12n->getScope(body);
+ Expression argValue;
+ if (argT->__operator == TypeOperator::LIST_NAMED) {
+ argValue = representTransExpression(atomRaw, argT, transcend);
+ } else {
+ argValue = representTransExpression(atomRaw.args()[0], argT, transcend);
+ }
+
+ bodyI12n->overrideBindings({
+ {argValue, argName}});
+ bodyBrute->reset();
+ return bodyBrute->compile();
+ });
+ }
+ }
+
+ assert(false && "No appropriate late annotation");
+ return nullptr; //should not be ever reachable
+}
+
}
} //end of xreate::interpretation
\ No newline at end of file
diff --git a/cpp/src/compilation/interpretation-instructions.h b/cpp/src/compilation/interpretation-instructions.h
index 9f1c0a5..284b094 100644
--- a/cpp/src/compilation/interpretation-instructions.h
+++ b/cpp/src/compilation/interpretation-instructions.h
@@ -1,38 +1,46 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/*
* Author: pgess <v.melnychenko@xreate.org>
* Created on June 15, 2018, 5:28 PM
*
* \file interpretation-instructions.h
* \brief Additional intepretation statements
*/
#ifndef INTERPRETATION_INSTRUCTIONS_H
#define INTERPRETATION_INSTRUCTIONS_H
-#include "compilation/targetinterpretation.h"
#include "ast.h"
+namespace xreate{
+namespace compilation{
+ class Context;
+}
+}
+
namespace xreate{
namespace interpretation{
+class InterpretationFunction;
+
class IntrinsicQueryInstruction{
public:
- IntrinsicQueryInstruction(InterpretationScope* scope): __scope(scope){ }
+ IntrinsicQueryInstruction(InterpretationFunction* fn): __fnI12n(fn){ }
Expression process(const Expression& expression);
+ llvm::Value* processLate(const Expression& expression, const compilation::Context& context);
private:
- InterpretationScope* __scope;
+ InterpretationFunction* __fnI12n;
};
}
} //end of xreate::interpretation
#endif /* INTERPRETATION_INSTRUCTIONS_H */
diff --git a/cpp/src/compilation/latereasoning.cpp b/cpp/src/compilation/latereasoning.cpp
index 34e8882..45f8ccd 100644
--- a/cpp/src/compilation/latereasoning.cpp
+++ b/cpp/src/compilation/latereasoning.cpp
@@ -1,166 +1,175 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* latereasoning.cpp
*
* Author: pgess <v.melnychenko@xreate.org>
* Created on May 26, 2018, 3:54 PM
*/
#include "compilation/latereasoning.h"
//#include "aux/latereasoning.h"
#include "compilation/scopedecorators.h"
#include "analysis/interpretation.h"
#include "compilation/targetinterpretation.h"
#include <vector>
using namespace xreate::interpretation;
using namespace xreate::compilation;
using namespace std;
namespace xreate{
namespace latereasoning{
#define HINT(x) (hint.empty()? x : hint)
llvm::Value*
LateReasoningCompiler::processSwitchLateStatement(const Expression& expr, const std::string& hint) {
AST* root = __context.pass->man->root;
LLVMLayer* llvm = __context.pass->man->llvm;
CodeScope* scopeBody = expr.blocks.front();
Symbol guardS = Symbol{scopeBody->getSymbol(expr.bindings.front()), scopeBody};
const ExpandedType& guardT = root->getType(expr.operands.at(0));
const ExpandedType& guardTPlain = interpretation::dereferenceSlaveType(guardT, __context.pass->man->transcend);
llvm::Value * guardRaw = __context.scope->process(expr.operands.at(0));
llvm::Type* instructionT = llvm->toLLVMType(root->getType(expr));
return compileExpand(guardS, guardRaw, guardTPlain, instructionT, hint, [this, scopeBody]() {
ICodeScopeUnit* bodyUnit = this->__context.function->getScopeUnit(scopeBody);
bodyUnit->reset();
return this->__context.function->getScopeUnit(scopeBody)->compile();
});
}
-llvm::Value*
+llvm::Value*
LateReasoningCompiler::compileAutoExpand(const LateAnnotation& annotation,
llvm::Type* resultT,
const std::string& hint,
Handler handler) {
TranscendLayer* transcend = __context.pass->man->transcend;
- InterpretationFunction* functionI12n =
- dynamic_cast<InterpretationFunction*> (__scopeI12n->function);
AST* root = __context.pass->man->root;
const std::list<SymbolPacked>& guardKeys = annotation.guardKeys;
- std::list<Symbol> notfound_guardKeys;
+ std::list<Symbol> guardsToExpand;
for(const SymbolPacked key : guardKeys) {
- const Symbol& keyS = transcend->unpack(key);
- InterpretationScope* keyScope = functionI12n->getScope(keyS.scope);
- if (!keyScope->isBindingDefined(keyS.identifier)) {
- notfound_guardKeys.push_back(keyS);
+ if(!__dictGuardDefinitions.count(key)) {
+ const Symbol& keyS = transcend->unpack(key);
+ InterpretationScope* keyScope = __fnI12n->getScope(keyS.scope);
+ if (!keyScope->isBindingDefined(keyS.identifier)) {
+ guardsToExpand.push_back(keyS);
+ }
}
}
typedef std::function < llvm::Value * () > Compiler;
Compiler programInit([handler, annotation, this]() {
std::list<Expression>&& values = findKeys(annotation.guardKeys);
auto answer = annotation.select(values, __context.pass->man->root, __context.pass->man->transcend);
assert(answer);
return handler(*answer);
});
- Compiler aggregate = std::accumulate(notfound_guardKeys.begin(), notfound_guardKeys.end(),
+ Compiler aggregate = std::accumulate(guardsToExpand.begin(), guardsToExpand.end(),
programInit,
[this, root, transcend, &resultT, hint](Compiler program, const Symbol & key) {
const ExpandedType& keyT = root->getType(CodeScope::getDefinition(key));
const ExpandedType& keyTPlain = keyT->__operator == TypeOperator::SLAVE?
interpretation::dereferenceSlaveType(keyT, transcend)
: keyT;
return Compiler([this, key, keyTPlain, resultT, hint, program](){
llvm::Value * keyRaw = __context.scope->processSymbol(key);
return compileExpand(key, keyRaw, keyTPlain, resultT, hint, program);
});
}
);
return aggregate();
}
llvm::Value*
LateReasoningCompiler::compileExpand(const Symbol& keyS,
llvm::Value* keyRaw,
const ExpandedType& domainT,
llvm::Type* resultT,
const std::string& hint,
CompilerHandler compilerBody) {
assert(domainT->__operator == TypeOperator::VARIANT);
std::list<Expression> domInstancesList = generateAllInstancesInDomain2(domainT);
std::vector<Expression> domInstances(domInstancesList.begin(), domInstancesList.end());
const int countInstances = domInstances.size();
assert(countInstances);
+ TranscendLayer* transcend = __context.pass->man->transcend;
+ SymbolPacked keyP = transcend->pack(keyS);
LLVMLayer* llvm = __context.pass->man->llvm;
llvm::IRBuilder<>& builder = llvm->builder;
compilation::IFunctionUnit* function = __context.function;
llvm::Type* typI8 = llvm::Type::getInt8Ty(llvm->llvmContext);
- InterpretationFunction* functionI12n = dynamic_cast<InterpretationFunction*> (__scopeI12n->function);
llvm::Value* keyVariantRaw = builder.CreateExtractValue(keyRaw, llvm::ArrayRef<unsigned>({0}));
llvm::SwitchInst* instructionSwitch = builder.CreateSwitch(keyVariantRaw, nullptr, countInstances);
llvm::BasicBlock *blockEpilog = llvm::BasicBlock::Create(
llvm->llvmContext, "epilog", function->raw);
builder.SetInsertPoint(blockEpilog);
llvm::PHINode *ret = builder.CreatePHI(resultT, countInstances, HINT("reverse"));
llvm::BasicBlock* blockDefault = nullptr;
for (int instanceId = 0; instanceId < countInstances; ++instanceId) {
llvm::BasicBlock *blockCase = llvm::BasicBlock::Create(
llvm->llvmContext,
"case" + std::to_string(instanceId),
function->raw);
if(instanceId == 0) blockDefault = blockCase;
builder.SetInsertPoint(blockCase);
- //assign bindings
-
+ //assign guard values
const Expression& instanceE = domInstances.at(instanceId);
- functionI12n->getScope(keyS.scope)->overrideBindings({
- {instanceE, keyS.identifier}
- });
+ __dictGuardDefinitions[keyP] = instanceE;
+
+// __fnI12n->getScope(keyS.scope)->overrideBindings({
+// {instanceE, keyS.identifier}
+// });
//invoke further compilation handler
llvm::Value* resultCase = compilerBody();
ret->addIncoming(resultCase, builder.GetInsertBlock());
instructionSwitch->addCase(llvm::dyn_cast<llvm::ConstantInt>(llvm::ConstantInt::get(typI8, instanceId)), blockCase);
builder.CreateBr(blockEpilog);
}
+ //erase guard assignment
+ __dictGuardDefinitions.erase(keyP);
+
instructionSwitch->setDefaultDest(blockDefault);
builder.SetInsertPoint(blockEpilog);
return ret;
}
std::list<Expression>
LateReasoningCompiler::findKeys(const std::list<SymbolPacked>& keys) {
TranscendLayer* transcend = __context.pass->man->transcend;
std::list<Expression> result;
-
+ InterpretationScope* scopeI12n = __fnI12n->getScope(__context.scope->scope);
+
std::transform(keys.begin(), keys.end(), std::inserter(result, result.end()),
- [this, transcend](const SymbolPacked & key) {
- return __scopeI12n->processSymbol(transcend->unpack(key));
+ [this, scopeI12n, transcend](const SymbolPacked & key) {
+ if (__dictGuardDefinitions.count(key)){
+ return __dictGuardDefinitions.at(key);
+ }
+ return scopeI12n->processSymbol(transcend->unpack(key));
});
return result;
}
}
-}
\ No newline at end of file
+}
diff --git a/cpp/src/compilation/latereasoning.h b/cpp/src/compilation/latereasoning.h
index a065fde..c88d298 100644
--- a/cpp/src/compilation/latereasoning.h
+++ b/cpp/src/compilation/latereasoning.h
@@ -1,68 +1,72 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* File: latereasoning.h
* Author: pgess <v.melnychenko@xreate.org>
*
* Created on May 26, 2018, 3:44 PM
*/
#ifndef CMPLLATEREASONING_H
#define CMPLLATEREASONING_H
#include "ast.h"
#include "aux/latereasoning.h"
#include "pass/compilepass.h"
#include "llvmlayer.h"
#include "transcendlayer.h"
+#include "targets.h"
namespace xreate{
namespace interpretation{
-class InterpretationScope;
+class InterpretationFunction;
}
}
namespace llvm{
class Value;
}
namespace xreate{
namespace latereasoning{
typedef std::function<llvm::Value*() > CompilerHandler;
typedef std::function<llvm::Value*(const Gringo::Symbol&) > Handler;
class LateReasoningCompiler{
public:
- LateReasoningCompiler(interpretation::InterpretationScope* scope,
- compilation::Context ctx)
- : __context(ctx), __scopeI12n(scope) {}
-
+
+ LateReasoningCompiler(interpretation::InterpretationFunction* fn,
+ compilation::Context ctx)
+ : __context(ctx), __fnI12n(fn){ }
+
llvm::Value* processSwitchLateStatement(const Expression& expr,
const std::string& identHint);
llvm::Value* compileAutoExpand(const LateAnnotation& annotation,
- llvm::Type* resultT,
- const std::string& hint,
- Handler handler);
+ llvm::Type* resultT,
+ const std::string& hint,
+ Handler handler);
private:
compilation::Context __context;
- interpretation::InterpretationScope* __scopeI12n;
+ interpretation::InterpretationFunction* __fnI12n;
+ std::map<SymbolPacked, Expression> __dictGuardDefinitions;
llvm::Value* compileExpand(const Symbol& keyS,
llvm::Value* keyRaw,
const ExpandedType& domainT,
llvm::Type* resultT,
const std::string& hint,
CompilerHandler compilerBody);
std::list<Expression> findKeys(const std::list<SymbolPacked>& keys);
+
};
}
}
#endif /* CMPLLATEREASONING_H */
diff --git a/cpp/src/compilation/latex.h b/cpp/src/compilation/latex.h
index e5c7fc1..339b82e 100644
--- a/cpp/src/compilation/latex.h
+++ b/cpp/src/compilation/latex.h
@@ -1,135 +1,140 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/*
* Author: pgess <v.melnychenko@xreate.org>
* Created on June 23, 2018, 2:51 PM
*
* \file latex.h
* \brief latex
*/
#ifndef LATEX_H
#define LATEX_H
#include "compilation/latereasoning.h"
#include "compilation/interpretation-instructions.h"
#include "query/latex.h"
#include "pass/compilepass.h"
#include "analysis/interpretation.h"
+#include "compilation/targetinterpretation.h"
namespace xreate{
namespace latex{
ExpandedType
getSubjectDomain(const std::string& subject, LatexQuery* query);
/** \brief Latex(Late Context)-enabled decorator for IFunctionUnit
* \extends IFunctionUnit
*/
template<class Parent>
class LatexBruteFunctionDecorator: public Parent{
public:
LatexBruteFunctionDecorator(ManagedFnPtr f, CompilePass* p)
: Parent(f, p){
__query = reinterpret_cast<LatexQuery*> (Parent::pass->man->transcend->getQuery(QueryId::LatexQuery));
}
protected:
std::vector<llvm::Type*>
prepareSignature(){
std::vector<llvm::Type*>&& signature = Parent::prepareSignature();
const Demand& demand = __query->getFnDemand(Parent::function->getName());
signature.reserve(signature.size() + demand.size());
-
+
+ int subjectId = __query->LatexParametersOffset;
for(const std::string& subject: demand){
const ExpandedType& subjectT = getSubjectDomain(subject, __query);
Expression bindingE;
bindingE.type = subjectT;
std::string argCaption = std::string("latex_") + subject;
- Parent::function->addBinding(Atom<Identifier_t>(std::string(argCaption)), std::move(bindingE));
+ Parent::function->addBinding(
+ Atom<Identifier_t>(std::string(argCaption)),
+ std::move(bindingE),
+ subjectId++);
llvm::Type* subjectTRaw = Parent::pass->man->llvm->toLLVMType(subjectT);
signature.push_back(subjectTRaw);
}
return signature;
}
public:
LatexQuery* __query;
};
class ExtraArgsFnInvocation: public compilation::IFnInvocation{
public:
ExtraArgsFnInvocation(std::vector<llvm::Value*> argsLatex, compilation::IFnInvocation* parent)
: __argsLatex(argsLatex), __parent(parent){ }
llvm::Value* operator()(std::vector<llvm::Value *>&& args, const std::string& hintDecl = "");
private:
std::vector<llvm::Value*> __argsLatex;
compilation::IFnInvocation* __parent;
};
template<class Parent>
class LatexBruteScopeDecorator: public Parent{
public:
LatexBruteScopeDecorator(const CodeScope * const codeScope, compilation::IFunctionUnit* f, CompilePass* compilePass)
: Parent(codeScope, f, compilePass){ }
compilation::IFnInvocation*
findFunction(const Expression& opCall){
compilation::IFnInvocation* invocDefault = Parent::findFunction(opCall);
const std::string& calleeName = opCall.getValueString();
LatexQuery* query = reinterpret_cast<LatexQuery*> (Parent::pass->man->transcend->getQuery(QueryId::LatexQuery));
const Demand& fnCalleeDemand = query->getFnDemand(calleeName);
if(!fnCalleeDemand.size()) return invocDefault;
//prepare latex arguments
std::vector<llvm::Value*> argsLatex;
argsLatex.reserve(fnCalleeDemand.size());
for(const std::string& subject: fnCalleeDemand){
ExpandedType subjectT = getSubjectDomain(subject, query);
llvm::Type* subjectTRaw = Parent::pass->man->llvm->toLLVMType(subjectT);
const latereasoning::LateAnnotation& decision = query->getDecision(subject, Parent::scope);
compilation::Context ctx{this, Parent::function, Parent::pass};
interpretation::InterpretationScope* scopeIntrpr =
Parent::pass->targetInterpretation->transformContext(ctx);
latereasoning::LateReasoningCompiler* compiler
- = new latereasoning::LateReasoningCompiler(scopeIntrpr, ctx);
+ = new latereasoning::LateReasoningCompiler(dynamic_cast<interpretation::InterpretationFunction*>(scopeIntrpr->function), ctx);
llvm::Value* subjectRaw = compiler->compileAutoExpand(
decision,
subjectTRaw,
subject,
[&](const Gringo::Symbol & decisionRaw){
const Expression& decisionE = interpretation::representTransExpression(
decisionRaw.args()[2], subjectT, Parent::pass->man->transcend);
Attachments::put<TypeInferred>(decisionE, subjectT);
return Parent::process(decisionE, subject);
});
argsLatex.push_back(subjectRaw);
}
return new ExtraArgsFnInvocation(std::move(argsLatex), invocDefault);
}
};
}
} //end of namespace xreate::context
#endif /* LATEX_H */
diff --git a/cpp/src/compilation/polymorph.h b/cpp/src/compilation/polymorph.h
index e49d7bd..def1bc1 100644
--- a/cpp/src/compilation/polymorph.h
+++ b/cpp/src/compilation/polymorph.h
@@ -1,95 +1,96 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* File: polymorphcompiler.h
* Author: pgess <v.melnychenko@xreate.org>
*
* Created on October 7, 2017
*/
#ifndef POLYMORPHCOMPILER_H
#define POLYMORPHCOMPILER_H
#include "pass/compilepass.h"
#include "query/polymorph.h"
#include "compilation/latereasoning.h"
+#include "compilation/targetinterpretation.h"
namespace xreate{
namespace polymorph{
typedef Expression Selector;
class PolymorphFnInvocation: public compilation::IFnInvocation{
public:
PolymorphFnInvocation(const latereasoning::LateAnnotation& selector,
std::list<ManagedFnPtr> calleeSpecializations,
CompilePass* pass,
PolymorphQuery* query,
LLVMLayer* llvm,
latereasoning::LateReasoningCompiler* compiler);
llvm::Value* operator()(std::vector<llvm::Value *>&& args, const std::string& hintDecl = "");
private:
latereasoning::LateAnnotation __selector;
std::list<ManagedFnPtr> __calleeSpecializations;
CompilePass* __pass;
PolymorphQuery* __query;
LLVMLayer* __llvm;
latereasoning::LateReasoningCompiler* __compiler;
};
template <class Parent>
class PolymorphCodeScopeUnit: public Parent{
public:
PolymorphCodeScopeUnit(const CodeScope * const codeScope,
compilation::IFunctionUnit* f,
CompilePass* compilePass)
: Parent(codeScope, f, compilePass){ }
protected:
compilation::IFnInvocation*
findFunction(const Expression& opCall) override{
// //Check does invocation require guards satisfaction
const std::string& nameCallee = opCall.getValueString();
const std::list<ManagedFnPtr>& specializations =
Parent::pass->man->root->getFunctionSpecializations(nameCallee);
//Extern function
if(specializations.size() == 0){
return Parent::findFunction(opCall);
}
//No other specializations. Check if it has no guard
if(specializations.size() == 1){
if(!specializations.front()->guard.isValid()){
return Parent::findFunction(opCall);
}
}
//Several specializations
PolymorphQuery* query = dynamic_cast<PolymorphQuery*> (
Parent::pass->man->transcend->getQuery(QueryId::PolymorphQuery));
const latereasoning::LateAnnotation& selector = query->get(opCall);
compilation::Context ctx{this, Parent::function, Parent::pass};
interpretation::InterpretationScope* scopeIntrpr =
Parent::pass->targetInterpretation->transformContext(ctx);
latereasoning::LateReasoningCompiler* compiler
- = new latereasoning::LateReasoningCompiler(scopeIntrpr, ctx);
+ = new latereasoning::LateReasoningCompiler(dynamic_cast<interpretation::InterpretationFunction*>(scopeIntrpr->function), ctx);
return new PolymorphFnInvocation(selector, specializations, Parent::pass,
query, Parent::pass->man->llvm, compiler);
}
};
}
} //end of xreate::polymorph
#endif /* POLYMORPHCOMPILER_H */
diff --git a/cpp/src/compilation/scopedecorators.h b/cpp/src/compilation/scopedecorators.h
index 9dfe62d..cf26986 100644
--- a/cpp/src/compilation/scopedecorators.h
+++ b/cpp/src/compilation/scopedecorators.h
@@ -1,157 +1,183 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* File: scopedecorators.h
* Author: pgess <v.melnychenko@xreate.org>
*
* Created on February 24, 2017, 11:35 AM
*/
/**
* \file scopedecorators.h
* \brief Basic code block compilation xreate::compilation::ICodeScopeUnit decorators
*/
#ifndef SCOPEDECORATORS_H
#define SCOPEDECORATORS_H
#include "ast.h"
#include "compilation/targetinterpretation.h"
#include "compilation/versions.h"
#include "compilation/transformations.h"
#include "compilation/polymorph.h"
+#include "compilation/latex.h"
+#include "analysis/typeinference.h"
#include <list>
namespace xreate {
class CompilePass;
namespace compilation {
class ICodeScopeUnit;
class IFunctionUnit;
/**\brief Caching ability for code scope compilation
* \extends xreate::compilation::ICodeScopeUnit
*/
template<class Parent>
class CachedScopeDecorator: public Parent{
typedef CachedScopeDecorator<Parent> SELF;
public:
CachedScopeDecorator(const CodeScope* const codeScope, IFunctionUnit* f, CompilePass* compilePass): Parent(codeScope, f, compilePass){}
Symbol bindArg(llvm::Value* value, std::string&& alias)
{
//ensure existence of an alias
assert(Parent::scope->__identifiers.count(alias));
//memorize new value for an alias
ScopedSymbol id{Parent::scope->__identifiers.at(alias), versions::VERSION_NONE};
__rawVars[id] = value;
return Symbol{id, Parent::scope};
}
void bindArg(llvm::Value* value, const ScopedSymbol& s) {
__rawVars[s] = value;
}
llvm::Value* compile(const std::string& hintBlockDecl="") override{
if (__rawVars.count(ScopedSymbol::RetSymbol)){
return __rawVars[ScopedSymbol::RetSymbol];
}
return Parent::compile(hintBlockDecl);
}
llvm::Value*
processSymbol(const Symbol& s, std::string hintRetVar) override{
const CodeScope* scope = s.scope;
SELF* self = dynamic_cast<SELF*>(Parent::function->getScopeUnit(scope));
if (self->__rawVars.count(s.identifier)){
return self->__rawVars[s.identifier];
}
//Declaration could be overriden
/*
Expression declaration = CodeScope::getDefinition(s, true);
if (!declaration.isDefined()){
assert(__declarationsOverriden.count(s.identifier));
declaration = __declarationsOverriden[s.identifier];
} else {
(false); //in case of binding there should be raws provided.
}
}
*/
llvm::Value* resultRaw = Parent::processSymbol(s, hintRetVar);
self->__rawVars.emplace(s.identifier, resultRaw);
return resultRaw;
}
void
overrideDeclarations(std::list<std::pair<Symbol, Expression>> bindings){
reset();
for (auto entry: bindings){
SELF* self = dynamic_cast<SELF*>(Parent::function->getScopeUnit(entry.first.scope));
assert(self == this);
self->__declarationsOverriden.emplace(entry.first.identifier, entry.second);
}
}
void registerChildScope(std::shared_ptr<ICodeScopeUnit> scope){
__childScopes.push_back(scope);
}
void reset(){
__rawVars.clear();
__declarationsOverriden.clear();
__childScopes.clear();
}
private:
std::unordered_map<ScopedSymbol, Expression> __declarationsOverriden;
std::unordered_map<ScopedSymbol,llvm::Value*> __rawVars;
std::list<std::shared_ptr<ICodeScopeUnit>> __childScopes;
};
+template<class Parent>
+class TypeConversionScopeDecorator: public Parent {
+public:
+ TypeConversionScopeDecorator(const CodeScope* const codeScope, IFunctionUnit* f, CompilePass* compilePass): Parent(codeScope, f, compilePass){}
+
+ llvm::Value* process(const Expression& expr, const std::string& hintVarDecl="") override {
+ llvm::Value* resultR = Parent::process(expr, hintVarDecl);
+
+ if(!expr.type.isValid()) {
+ return resultR;
+ }
+
+ ExpandedType exprT = Parent::pass->man->root->getType(expr);
+ llvm::Type* exprTR = Parent::pass->man->llvm->toLLVMType(exprT);
+ return typeinference::doAutomaticTypeConversion(resultR, exprTR, Parent::pass->man->llvm->builder);
+ }
+};
+
/**\brief Default code scope compilation functionality*/
typedef CachedScopeDecorator<
+ TypeConversionScopeDecorator<
+ latex::LatexBruteScopeDecorator<
polymorph::PolymorphCodeScopeUnit<
- ::xreate::compilation::TransformationsScopeDecorator<
+ compilation::TransformationsScopeDecorator<
interpretation::InterpretationScopeDecorator<
- versions::VersionsScopeDecorator<compilation::BasicCodeScopeUnit>>>>>
+ versions::VersionsScopeDecorator<compilation::BasicCodeScopeUnit>>>>>>>
DefaultCodeScopeUnit;
} //end of compilation namespace
struct CachedScopeDecoratorTag;
struct VersionsScopeDecoratorTag;
template<>
struct DecoratorsDict<CachedScopeDecoratorTag>{
typedef compilation::CachedScopeDecorator<
+ compilation::TypeConversionScopeDecorator<
+ latex::LatexBruteScopeDecorator<
polymorph::PolymorphCodeScopeUnit<
compilation::TransformationsScopeDecorator<
interpretation::InterpretationScopeDecorator<
- versions::VersionsScopeDecorator<compilation::BasicCodeScopeUnit>>>>> result;
+ versions::VersionsScopeDecorator<compilation::BasicCodeScopeUnit>>>>>>>
+
+ result;
};
template<>
struct DecoratorsDict<VersionsScopeDecoratorTag>{
typedef versions::VersionsScopeDecorator<
compilation::BasicCodeScopeUnit> result;
};
} //end of xreate
#endif /* SCOPEDECORATORS_H */
diff --git a/cpp/src/compilation/targetinterpretation.cpp b/cpp/src/compilation/targetinterpretation.cpp
index 9314a6c..31da3ea 100644
--- a/cpp/src/compilation/targetinterpretation.cpp
+++ b/cpp/src/compilation/targetinterpretation.cpp
@@ -1,597 +1,628 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* File: targetinterpretation.cpp
* Author: pgess <v.melnychenko@xreate.org>
*
* Created on June 29, 2016, 6:45 PM
*/
/**
* \file targetinterpretation.h
* \brief Interpretation support. See more [details on Interpretation](/w/concepts/dsl/)
*/
#include "compilation/targetinterpretation.h"
#include "pass/interpretationpass.h"
#include "analysis/typeinference.h"
#include "llvmlayer.h"
#include "compilation/scopedecorators.h"
#include "compilation/interpretation-instructions.h"
#include <boost/scoped_ptr.hpp>
#include <iostream>
#include <csignal>
using namespace std;
using namespace xreate::compilation;
-namespace xreate{ namespace interpretation{
+namespace xreate{
+namespace interpretation{
const Expression EXPRESSION_FALSE = Expression(Atom<Number_t>(0));
const Expression EXPRESSION_TRUE = Expression(Atom<Number_t>(1));
CodeScope*
-InterpretationScope::processOperatorIf(const Expression& expression){
+InterpretationScope::processOperatorIf(const Expression& expression) {
const Expression& exprCondition = process(expression.getOperands()[0]);
- if (exprCondition == EXPRESSION_TRUE){
+ if (exprCondition == EXPRESSION_TRUE) {
return expression.blocks.front();
}
return expression.blocks.back();
}
CodeScope*
InterpretationScope::processOperatorSwitch(const Expression& expression) {
const Expression& exprCondition = process(expression.operands[0]);
bool flagHasDefault = expression.operands[1].op == Operator::CASE_DEFAULT;
//TODO check that one and only one case variant is appropriate
- for (size_t size = expression.operands.size(), i= flagHasDefault? 2: 1; i<size; ++i){
+ for (size_t size = expression.operands.size(), i = flagHasDefault ? 2 : 1; i < size; ++i) {
const Expression& exprCase = process(expression.operands[i]);
- if (function->getScope((const CodeScope*) exprCase.blocks.front())->processScope() == exprCondition){
+ if (function->getScope((const CodeScope*) exprCase.blocks.front())->processScope() == exprCondition) {
return exprCase.blocks.back();
}
}
- if (flagHasDefault){
+ if (flagHasDefault) {
const Expression& exprCaseDefault = expression.operands[1];
return exprCaseDefault.blocks.front();
}
assert(false && "Switch has no appropriate variant");
return nullptr;
}
CodeScope*
-InterpretationScope::processOperatorSwitchVariant(const Expression& expression){
+InterpretationScope::processOperatorSwitchVariant(const Expression& expression) {
const Expression& condition = process(expression.operands.at(0));
assert(condition.op == Operator::VARIANT);
const string& identCondition = expression.bindings.front();
Expression opExpected(Atom<Number_t>(condition.getValueDouble()));
auto itFoundValue = std::find(++expression.operands.begin(), expression.operands.end(), opExpected);
assert(itFoundValue != expression.operands.end());
- int indexBlock = itFoundValue - expression.operands.begin() -1;
+ int indexBlock = itFoundValue - expression.operands.begin() - 1;
auto blockFound = expression.blocks.begin();
std::advance(blockFound, indexBlock);
InterpretationScope* scopeI12n = function->getScope(*blockFound);
- if(condition.operands.size()){
- const Expression& value=condition.operands.at(0);
+ if(condition.operands.size()) {
+ const Expression& value = condition.operands.at(0);
scopeI12n->overrideBindings({
- {value, identCondition}});
- }
+ {value, identCondition}
+ });
+ }
return *blockFound;
}
llvm::Value*
-InterpretationScope::compileHybrid(const InterpretationOperator& op, const Expression& expression, const Context& context){
- switch(op){
- case IF_INTERPRET_CONDITION: {
- CodeScope* scopeResult = processOperatorIf(expression);
+InterpretationScope::processLate(const InterpretationOperator& op, const Expression& expression, const Context& context) {
+ switch(op) {
+ case IF_INTERPRET_CONDITION:
+ {
+ CodeScope* scopeResult = processOperatorIf(expression);
+
+ llvm::Value* result = context.function->getScopeUnit(scopeResult)->compile();
+ return result;
+ }
- llvm::Value* result = context.function->getScopeUnit(scopeResult)->compile();
- return result;
- }
+ case SWITCH_INTERPRET_CONDITION:
+ {
+ CodeScope* scopeResult = processOperatorSwitch(expression);
- case SWITCH_INTERPRET_CONDITION:{
- CodeScope* scopeResult = processOperatorSwitch(expression);
+ llvm::Value* result = context.function->getScopeUnit(scopeResult)->compile();
+ return result;
+ }
- llvm::Value* result = context.function->getScopeUnit(scopeResult)->compile();
- return result;
+ case SWITCH_VARIANT:
+ {
+ CodeScope* scopeResult = processOperatorSwitchVariant(expression);
+ const Expression& condition = expression.operands.at(0);
+ const Expression& valueCondition = process(condition);
+
+ const string identCondition = expression.bindings.front();
+ auto scopeCompilation = Decorators<CachedScopeDecoratorTag>::getInterface(context.function->getScopeUnit(scopeResult));
+
+ if(valueCondition.operands.size()) {
+ //override value
+ Symbol symbCondition{ScopedSymbol{scopeResult->__identifiers.at(identCondition), versions::VERSION_NONE}, scopeResult};
+ scopeCompilation->overrideDeclarations({
+ {symbCondition, Expression(valueCondition.operands.at(0))}}
+ );
+
+ //set correct type for binding:
+ TypeAnnotation typeVariant = typeinference::getType(condition, *function->man->ast);
+ int conditionIndex = valueCondition.getValueDouble();
+ ScopedSymbol symbolInternal = scopeResult->getSymbol(identCondition);
+ scopeResult->__declarations[symbolInternal].bindType(typeVariant.__operands.at(conditionIndex));
}
- case SWITCH_VARIANT: {
- CodeScope* scopeResult = processOperatorSwitchVariant(expression);
- const Expression& condition = expression.operands.at(0);
- const Expression& valueCondition = process(condition);
-
- const string identCondition = expression.bindings.front();
- auto scopeCompilation = Decorators<CachedScopeDecoratorTag>::getInterface(context.function->getScopeUnit(scopeResult));
-
- if(valueCondition.operands.size()){
- //override value
- Symbol symbCondition{ScopedSymbol{scopeResult->__identifiers.at(identCondition), versions::VERSION_NONE}, scopeResult};
- scopeCompilation->overrideDeclarations(
- {{symbCondition, Expression(valueCondition.operands.at(0))}}
- );
-
- //set correct type for binding:
- TypeAnnotation typeVariant = typeinference::getType(condition, *function->man->ast);
- int conditionIndex = valueCondition.getValueDouble();
- ScopedSymbol symbolInternal = scopeResult->getSymbol(identCondition);
- scopeResult->__declarations[symbolInternal].bindType(typeVariant.__operands.at(conditionIndex));
- }
-
- llvm::Value* result = context.function->getScopeUnit(scopeResult)->compile();
- return result;
- }
-
- case SWITCH_LATE: {
- latereasoning::LateReasoningCompiler compiler(this, context);
- return compiler.processSwitchLateStatement(expression, "");
- }
+ llvm::Value* result = context.function->getScopeUnit(scopeResult)->compile();
+ return result;
+ }
- case FOLD_INTERPRET_INPUT: {
- //initialization
- const Expression& exprInput = process(expression.getOperands()[0]);
- assert(exprInput.op == Operator::LIST);
+ case SWITCH_LATE:
+ {
+ latereasoning::LateReasoningCompiler compiler(dynamic_cast<InterpretationFunction*>(this->function), context);
+ return compiler.processSwitchLateStatement(expression, "");
+ }
- CodeScope* scopeBody = expression.blocks.front();
+ case FOLD_INTERPRET_INPUT:
+ {
+ //initialization
+ const Expression& exprInput = process(expression.getOperands()[0]);
+ assert(exprInput.op == Operator::LIST);
- const string& nameEl = expression.bindings[0];
- Symbol symbEl{ScopedSymbol{scopeBody->__identifiers.at(nameEl), versions::VERSION_NONE}, scopeBody};
- const std::string& idAccum = expression.bindings[1];
- llvm::Value* rawAccum = context.scope->process(expression.getOperands()[1]);
+ CodeScope* scopeBody = expression.blocks.front();
- InterpretationScope* intrBody = function->getScope(scopeBody);
- auto unitBody = Decorators<CachedScopeDecoratorTag>::getInterface(context.function->getScopeUnit(scopeBody));
+ const string& nameEl = expression.bindings[0];
+ Symbol symbEl{ScopedSymbol{scopeBody->__identifiers.at(nameEl), versions::VERSION_NONE}, scopeBody};
+ const std::string& idAccum = expression.bindings[1];
+ llvm::Value* rawAccum = context.scope->process(expression.getOperands()[1]);
- const std::vector<Expression> elementsInput= exprInput.getOperands();
+ InterpretationScope* intrBody = function->getScope(scopeBody);
+ auto unitBody = Decorators<CachedScopeDecoratorTag>::getInterface(context.function->getScopeUnit(scopeBody));
- for(size_t i=0; i<elementsInput.size(); ++i) {
- const Expression& exprElement=elementsInput[i];
+ const std::vector<Expression> elementsInput = exprInput.getOperands();
- intrBody->overrideBindings({
- {exprElement, nameEl}});
- unitBody->overrideDeclarations({
- {symbEl, exprElement}}); //resets unitBody
- unitBody->bindArg(rawAccum, string(idAccum));
+ for(size_t i = 0; i < elementsInput.size(); ++i) {
+ const Expression& exprElement = elementsInput[i];
- rawAccum=unitBody->compile();
- }
+ intrBody->overrideBindings({
+ {exprElement, nameEl}
+ });
+ unitBody->overrideDeclarations({
+ {symbEl, exprElement}
+ }); //resets unitBody
+ unitBody->bindArg(rawAccum, string(idAccum));
- return rawAccum;
+ rawAccum = unitBody->compile();
}
- /*
- case FOLD_INF_INTERPRET_INOUT{
- }
- */
+ return rawAccum;
+ }
+
+// case FOLD_INF_INTERPRET_INOUT:
+// {
+// }
//TODO refactor as InterpretationCallStatement class
- case CALL_INTERPRET_PARTIAL: {
- const std::string &calleeName = expression.getValueString();
- ICodeScopeUnit* scopeUnitSelf = context.scope;
- ManagedFnPtr callee = this->function->man->ast->findFunction(calleeName);
- const FunctionInterpretationData& calleeData = FunctionInterpretationHelper::getSignature(callee);
- std::vector<llvm::Value *> argsActual;
- PIFSignature sig;
- sig.declaration = callee;
-
- for(size_t no=0, size = expression.operands.size(); no < size; ++no){
- const Expression& op = expression.operands[no];
-
- if (calleeData.signature.at(no) == INTR_ONLY){
- sig.bindings.push_back(process(op));
- continue;
- }
-
- argsActual.push_back(scopeUnitSelf->process(op));
+ case CALL_INTERPRET_PARTIAL:
+ {
+ const std::string &calleeName = expression.getValueString();
+ ICodeScopeUnit* scopeUnitSelf = context.scope;
+ ManagedFnPtr callee = this->function->man->ast->findFunction(calleeName);
+ const FunctionInterpretationData& calleeData = FunctionInterpretationHelper::getSignature(callee);
+ std::vector<llvm::Value *> argsActual;
+ PIFSignature sig;
+ sig.declaration = callee;
+
+ for(size_t no = 0, size = expression.operands.size(); no < size; ++no) {
+ const Expression& op = expression.operands[no];
+
+ if (calleeData.signature.at(no) == INTR_ONLY) {
+ sig.bindings.push_back(process(op));
+ continue;
}
- TargetInterpretation* man = dynamic_cast<TargetInterpretation*>(this->function->man);
- PIFunction* pifunction = man->getFunction(move(sig));
-
- llvm::Function* raw = pifunction->compile();
- boost::scoped_ptr<RawFnInvocation> statement(new RawFnInvocation(raw, man->pass->man->llvm));
- return (*statement)(move(argsActual));
+ argsActual.push_back(scopeUnitSelf->process(op));
}
- default: break;
+ TargetInterpretation* man = dynamic_cast<TargetInterpretation*> (this->function->man);
+ PIFunction* pifunction = man->getFunction(move(sig));
+
+ llvm::Function* raw = pifunction->compile();
+ boost::scoped_ptr<RawFnInvocation> statement(new RawFnInvocation(raw, man->pass->man->llvm));
+ return (*statement)(move(argsActual));
+ }
+
+ case QUERY_LATE:
+ {
+ return IntrinsicQueryInstruction(
+ dynamic_cast<InterpretationFunction*>(this->function))
+ .processLate(expression, context);
}
- assert(false&& "Unknown hybrid operator");
+ default: break;
+ }
+
+ assert(false && "Unknown late interpretation operator");
return nullptr;
}
llvm::Value*
-InterpretationScope::compile(const Expression& expression, const Context& context){
+InterpretationScope::compile(const Expression& expression, const Context& context) {
const InterpretationData& data = Attachments::get<InterpretationData>(expression);
- if (data.op != InterpretationOperator::NONE){
- return compileHybrid(data.op, expression, context);
+ if (data.op != InterpretationOperator::NONE) {
+ return processLate(data.op, expression, context);
}
Expression result = process(expression);
return context.scope->process(result);
}
Expression
InterpretationScope::process(const Expression& expression) {
#ifndef NDEBUG
- if (expression.tags.count("bpoint")){
+ if (expression.tags.count("bpoint")) {
std::raise(SIGINT);
}
#endif
PassManager* man = (static_cast<TargetInterpretation*> (function->man))->pass->man;
- switch (expression.__state){
- case Expression::INVALID:
- assert(false);
+ switch (expression.__state) {
+ case Expression::INVALID:
+ assert(false);
- case Expression::NUMBER:
- case Expression::STRING:
- return expression;
+ case Expression::NUMBER:
+ case Expression::STRING:
+ return expression;
- case Expression::IDENT:{
- Symbol s = Attachments::get<IdentifierSymbol>(expression);
- return Parent::processSymbol(s);
- }
+ case Expression::IDENT:
+ {
+ Symbol s = Attachments::get<IdentifierSymbol>(expression);
+ return Parent::processSymbol(s);
+ }
- case Expression::COMPOUND:
- break;
+ case Expression::COMPOUND:
+ break;
- default: assert(false);
+ default: assert(false);
}
switch (expression.op) {
- case Operator::EQU: {
- const Expression& left = process(expression.operands[0]);
- const Expression& right = process(expression.operands[1]);
+ case Operator::EQU:
+ {
+ const Expression& left = process(expression.operands[0]);
+ const Expression& right = process(expression.operands[1]);
- if (left == right) return EXPRESSION_TRUE;
- return EXPRESSION_FALSE;
- }
+ if (left == right) return EXPRESSION_TRUE;
+ return EXPRESSION_FALSE;
+ }
- case Operator::NE: {
- const Expression& left = process(expression.operands[0]);
- const Expression& right = process(expression.operands[1]);
+ case Operator::NE:
+ {
+ const Expression& left = process(expression.operands[0]);
+ const Expression& right = process(expression.operands[1]);
- if (left == right) return EXPRESSION_FALSE;
- return EXPRESSION_TRUE;
- }
+ if (left == right) return EXPRESSION_FALSE;
+ return EXPRESSION_TRUE;
+ }
- case Operator::LOGIC_AND: {
- assert(expression.operands.size() == 1);
- return process (expression.operands[0]);
- }
+ case Operator::LOGIC_AND:
+ {
+ assert(expression.operands.size() == 1);
+ return process (expression.operands[0]);
+ }
-// case Operator::LOGIC_OR:
- case Operator::CALL: {
- const std::string &fnName = expression.getValueString();
- ManagedFnPtr fnAst = this->function->man->ast->findFunction(fnName);
- InterpretationFunction* fnUnit = this->function->man->getFunction(fnAst);
+ // case Operator::LOGIC_OR:
+ case Operator::CALL:
+ {
+ const std::string &fnName = expression.getValueString();
+ ManagedFnPtr fnAst = this->function->man->ast->findFunction(fnName);
+ InterpretationFunction* fnUnit = this->function->man->getFunction(fnAst);
- vector<Expression> args;
- args.reserve(expression.getOperands().size());
+ vector<Expression> args;
+ args.reserve(expression.getOperands().size());
- for(size_t i=0, size = expression.getOperands().size(); i<size; ++i) {
- args.push_back(process(expression.getOperands()[i]));
- }
-
- return fnUnit->process(args);
+ for(size_t i = 0, size = expression.getOperands().size(); i < size; ++i) {
+ args.push_back(process(expression.getOperands()[i]));
}
- case Operator::CALL_INTRINSIC: {
- std::string nameFunction = expression.getValueString();
-
- if(nameFunction=="query"){
- return IntrinsicQueryInstruction(this).process(expression);
-
- } else if(nameFunction=="query_scope"){
- ScopePacked scopeId = man->transcend->pack(scope);
- Expression result(Operator::VARIANT, {Expression(scopeId)});
- result.setValueDouble(0);
- return result;
+ return fnUnit->process(args);
+ }
- } else {
- assert(false && "Unknown intrinsic");
- }
- }
+ case Operator::CALL_INTRINSIC:
+ {
+ assert(false && "Unknown intrinsic");
+ }
- case Operator::IF:{
- CodeScope* scopeResult = processOperatorIf(expression);
- return function->getScope(scopeResult)->processScope();
- }
+ case Operator::QUERY:
+ {
+ return IntrinsicQueryInstruction(dynamic_cast<InterpretationFunction*>(this->function))
+ .process(expression);
+ }
+
+ case Operator::QUERY_LATE:
+ {
+ assert(false && "Can't be interpretated");
+ return Expression();
+ }
- case Operator::SWITCH: {
- CodeScope* scopeResult = processOperatorSwitch(expression);
- return function->getScope(scopeResult)->processScope();
- }
+ case Operator::IF:
+ {
+ CodeScope* scopeResult = processOperatorIf(expression);
+ return function->getScope(scopeResult)->processScope();
+ }
- case Operator::SWITCH_VARIANT: {
- CodeScope* scopeResult = processOperatorSwitchVariant(expression);
- return function->getScope(scopeResult)->processScope();
- }
+ case Operator::SWITCH:
+ {
+ CodeScope* scopeResult = processOperatorSwitch(expression);
+ return function->getScope(scopeResult)->processScope();
+ }
- case Operator::VARIANT: {
- if(!expression.operands.size()) return expression;
+ case Operator::SWITCH_VARIANT:
+ {
+ CodeScope* scopeResult = processOperatorSwitchVariant(expression);
+ return function->getScope(scopeResult)->processScope();
+ }
- Expression variantData = process(expression.operands[0]);
- Expression result{Operator::VARIANT, {variantData}};
- result.setValueDouble(expression.getValueDouble());
- return result;
- }
+ case Operator::VARIANT:
+ {
+ if(!expression.operands.size()) return expression;
- case Operator::INDEX: {
- Expression exprData = process(expression.operands[0]);
+ Expression variantData = process(expression.operands[0]);
+ Expression result{Operator::VARIANT, {variantData}};
+ result.setValueDouble(expression.getValueDouble());
+ return result;
+ }
- for (size_t keyId=1; keyId<expression.operands.size(); ++keyId){
- const Expression& exprKey = process(expression.operands[keyId]);
+ case Operator::INDEX:
+ {
+ Expression exprData = process(expression.operands[0]);
- if (exprKey.__state == Expression::STRING){
- const string& key = exprKey.getValueString();
- assert(exprData.__indexBindings.count(key));
- size_t idxKey = exprData.__indexBindings.at(key);
+ for (size_t keyId = 1; keyId < expression.operands.size(); ++keyId) {
+ const Expression& exprKey = process(expression.operands[keyId]);
- exprData = Expression(exprData.operands.at(idxKey));
- continue;
- }
+ if (exprKey.__state == Expression::STRING) {
+ const string& key = exprKey.getValueString();
+ assert(exprData.__indexBindings.count(key));
+ size_t idxKey = exprData.__indexBindings.at(key);
- if (exprKey.__state == Expression::NUMBER){
- int key = exprKey.getValueDouble();
- exprData = Expression(exprData.operands[key]);
- continue;
- }
+ exprData = Expression(exprData.operands.at(idxKey));
+ continue;
+ }
- assert(false && "Inappropriate key");
+ if (exprKey.__state == Expression::NUMBER) {
+ int key = exprKey.getValueDouble();
+ exprData = Expression(exprData.operands[key]);
+ continue;
}
- return exprData;
+ assert(false && "Inappropriate key");
}
- case Operator::FOLD: {
- const Expression& exprInput = process(expression.getOperands()[0]);
- const Expression& exprInit = process(expression.getOperands()[1]);
+ return exprData;
+ }
- const std::string& argEl = expression.bindings[0];
- const std::string& argAccum = expression.bindings[1];
+ case Operator::FOLD:
+ {
+ const Expression& exprInput = process(expression.getOperands()[0]);
+ const Expression& exprInit = process(expression.getOperands()[1]);
- InterpretationScope* body = function->getScope(expression.blocks.front());
+ const std::string& argEl = expression.bindings[0];
+ const std::string& argAccum = expression.bindings[1];
- Expression accum = exprInit;
- for(size_t size=exprInput.getOperands().size(), i=0; i<size; ++i){
- body->overrideBindings({
- {exprInput.getOperands()[i], argEl},
- {accum, argAccum}
- });
+ InterpretationScope* body = function->getScope(expression.blocks.front());
- accum = body->processScope();
- }
+ Expression accum = exprInit;
+ for(size_t size = exprInput.getOperands().size(), i = 0; i < size; ++i) {
+ body->overrideBindings({
+ {exprInput.getOperands()[i], argEl},
+ {accum, argAccum}
+ });
- return accum;
- }
+ accum = body->processScope();
+ }
- case Operator::LIST:
- case Operator::LIST_NAMED:
- case Operator::LIST_RANGE:
- {
- Expression result(expression.op,{});
- result.operands.resize(expression.operands.size());
- result.bindings=expression.bindings;
- result.__indexBindings=expression.__indexBindings;
+ return accum;
+ }
- int keyId=0;
- for(const Expression& opCurrent : expression.operands) {
- result.operands[keyId++]=process(opCurrent);
- }
+ case Operator::LIST:
+ case Operator::LIST_NAMED:
+ case Operator::LIST_RANGE:
+ {
+ Expression result(expression.op,{});
+ result.operands.resize(expression.operands.size());
+ result.bindings = expression.bindings;
+ result.__indexBindings = expression.__indexBindings;
+
+ int keyId = 0;
+ for(const Expression& opCurrent : expression.operands) {
+ result.operands[keyId++] = process(opCurrent);
+ }
- return result;
- }
+ return result;
+ }
-// case Operator::MAP: {
-// break;
-// }
+ // case Operator::MAP: {
+ // break;
+ // }
- default: break;
+ default: break;
}
return expression;
}
InterpretationFunction*
-TargetInterpretation::getFunction(IFunctionUnit* unit){
+TargetInterpretation::getFunction(IFunctionUnit* unit) {
if (__dictFunctionsByUnit.count(unit)) {
return __dictFunctionsByUnit.at(unit);
}
InterpretationFunction* f = new InterpretationFunction(unit->function, this);
__dictFunctionsByUnit.emplace(unit, f);
assert(__functions.emplace(unit->function.id(), f).second);
return f;
}
PIFunction*
-TargetInterpretation::getFunction(PIFSignature&& sig){
+TargetInterpretation::getFunction(PIFSignature&& sig) {
auto f = __pifunctions.find(sig);
- if (f != __pifunctions.end()){
+ if (f != __pifunctions.end()) {
return f->second;
}
PIFunction* result = new PIFunction(PIFSignature(sig), __pifunctions.size(), this);
__pifunctions.emplace(move(sig), result);
assert(__dictFunctionsByUnit.emplace(result->functionUnit, result).second);
return result;
}
InterpretationScope*
-TargetInterpretation::transformContext(const Context& c){
+TargetInterpretation::transformContext(const Context& c) {
return this->getFunction(c.function)->getScope(c.scope->scope);
}
llvm::Value*
-TargetInterpretation::compile(const Expression& expression, const Context& ctx){
+TargetInterpretation::compile(const Expression& expression, const Context& ctx) {
return transformContext(ctx)->compile(expression, ctx);
}
InterpretationFunction::InterpretationFunction(const ManagedFnPtr& function, Target<TargetInterpretation>* target)
- : Function<TargetInterpretation>(function, target)
-{}
+: Function<TargetInterpretation>(function, target) { }
Expression
-InterpretationFunction::process(const std::vector<Expression>& args){
+InterpretationFunction::process(const std::vector<Expression>& args) {
InterpretationScope* body = getScope(__function->__entry);
list<pair<Expression, string>> bindings;
- for(size_t i=0, size=args.size(); i<size; ++i) {
+ for(size_t i = 0, size = args.size(); i < size; ++i) {
bindings.push_back(make_pair(args.at(i), body->scope->__bindings.at(i)));
}
body->overrideBindings(bindings);
return body->processScope();
}
// Partial function interpretation
typedef BasicFunctionUnit PIFunctionUnitParent;
-class PIFunctionUnit : public PIFunctionUnitParent {
+class PIFunctionUnit : public PIFunctionUnitParent{
public:
PIFunctionUnit(ManagedFnPtr f, std::set<size_t>&& arguments, size_t id, CompilePass* p)
: PIFunctionUnitParent(f, p), argumentsActual(move(arguments)), __id(id) { }
protected:
- std::vector<llvm::Type*> prepareArguments(){
+
+ std::vector<llvm::Type*>
+ prepareArguments() {
LLVMLayer* llvm = PIFunctionUnitParent::pass->man->llvm;
AST* ast = PIFunctionUnitParent::pass->man->root;
CodeScope* entry = PIFunctionUnitParent::function->__entry;
std::vector<llvm::Type*> signature;
- for(size_t no: argumentsActual){
+ for(size_t no : argumentsActual) {
VNameId argId = entry->__identifiers.at(entry->__bindings.at(no));
ScopedSymbol arg{argId, versions::VERSION_NONE};
signature.push_back(llvm->toLLVMType(ast->expandType(entry->__declarations.at(arg).type)));
}
return signature;
}
- llvm::Function::arg_iterator prepareBindings(){
+ llvm::Function::arg_iterator
+ prepareBindings() {
CodeScope* entry = PIFunctionUnitParent::function->__entry;
ICodeScopeUnit* entryCompilation = PIFunctionUnitParent::getScopeUnit(entry);
llvm::Function::arg_iterator fargsI = PIFunctionUnitParent::raw->arg_begin();
- for(size_t no: argumentsActual){
+ for(size_t no : argumentsActual) {
ScopedSymbol arg{entry->__identifiers.at(entry->__bindings.at(no)), versions::VERSION_NONE};
entryCompilation->bindArg(&*fargsI, arg);
fargsI->setName(entry->__bindings.at(no));
++fargsI;
}
return fargsI;
}
- virtual std::string prepareName(){
+ virtual std::string
+ prepareName() {
return PIFunctionUnitParent::prepareName() + "_" + std::to_string(__id);
}
private:
std::set<size_t> argumentsActual;
size_t __id;
-};
+} ;
PIFunction::PIFunction(PIFSignature&& sig, size_t id, TargetInterpretation* target)
: InterpretationFunction(sig.declaration, target), signatureInstance(move(sig)) {
const FunctionInterpretationData& functionData = FunctionInterpretationHelper::getSignature(signatureInstance.declaration);
std::set<size_t> argumentsActual;
- for (size_t no=0, size=functionData.signature.size(); no < size; ++no){
- if (functionData.signature.at(no) != INTR_ONLY){
+ for (size_t no = 0, size = functionData.signature.size(); no < size; ++no) {
+ if (functionData.signature.at(no) != INTR_ONLY) {
argumentsActual.insert(no);
}
}
functionUnit = new PIFunctionUnit(signatureInstance.declaration, move(argumentsActual), id, target->pass);
CodeScope* entry = signatureInstance.declaration->__entry;
auto entryUnit = Decorators<CachedScopeDecoratorTag>::getInterface<>(functionUnit->getEntry());
InterpretationScope* entryIntrp = InterpretationFunction::getScope(entry);
list<pair<Expression, std::string>> bindingsPartial;
list<pair<Symbol, Expression>> declsPartial;
- for(size_t no=0, sigNo=0, size=entry->__bindings.size(); no<size; ++no) {
- if(functionData.signature.at(no)==INTR_ONLY){
+ for(size_t no = 0, sigNo = 0, size = entry->__bindings.size(); no < size; ++no) {
+ if(functionData.signature.at(no) == INTR_ONLY) {
bindingsPartial.push_back({signatureInstance.bindings[sigNo], entry->__bindings[no]});
- VNameId argId=entry->__identifiers.at(entry->__bindings[no]);
+ VNameId argId = entry->__identifiers.at(entry->__bindings[no]);
Symbol argSymbol{ScopedSymbol
{argId, versions::VERSION_NONE}, entry};
declsPartial.push_back({argSymbol, signatureInstance.bindings[sigNo]});
++sigNo;
}
}
entryIntrp->overrideBindings(bindingsPartial);
entryUnit->overrideDeclarations(declsPartial);
}
llvm::Function*
-PIFunction::compile(){
+PIFunction::compile() {
llvm::Function* raw = functionUnit->compile();
return raw;
}
-bool operator<(const PIFSignature& lhs, const PIFSignature& rhs){
+bool operator<(const PIFSignature& lhs, const PIFSignature& rhs) {
if (lhs.declaration.id() != rhs.declaration.id()) {
return lhs.declaration.id() < rhs.declaration.id();
}
return lhs.bindings < rhs.bindings;
}
-bool operator<(const PIFSignature& lhs, PIFunction* const rhs){
+bool operator<(const PIFSignature& lhs, PIFunction * const rhs) {
return lhs < rhs->signatureInstance;
}
-bool operator<(PIFunction* const lhs, const PIFSignature& rhs){
+bool operator<(PIFunction * const lhs, const PIFSignature& rhs) {
return lhs->signatureInstance < rhs;
}
-}}
+}
+}
/** \class xreate::interpretation::InterpretationFunction
*
* Holds list of xreate::interpretation::InterpretationScope 's focused on interpretation of individual code scopes
*
* There is particulat subclass PIFunction intended to represent partially interpreted functions
*\sa TargetInterpretation, [Interpretation Concept](/w/concepts/dfa)
*/
/** \class xreate::interpretation::TargetInterpretation
*
* Executed during compilation and intented to preprocess eligible parts of code.
* Established on [Targets Infrastructure](\ref compilation::Target)
*
* Holds list of InterpretationFunction / PIFunction to represent interpretation process for individual functions
*
* In order to be activated during compilation process there is
* InterpretationScopeDecorator implementation of ICodeScopeUnit
* \sa InterpretationPass, compilation::Target, [Interpretation Concept](/w/concepts/dfa)
*
*/
diff --git a/cpp/src/compilation/targetinterpretation.h b/cpp/src/compilation/targetinterpretation.h
index ad9db20..867b2f4 100644
--- a/cpp/src/compilation/targetinterpretation.h
+++ b/cpp/src/compilation/targetinterpretation.h
@@ -1,130 +1,130 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* File: targetstatic.h
* Author: pgess <v.melnychenko@xreate.org>
*
* Created on July 2, 2016, 1:25 PM
*/
#ifndef TARGETSTATIC_H
#define TARGETSTATIC_H
#include "ast.h"
#include "pass/compilepass.h"
#include "compilation/targets.h"
#include "pass/interpretationpass.h"
#include "transcendlayer.h"
namespace xreate{ namespace interpretation{
class TargetInterpretation;
class InterpretationScope;
class InterpretationFunction;
}}
namespace xreate{ namespace compilation{
template <>
struct TargetInfo<interpretation::TargetInterpretation> {
typedef Expression Result;
typedef interpretation::InterpretationScope Scope;
typedef interpretation::InterpretationFunction Function;
};
}}
namespace xreate{ namespace interpretation{
/** \brief Encapsulates interpretation of a single Code Scope */
class InterpretationScope: public compilation::Scope<TargetInterpretation>{
typedef Scope<TargetInterpretation> Parent;
public:
InterpretationScope(const CodeScope* scope, compilation::Function<TargetInterpretation>* f): Parent(scope, f) {}
Expression process(const Expression& expression) override;
llvm::Value* compile(const Expression& expression, const compilation::Context& context);
private:
- llvm::Value* compileHybrid(const InterpretationOperator& op, const Expression& expression, const compilation::Context& context);
+ llvm::Value* processLate(const InterpretationOperator& op, const Expression& expression, const compilation::Context& context);
//llvm::Value* compilePartialFnCall(const Expression& expression, const Context& context);
CodeScope* processOperatorIf(const Expression& expression);
CodeScope* processOperatorSwitch(const Expression& expression);
CodeScope* processOperatorSwitchVariant(const Expression& expression);
};
/** \brief Encapsulates interpretation of a single %Function */
class InterpretationFunction: public compilation::Function<TargetInterpretation>{
public:
InterpretationFunction(const ManagedFnPtr& function, compilation::Target<TargetInterpretation>* target);
Expression process(const std::vector<Expression>& args);
};
/** \brief Signature of a partially interpreted function */
struct PIFSignature{
ManagedFnPtr declaration;
std::vector<Expression> bindings;
};
class PIFunctionUnit;
/** \brief Partially interpreted function */
class PIFunction: public InterpretationFunction{
public:
PIFunctionUnit* functionUnit;
PIFSignature signatureInstance;
PIFunction(PIFSignature&& sig, size_t id, TargetInterpretation* target);
llvm::Function* compile();
};
bool operator<(const PIFSignature& lhs, PIFunction* const rhs);
bool operator<(PIFunction* const lhs, const PIFSignature& rhs);
/** \brief Encapsulates actual [Interpretation](/w/concepts/dfa) based on InterpretationPass analysis results */
class TargetInterpretation: public compilation::Target<TargetInterpretation>{
public:
TargetInterpretation(AST* root, CompilePass* passCompilation): Target<TargetInterpretation>(root), pass(passCompilation){}
//target:
public:
InterpretationFunction* getFunction(compilation::IFunctionUnit* unit);
PIFunction* getFunction(PIFSignature&& sig);
private:
std::map<PIFSignature, PIFunction*> __pifunctions;
std::map<compilation::IFunctionUnit*, InterpretationFunction*> __dictFunctionsByUnit;
//self:
public:
CompilePass* pass;
llvm::Value* compile(const Expression& expression, const compilation::Context& ctx);
InterpretationScope* transformContext(const compilation::Context& c);
private:
};
/**\brief Interpretation-aware Code Scope decorator
* \extends xreate::compilation::ICodeScopeUnit
*/
template<class Parent>
class InterpretationScopeDecorator: public Parent{
public:
InterpretationScopeDecorator(const CodeScope* const codeScope, compilation::IFunctionUnit* f, CompilePass* compilePass): Parent(codeScope, f, compilePass){}
virtual llvm::Value* process(const Expression& expr, const std::string& hintVarDecl){
const InterpretationData& data = Attachments::get<InterpretationData>(expr, {ANY, NONE});
bool flagInterpretationEligible = (data.resolution == INTR_ONLY || data.op != InterpretationOperator::NONE);
if (flagInterpretationEligible){
compilation::Context ctx{this, this->function, this->pass};
return Parent::pass->targetInterpretation->compile(expr, ctx);
}
return Parent::process(expr, hintVarDecl);
}
};
}} //end of xreate:: interpretation
#endif /* TARGETSTATIC_H */
\ No newline at end of file
diff --git a/cpp/src/llvmlayer.cpp b/cpp/src/llvmlayer.cpp
index 5b59ffa..eb4228b 100644
--- a/cpp/src/llvmlayer.cpp
+++ b/cpp/src/llvmlayer.cpp
@@ -1,244 +1,244 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* llvmlayer.cpp
*
* Author: pgess <v.melnychenko@xreate.org>
*/
/**
* \file llvmlayer.h
* \brief Wrapper over LLVM
*/
#include "ast.h"
#include "llvmlayer.h"
#include "ExternLayer.h"
#include "llvm/ExecutionEngine/ExecutionEngine.h"
#include "llvm/ExecutionEngine/MCJIT.h"
#include "llvm/Support/TargetSelect.h"
#include <iostream>
#include <cmath>
using namespace llvm;
using namespace xreate;
using namespace std;
LLVMLayer::LLVMLayer(AST* root)
: llvmContext(),
builder(llvmContext),
ast(root),
module(new llvm::Module(root->getModuleName(), llvmContext)) {
layerExtern = new ExternLayer(this);
layerExtern->init(root);
}
void*
LLVMLayer::getFunctionPointer(llvm::Function* function) {
uint64_t entryAddr = jit->getFunctionAddress(function->getName().str());
return (void*) entryAddr;
}
void
LLVMLayer::initJit() {
std::string ErrStr;
LLVMInitializeNativeTarget();
llvm::InitializeNativeTargetAsmPrinter();
llvm::EngineBuilder builder(std::unique_ptr<llvm::Module>(module.release()));
jit.reset(builder
.setEngineKind(llvm::EngineKind::JIT)
.setErrorStr(&ErrStr)
.setVerifyModules(true)
.create()
);
}
void
LLVMLayer::print() {
llvm::PassManager<llvm::Module> PM;
PM.addPass(llvm::PrintModulePass(llvm::outs(), "banner"));
llvm::AnalysisManager<llvm::Module> aman;
PM.run(*module.get(), aman);
}
void
LLVMLayer::moveToGarbage(void *o) {
__garbage.push_back(o);
}
llvm::Type*
LLVMLayer::toLLVMType(const ExpandedType& ty) const {
std::map<int, llvm::StructType*> empty;
return toLLVMType(ty, empty);
}
llvm::Type*
LLVMLayer::toLLVMType(const ExpandedType& ty, std::map<int, llvm::StructType*>& conjuctions) const {
TypeAnnotation t = ty;
switch (t.__operator) {
case TypeOperator::LIST:
{
assert(t.__operands.size() == 1);
TypeAnnotation elTy = t.__operands.at(0);
return llvm::ArrayType::get(toLLVMType(ExpandedType(move(elTy)), conjuctions), t.__size);
}
case TypeOperator::LIST_NAMED:
{
std::vector<llvm::Type*> pack_;
pack_.reserve(t.__operands.size());
std::transform(t.__operands.begin(), t.__operands.end(), std::inserter(pack_, pack_.end()),
[this, &conjuctions](const TypeAnnotation & t) {
return toLLVMType(ExpandedType(TypeAnnotation(t)), conjuctions);
});
llvm::ArrayRef<llvm::Type*> pack(pack_);
//process recursive types:
if (conjuctions.count(t.conjuctionId)) {
auto result = conjuctions[t.conjuctionId];
result->setBody(pack, false);
return result;
}
return llvm::StructType::get(llvmContext, pack, false);
};
case TypeOperator::LINK:
{
llvm::StructType* conjuction = llvm::StructType::create(llvmContext);
int id = t.conjuctionId;
conjuctions.emplace(id, conjuction);
return conjuction;
};
case TypeOperator::CALL:
{
assert(false);
};
case TypeOperator::CUSTOM:
{
//Look in extern types
clang::QualType qt = layerExtern->lookupType(t.__valueCustom);
return layerExtern->toLLVMType(qt);
};
//DEBT omit ID field in case of single variant.
case TypeOperator::VARIANT:
{
/* Variant Type Layout:
* {
* id :: i8, Holds stored variant id
* storage:: type of biggest variant
* }
*/
uint64_t sizeStorage = 0;
llvm::Type* typStorageRaw = llvm::Type::getVoidTy(llvmContext);
for(const TypeAnnotation& subtype : t.__operands) {
llvm::Type* subtypeRaw = toLLVMType(ExpandedType(subtype), conjuctions);
if (subtypeRaw->isVoidTy()) continue;
uint64_t sizeSubtype = module->getDataLayout().getTypeStoreSize(subtypeRaw);
if (sizeSubtype > sizeStorage) {
sizeStorage = sizeSubtype;
typStorageRaw = subtypeRaw;
}
}
std::vector<llvm::Type*> layout;
layout.push_back(llvm::Type::getInt8Ty(llvmContext)); //id
const bool flagHoldsData = sizeStorage > 0;
if (flagHoldsData) {
layout.push_back(typStorageRaw); //storage
}
-
+
return llvm::StructType::get(llvmContext, llvm::ArrayRef<llvm::Type*>(layout));
}
case TypeOperator::NONE:
{
switch (t.__value) {
case TypePrimitive::I32:
case TypePrimitive::Int:
case TypePrimitive::Num:
return llvm::Type::getInt32Ty(llvmContext);
case TypePrimitive::Bool:
return llvm::Type::getInt1Ty(llvmContext);
case TypePrimitive::I8:
return llvm::Type::getInt8Ty(llvmContext);
case TypePrimitive::I64:
return llvm::Type::getInt64Ty(llvmContext);
case TypePrimitive::Float:
return llvm::Type::getDoubleTy(llvmContext);
case TypePrimitive::String:
return llvm::Type::getInt8PtrTy(llvmContext);
case TypePrimitive::Invalid:
return llvm::Type::getVoidTy(llvmContext);
default:
assert(false);
}
}
default:
assert(false);
}
assert(false);
return nullptr;
}
bool
TypeUtils::isStruct(const ExpandedType& ty) {
const TypeAnnotation& t = ty.get();
if (t.__operator == TypeOperator::LIST_NAMED) {
return true;
}
if (t.__operator != TypeOperator::CUSTOM) {
return false;
}
clang::QualType tqual = llvm->layerExtern->lookupType(t.__valueCustom);
const clang::Type * raw = tqual.getTypePtr();
// TODO skip ALL the pointers until non-pointer type found
if (raw->isStructureType()) return true;
if (!raw->isAnyPointerType()) return false;
clang::QualType pointee = raw->getPointeeType();
return pointee->isStructureType();
}
bool
TypeUtils::isPointer(const ExpandedType &ty) {
if (ty.get().__operator != TypeOperator::CUSTOM) return false;
clang::QualType qt = llvm->layerExtern->lookupType(ty.get().__valueCustom);
return llvm->layerExtern->isPointer(qt);
}
std::vector<std::string>
TypeUtils::getStructFields(const ExpandedType &t) {
return (t.get().__operator == TypeOperator::LIST_NAMED)
? t.get().fields
: llvm->layerExtern->getStructFields(
llvm->layerExtern->lookupType(t.get().__valueCustom));
}
diff --git a/cpp/src/pass/compilepass.cpp b/cpp/src/pass/compilepass.cpp
index 9d011d6..4ca0142 100644
--- a/cpp/src/pass/compilepass.cpp
+++ b/cpp/src/pass/compilepass.cpp
@@ -1,717 +1,737 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Author: pgess <v.melnychenko@xreate.org>
*
* compilepass.cpp
*/
/**
* \file compilepass.h
* \brief Compilation pass
*/
#include "compilepass.h"
#include "transcendlayer.h"
#include <ast.h>
#include "llvmlayer.h"
#include "query/containers.h"
#include "compilation/containers.h"
#include "ExternLayer.h"
#include "compilation/targetinterpretation.h"
#include "pass/versionspass.h"
#include "compilation/scopedecorators.h"
#include "compilation/operators.h"
+#include "compilation/latex.h"
#include "analysis/typeinference.h"
#include <boost/optional.hpp>
#include <memory>
#include <iostream>
using namespace std;
using namespace llvm;
-namespace xreate { namespace compilation{
+namespace xreate{
+namespace compilation{
std::string
-BasicFunctionUnit::prepareName(){
+BasicFunctionUnit::prepareName() {
AST* ast = IFunctionUnit::pass->man->root;
string name = ast->getFunctionSpecializations(IFunctionUnit::function->__name).size() > 1 ?
- IFunctionUnit::function->__name + std::to_string(IFunctionUnit::function.id()) :
- IFunctionUnit::function->__name;
+ IFunctionUnit::function->__name + std::to_string(IFunctionUnit::function.id()) :
+ IFunctionUnit::function->__name;
return name;
}
std::vector<llvm::Type*>
BasicFunctionUnit::prepareSignature() {
LLVMLayer* llvm = IFunctionUnit::pass->man->llvm;
AST* ast = IFunctionUnit::pass->man->root;
CodeScope* entry = IFunctionUnit::function->__entry;
std::vector<llvm::Type*> signature;
std::transform(entry->__bindings.begin(), entry->__bindings.end(), std::inserter(signature, signature.end()),
- [llvm, ast, entry](const std::string & arg)->llvm::Type* {
- assert(entry->__identifiers.count(arg));
+ [llvm, ast, entry](const std::string & arg)->llvm::Type* {
+ assert(entry->__identifiers.count(arg));
- ScopedSymbol argid{entry->__identifiers.at(arg), versions::VERSION_NONE};
- return llvm->toLLVMType(ast->expandType(entry->__declarations.at(argid).type));
- });
+ ScopedSymbol argid{entry->__identifiers.at(arg), versions::VERSION_NONE};
+ return llvm->toLLVMType(ast->expandType(entry->__declarations.at(argid).type));
+ });
return signature;
}
llvm::Type*
BasicFunctionUnit::prepareResult() {
LLVMLayer* llvm = IFunctionUnit::pass->man->llvm;
AST* ast = IFunctionUnit::pass->man->root;
CodeScope* entry = IFunctionUnit::function->__entry;
return llvm->toLLVMType(ast->expandType(entry->__declarations.at(ScopedSymbol::RetSymbol).type));
}
llvm::Function::arg_iterator
BasicFunctionUnit::prepareBindings() {
CodeScope* entry = IFunctionUnit::function->__entry;
ICodeScopeUnit* entryCompilation = IFunctionUnit::getScopeUnit(entry);
llvm::Function::arg_iterator fargsI = IFunctionUnit::raw->arg_begin();
for (std::string &arg : entry->__bindings) {
ScopedSymbol argid{entry->__identifiers[arg], versions::VERSION_NONE};
entryCompilation->bindArg(&*fargsI, argid);
fargsI->setName(arg);
++fargsI;
}
return fargsI;
}
- //DEBT compiler rigidly depends on exact definition of DefaultFunctionUnit
-typedef BasicFunctionUnit BruteFunctionDefault;
+//DEBT compiler rigidly depends on exact definition of DefaultFunctionUnit
+typedef latex::LatexBruteFunctionDecorator<
+ compilation::BasicFunctionUnit>
-ICodeScopeUnit::ICodeScopeUnit(const CodeScope* const codeScope, IFunctionUnit* f, CompilePass* compilePass)
-: pass(compilePass), function(f), scope(codeScope), currentBlockRaw(nullptr) {
-}
+ BruteFunctionDefault;
+
+ICodeScopeUnit::ICodeScopeUnit(const CodeScope * const codeScope, IFunctionUnit* f, CompilePass* compilePass)
+: pass(compilePass), function(f), scope(codeScope), currentBlockRaw(nullptr) { }
llvm::Value*
RawFnInvocation::operator()(std::vector<llvm::Value *>&& args, const std::string& hintDecl) {
llvm::Function* calleeInfo = dyn_cast<llvm::Function>(__callee);
if (calleeInfo) {
auto argsFormal = calleeInfo->args();
-
- int pos = 0;
- //SECTIONTAG types/convert function ret value
- for (auto argFormal = argsFormal.begin(); argFormal != argsFormal.end(); ++argFormal, ++pos) {
- args[pos] = typeinference::doAutomaticTypeConversion(args[pos], argFormal->getType(), llvm->builder);
+ size_t sizeArgsF = std::distance(argsFormal.begin(), argsFormal.end());
+ assert(args.size() >= sizeArgsF);
+ assert(calleeInfo->isVarArg() || args.size() == sizeArgsF);
+
+ auto argFormal = argsFormal.begin();
+ for(size_t argId = 0; argId < args.size(); ++argId){
+ if(argFormal != argsFormal.end()){
+ args[argId] = typeinference::doAutomaticTypeConversion(
+ args.at(argId), argFormal->getType(), llvm->builder);
+ ++argFormal;
+ }
}
}
//Do not name function call that returns Void.
std::string nameStatement = hintDecl;
- if (calleeInfo->getReturnType()->isVoidTy()){
+ if (calleeInfo->getReturnType()->isVoidTy()) {
nameStatement.clear();
}
return llvm->builder.CreateCall(__calleeTy, __callee, args, nameStatement);
}
- //DESABLEDFEATURE implement inlining
-class CallStatementInline : public IFnInvocation {
+//DESABLEDFEATURE implement inlining
+
+class CallStatementInline : public IFnInvocation{
public:
+
CallStatementInline(IFunctionUnit* caller, IFunctionUnit* callee, LLVMLayer* l)
- : __caller(caller), __callee(callee), llvm(l) {
- }
+ : __caller(caller), __callee(callee), llvm(l) { }
llvm::Value* operator()(std::vector<llvm::Value *>&& args, const std::string& hintDecl) {
//TOTEST inlining
// CodeScopeUnit* entryCompilation = outer->getScopeUnit(function->__entry);
// for(int i=0, size = args.size(); i<size; ++i) {
// entryCompilation->bindArg(args.at(i), string(entryCompilation->scope->__bindings.at(i)));
// }
//
//
// return entryCompilation->compile();
return nullptr;
}
private:
IFunctionUnit* __caller;
IFunctionUnit* __callee;
LLVMLayer* llvm;
- bool isInline() {
+ bool
+ isInline() {
// Symbol ret = Symbol{0, function->__entry};
// bool flagOnTheFly = SymbolAttachments::get<IsImplementationOnTheFly>(ret, false);
//TODO consider inlining
return false;
}
-};
+} ;
-BasicCodeScopeUnit::BasicCodeScopeUnit(const CodeScope* const codeScope, IFunctionUnit* f, CompilePass* compilePass)
-: ICodeScopeUnit(codeScope, f, compilePass) {
-}
+BasicCodeScopeUnit::BasicCodeScopeUnit(const CodeScope * const codeScope, IFunctionUnit* f, CompilePass* compilePass)
+: ICodeScopeUnit(codeScope, f, compilePass) { }
llvm::Value*
BasicCodeScopeUnit::processSymbol(const Symbol& s, std::string hintRetVar) {
Expression declaration = CodeScope::getDefinition(s);
- const CodeScope* scope = s.scope;
- ICodeScopeUnit* scopeExternal = ICodeScopeUnit::function->getScopeUnit(scope);
-
+ const CodeScope* scopeExternal = s.scope;
+ ICodeScopeUnit* scopeBruteExternal = ICodeScopeUnit::function->getScopeUnit(scopeExternal);
+ assert(scopeBruteExternal->currentBlockRaw);
+
llvm::Value* resultRaw;
- if (scopeExternal == this){
- resultRaw = process(declaration, hintRetVar);
- currentBlockRaw = pass->man->llvm->builder.GetInsertBlock();
+ llvm::BasicBlock* blockOwn = pass->man->llvm->builder.GetInsertBlock();
+
+ if (scopeBruteExternal->currentBlockRaw == blockOwn) {
+ resultRaw = scopeBruteExternal->process(declaration, hintRetVar);
+ scopeBruteExternal->currentBlockRaw = currentBlockRaw =
+ pass->man->llvm->builder.GetInsertBlock();
} else {
- assert(scopeExternal->currentBlockRaw);
-
- llvm::BasicBlock* blockOwn = pass->man->llvm->builder.GetInsertBlock();
- pass->man->llvm->builder.SetInsertPoint(scopeExternal->currentBlockRaw);
- resultRaw = scopeExternal->processSymbol(s, hintRetVar);
+ pass->man->llvm->builder.SetInsertPoint(scopeBruteExternal->currentBlockRaw);
+ resultRaw = scopeBruteExternal->processSymbol(s, hintRetVar);
pass->man->llvm->builder.SetInsertPoint(blockOwn);
}
return resultRaw;
}
IFnInvocation*
BasicCodeScopeUnit::findFunction(const Expression& opCall) {
const std::string& calleeName = opCall.getValueString();
LLVMLayer* llvm = pass->man->llvm;
const std::list<ManagedFnPtr>& specializations = pass->man->root->getFunctionSpecializations(calleeName);
//if no specializations registered - check external function
if (specializations.size() == 0) {
llvm::Function* external = llvm->layerExtern->lookupFunction(calleeName);
llvm::outs() << "Debug/External function: " << calleeName;
external->getType()->print(llvm::outs(), true);
llvm::outs() << "\n";
return new RawFnInvocation(external, llvm);
}
//There should be only one specialization without any valid guards at this point
return new RawFnInvocation(pass->getFunctionUnit(
pass->man->root->findFunction(calleeName))->compile(),
llvm);
}
//DISABLEDFEATURE transformations
// if (pass->transformations->isAcceptable(expr)){
// return pass->transformations->transform(expr, result, ctx);
// }
llvm::Value*
BasicCodeScopeUnit::process(const Expression& expr, const std::string& hintVarDecl) {
- #define DEFAULT(x) (hintVarDecl.empty()? x: hintVarDecl)
+#define DEFAULT(x) (hintVarDecl.empty()? x: hintVarDecl)
llvm::Value *left;
llvm::Value *right;
LLVMLayer& l = *pass->man->llvm;
xreate::compilation::AdvancedInstructions instructions = xreate::compilation::AdvancedInstructions({this, function, pass});
switch (expr.op) {
- case Operator::SUB: case Operator::MUL:
- case Operator::DIV: case Operator::EQU: case Operator::LSS:
- case Operator::GTR: case Operator::NE: case Operator::LSE:
- case Operator::GTE:
-
- assert(expr.__state == Expression::COMPOUND);
- assert(expr.operands.size() == 2);
+ case Operator::SUB: case Operator::MUL:
+ case Operator::DIV: case Operator::EQU: case Operator::LSS:
+ case Operator::GTR: case Operator::NE: case Operator::LSE:
+ case Operator::GTE:
+ assert(expr.__state == Expression::COMPOUND);
+ assert(expr.operands.size() == 2);
- left = process(expr.operands[0]);
- right = process(expr.operands[1]);
+ left = process(expr.operands[0]);
+ right = process(expr.operands[1]);
- //SECTIONTAG types/convert binary operation
- right = typeinference::doAutomaticTypeConversion(right, left->getType(), l.builder);
- break;
+ break;
- default:;
+ default:;
}
switch (expr.op) {
- case Operator::ADD:
- {
- left = process(expr.operands[0]);
- Context context{this, function, pass};
-
- llvm::Value* resultSU = StructUpdate::add(expr.operands[0], left, expr.operands[1], context, DEFAULT("tmp_add"));
- if (resultSU) return resultSU;
+ case Operator::ADD:
+ {
+ left = process(expr.operands[0]);
+ Context context{this, function, pass};
- right = process(expr.operands[1]);
+ llvm::Value* resultSU = StructUpdate::add(expr.operands[0], left, expr.operands[1], context, DEFAULT("tmp_add"));
+ if (resultSU) return resultSU;
- llvm::Value* resultAddPA = pointerarithmetic::PointerArithmetic::add(left, right, context, DEFAULT("tmp_add"));
- if (resultAddPA) {
- return resultAddPA;
- }
+ right = process(expr.operands[1]);
- return l.builder.CreateAdd(left, right, DEFAULT("tmp_add"));
- break;
+ llvm::Value* resultAddPA = pointerarithmetic::PointerArithmetic::add(left, right, context, DEFAULT("tmp_add"));
+ if (resultAddPA) {
+ return resultAddPA;
}
- case Operator::SUB:
- return l.builder.CreateSub(left, right, DEFAULT("tmp_sub"));
- break;
-
- case Operator::MUL:
- return l.builder.CreateMul(left, right, DEFAULT("tmp_mul"));
- break;
-
- case Operator::DIV:
- return l.builder.CreateSDiv(left, right, DEFAULT("tmp_div"));
- break;
-
- case Operator::EQU:
- if (left->getType()->isIntegerTy()) return l.builder.CreateICmpEQ(left, right, DEFAULT("tmp_equ"));
- if (left->getType()->isFloatingPointTy()) return l.builder.CreateFCmpOEQ(left, right, DEFAULT("tmp_equ"));
- break;
+ return l.builder.CreateAdd(left, right, DEFAULT("tmp_add"));
+ break;
+ }
- case Operator::NE:
- return l.builder.CreateICmpNE(left, right, DEFAULT("tmp_ne"));
- break;
+ case Operator::SUB:
+ return l.builder.CreateSub(left, right, DEFAULT("tmp_sub"));
+ break;
+
+ case Operator::MUL:
+ return l.builder.CreateMul(left, right, DEFAULT("tmp_mul"));
+ break;
+
+ case Operator::DIV:
+ return l.builder.CreateSDiv(left, right, DEFAULT("tmp_div"));
+ break;
+
+ case Operator::EQU:
+ if (left->getType()->isIntegerTy()) return l.builder.CreateICmpEQ(left, right, DEFAULT("tmp_equ"));
+ if (left->getType()->isFloatingPointTy()) return l.builder.CreateFCmpOEQ(left, right, DEFAULT("tmp_equ"));
+ break;
+
+ case Operator::NE:
+ return l.builder.CreateICmpNE(left, right, DEFAULT("tmp_ne"));
+ break;
+
+ case Operator::LSS:
+ return l.builder.CreateICmpSLT(left, right, DEFAULT("tmp_lss"));
+ break;
+
+ case Operator::LSE:
+ return l.builder.CreateICmpSLE(left, right, DEFAULT("tmp_lse"));
+ break;
+
+ case Operator::GTR:
+ return l.builder.CreateICmpSGT(left, right, DEFAULT("tmp_gtr"));
+ break;
+
+ case Operator::GTE:
+ return l.builder.CreateICmpSGE(left, right, DEFAULT("tmp_gte"));
+ break;
+
+ case Operator::NEG:
+ left = process(expr.operands[0]);
+ return l.builder.CreateNeg(left, DEFAULT("tmp_neg"));
+ break;
+
+ case Operator::CALL:
+ {
+ assert(expr.__state == Expression::COMPOUND);
+ shared_ptr<IFnInvocation> callee(findFunction(expr));
+ const std::string& nameCallee = expr.getValueString();
+
+ //prepare arguments
+ std::vector<llvm::Value *> args;
+ args.reserve(expr.operands.size());
+
+ std::transform(expr.operands.begin(), expr.operands.end(), std::inserter(args, args.end()),
+ [this](const Expression & operand) {
+ return process(operand);
+ }
+ );
- case Operator::LSS:
- return l.builder.CreateICmpSLT(left, right, DEFAULT("tmp_lss"));
- break;
+ return (*callee)(move(args), DEFAULT("res_" + nameCallee));
+ }
- case Operator::LSE:
- return l.builder.CreateICmpSLE(left, right, DEFAULT("tmp_lse"));
- break;
+ case Operator::IF:
+ {
+ return instructions.compileIf(expr, DEFAULT("tmp_if"));
+ }
- case Operator::GTR:
- return l.builder.CreateICmpSGT(left, right, DEFAULT("tmp_gtr"));
- break;
+ case Operator::SWITCH:
+ {
+ return instructions.compileSwitch(expr, DEFAULT("tmp_switch"));
+ }
- case Operator::GTE:
- return l.builder.CreateICmpSGE(left, right, DEFAULT("tmp_gte"));
- break;
+ case Operator::LOGIC_AND:
+ {
+ assert(expr.operands.size() == 1);
+ return process(expr.operands[0]);
+ }
- case Operator::NEG:
- left = process(expr.operands[0]);
- return l.builder.CreateNeg(left, DEFAULT("tmp_neg"));
- break;
+ case Operator::LIST:
+ {
+ return instructions.compileListAsSolidArray(expr, DEFAULT("tmp_list"));
+ };
- case Operator::CALL:
- {
- assert(expr.__state == Expression::COMPOUND);
- shared_ptr<IFnInvocation> callee(findFunction(expr));
- const std::string& nameCallee = expr.getValueString();
+ case Operator::LIST_RANGE:
+ {
+ assert(false); //no compilation phase for a range list
+ // return InstructionList(this).compileConstantArray(expr, l, hintRetVar);
+ };
- //prepare arguments
- std::vector<llvm::Value *> args;
- args.reserve(expr.operands.size());
+ case Operator::LIST_NAMED:
+ {
+ typedef Expanded<TypeAnnotation> ExpandedType;
- std::transform(expr.operands.begin(), expr.operands.end(), std::inserter(args, args.end()),
- [this](const Expression & operand) {
- return process(operand);
- }
- );
+ ExpandedType tyStructLiteral = l.ast->getType(expr);
- return (*callee)(move(args), DEFAULT("res_" + nameCallee));
- }
+ const std::vector<string> fieldsFormal = (tyStructLiteral.get().__operator == TypeOperator::CUSTOM) ?
+ l.layerExtern->getStructFields(l.layerExtern->lookupType(tyStructLiteral.get().__valueCustom))
+ : tyStructLiteral.get().fields;
- case Operator::IF:
- {
- return instructions.compileIf(expr, DEFAULT("tmp_if"));
+ std::map<std::string, size_t> indexFields;
+ for (size_t i = 0, size = fieldsFormal.size(); i < size; ++i) {
+ indexFields.emplace(fieldsFormal[i], i);
}
- case Operator::SWITCH:
- {
- return instructions.compileSwitch(expr, DEFAULT("tmp_switch"));
- }
+ llvm::StructType* tyLiteralRaw = llvm::cast<llvm::StructType>(l.toLLVMType(tyStructLiteral));
+ llvm::Value* record = llvm::UndefValue::get(tyLiteralRaw);
- case Operator::LOGIC_AND:
- {
- assert(expr.operands.size() == 1);
- return process(expr.operands[0]);
+ for (size_t i = 0; i < expr.operands.size(); ++i) {
+ const Expression& operand = expr.operands.at(i);
+ unsigned int fieldId = indexFields.at(expr.bindings.at(i));
+ llvm::Value* result = process(operand);
+ assert(result);
+ record = l.builder.CreateInsertValue(record, result, llvm::ArrayRef<unsigned>({fieldId}));
}
- case Operator::LIST:
- {
- return instructions.compileListAsSolidArray(expr, DEFAULT("tmp_list"));
- };
-
- case Operator::LIST_RANGE:
- {
- assert(false); //no compilation phase for a range list
- // return InstructionList(this).compileConstantArray(expr, l, hintRetVar);
- };
-
- case Operator::LIST_NAMED:
- {
- typedef Expanded<TypeAnnotation> ExpandedType;
+ return record;
+ };
- ExpandedType tyStructLiteral = l.ast->getType(expr);
+ case Operator::MAP:
+ {
+ assert(expr.blocks.size());
+ return instructions.compileMapSolidOutput(expr, DEFAULT("map"));
+ };
- const std::vector<string> fieldsFormal = (tyStructLiteral.get().__operator == TypeOperator::CUSTOM) ?
- l.layerExtern->getStructFields(l.layerExtern->lookupType(tyStructLiteral.get().__valueCustom))
- : tyStructLiteral.get().fields;
+ case Operator::FOLD:
+ {
+ return instructions.compileFold(expr, DEFAULT("fold"));
+ };
- std::map<std::string, size_t> indexFields;
- for (size_t i = 0, size = fieldsFormal.size(); i < size; ++i) {
- indexFields.emplace(fieldsFormal[i], i);
- }
+ case Operator::FOLD_INF:
+ {
+ return instructions.compileFoldInf(expr, DEFAULT("fold"));
+ };
- llvm::StructType* tyLiteralRaw = llvm::cast<llvm::StructType>(l.toLLVMType(tyStructLiteral));
- llvm::Value* record = llvm::UndefValue::get(tyLiteralRaw);
+ case Operator::INDEX:
+ {
+ //TASK allow multiindex compilation
+ assert(expr.operands.size() == 2);
+ assert(expr.operands[0].__state == Expression::IDENT);
- for (size_t i = 0; i < expr.operands.size(); ++i) {
- const Expression& operand = expr.operands.at(i);
- unsigned int fieldId = indexFields.at(expr.bindings.at(i));
- llvm::Value* result = process(operand);
- assert(result);
- record = l.builder.CreateInsertValue(record, result, llvm::ArrayRef<unsigned>({fieldId}));
- }
+ const std::string& hintIdent = expr.operands[0].getValueString();
+ Symbol s = Attachments::get<IdentifierSymbol>(expr.operands[0]);
+ const ExpandedType& t2 = pass->man->root->getType(expr.operands[0]);
- return record;
- };
+ llvm::Value* aggr = processSymbol(s, hintIdent);
- case Operator::MAP:
+ switch (t2.get().__operator) {
+ case TypeOperator::LIST_NAMED: case TypeOperator::CUSTOM:
{
- assert(expr.blocks.size());
- return instructions.compileMapSolidOutput(expr, DEFAULT("map"));
- };
+ std::string idxField;
+ const Expression& idx = expr.operands.at(1);
+ switch (idx.__state) {
+
+ //named struct field
+ case Expression::STRING:
+ idxField = idx.getValueString();
+ break;
+
+ //anonymous struct field
+ case Expression::NUMBER:
+ idxField = to_string((int) idx.getValueDouble());
+ break;
+
+ default:
+ assert(false && "Wrong index for a struct");
+ }
- case Operator::FOLD:
- {
- return instructions.compileFold(expr, DEFAULT("fold"));
+ return instructions.compileStructIndex(aggr, t2, idxField);
};
- case Operator::FOLD_INF:
+ case TypeOperator::LIST:
{
- return instructions.compileFoldInf(expr, DEFAULT("fold"));
- };
+ std::vector<llvm::Value*> indexes;
+ std::transform(++expr.operands.begin(), expr.operands.end(), std::inserter(indexes, indexes.end()),
+ [this] (const Expression & op) {
+ return process(op);
+ }
+ );
- case Operator::INDEX:
- {
- //TASK allow multiindex compilation
- assert(expr.operands.size() == 2);
- assert(expr.operands[0].__state == Expression::IDENT);
-
- const std::string& hintIdent = expr.operands[0].getValueString();
- Symbol s = Attachments::get<IdentifierSymbol>(expr.operands[0]);
- const ExpandedType& t2 = pass->man->root->getType(expr.operands[0]);
-
- llvm::Value* aggr = processSymbol(s, hintIdent);
-
- switch (t2.get().__operator) {
- case TypeOperator::LIST_NAMED: case TypeOperator::CUSTOM:
- {
- std::string idxField;
- const Expression& idx = expr.operands.at(1);
- switch (idx.__state) {
-
- //named struct field
- case Expression::STRING:
- idxField = idx.getValueString();
- break;
-
- //anonymous struct field
- case Expression::NUMBER:
- idxField = to_string((int) idx.getValueDouble());
- break;
-
- default:
- assert(false && "Wrong index for a struct");
- }
-
- return instructions.compileStructIndex(aggr, t2, idxField);
- };
-
- case TypeOperator::LIST:
- {
- std::vector<llvm::Value*> indexes;
- std::transform(++expr.operands.begin(), expr.operands.end(), std::inserter(indexes, indexes.end()),
- [this] (const Expression & op) {
- return process(op);
- }
- );
-
- return instructions.compileArrayIndex(aggr, indexes, DEFAULT(string("el_") + hintIdent));
- };
-
- default:
- assert(false);
- }
+ return instructions.compileArrayIndex(aggr, indexes, DEFAULT(string("el_") + hintIdent));
};
- case Operator::CALL_INTRINSIC:
- {
- const std::string op = expr.getValueString();
+ default:
+ assert(false);
+ }
+ };
- if (op == "copy") {
- llvm::Value* result = process(expr.getOperands().at(0));
+ case Operator::CALL_INTRINSIC:
+ {
+ const std::string op = expr.getValueString();
- auto decoratorVersions = Decorators<VersionsScopeDecoratorTag>::getInterface(this);
- llvm::Value* storage = decoratorVersions->processIntrinsicInit(result->getType());
- decoratorVersions->processIntrinsicCopy(result, storage);
+ if (op == "copy") {
+ llvm::Value* result = process(expr.getOperands().at(0));
- return l.builder.CreateLoad(storage, hintVarDecl);
- }
+ auto decoratorVersions = Decorators<VersionsScopeDecoratorTag>::getInterface(this);
+ llvm::Value* storage = decoratorVersions->processIntrinsicInit(result->getType());
+ decoratorVersions->processIntrinsicCopy(result, storage);
- assert(false && "undefined intrinsic");
+ return l.builder.CreateLoad(storage, hintVarDecl);
}
- case Operator::VARIANT:
- {
- const ExpandedType& typVariant = pass->man->root->getType(expr);
- llvm::Type* typVariantRaw = l.toLLVMType(typVariant);
- llvm::Type* typIdRaw = llvm::cast<llvm::StructType>(typVariantRaw)->getElementType(0);
-
- uint64_t id = expr.getValueDouble();
- llvm::Value* variantRaw = llvm::UndefValue::get(typVariantRaw);
- variantRaw = l.builder.CreateInsertValue(variantRaw, llvm::ConstantInt::get(typIdRaw, id), llvm::ArrayRef<unsigned>({0}));
-
- const bool flagDoReference = expr.operands.size();
- if (flagDoReference){
- const ExpandedType& subtyp = ExpandedType(typVariant->__operands.at(id));
- llvm::Type* subtypRaw = l.toLLVMType(subtyp);
- Attachments::put<TypeInferred>(expr.operands.at(0), subtyp);
- llvm::Value* subtypValue = process(expr.operands.at(0));
-
- llvm::Type* typStorageRaw = llvm::cast<llvm::StructType>(typVariantRaw)->getElementType(1);
- llvm::Value* addrAsStorage = l.builder.CreateAlloca(typStorageRaw);
- llvm::Value* addrAsSubtyp = l.builder.CreateBitOrPointerCast(addrAsStorage, subtypRaw->getPointerTo());
-
- l.builder.CreateStore(subtypValue, addrAsSubtyp);
- llvm::Value* storageRaw = l.builder.CreateLoad(typStorageRaw, addrAsStorage);
- variantRaw = l.builder.CreateInsertValue(variantRaw, storageRaw, llvm::ArrayRef<unsigned>({1}));
- }
+ assert(false && "undefined intrinsic");
+ }
- return variantRaw;
- }
+ case Operator::QUERY:
+ case Operator::QUERY_LATE:
+ {
+ assert(false && "Should be processed by interpretation");
+ }
- case Operator::SWITCH_VARIANT: {
- return instructions.compileSwitchVariant(expr, DEFAULT("tmpswitch"));
+ case Operator::VARIANT:
+ {
+ const ExpandedType& typVariant = pass->man->root->getType(expr);
+ llvm::Type* typVariantRaw = l.toLLVMType(typVariant);
+ llvm::Type* typIdRaw = llvm::cast<llvm::StructType>(typVariantRaw)->getElementType(0);
+
+ uint64_t id = expr.getValueDouble();
+ llvm::Value* variantRaw = llvm::UndefValue::get(typVariantRaw);
+ variantRaw = l.builder.CreateInsertValue(variantRaw, llvm::ConstantInt::get(typIdRaw, id), llvm::ArrayRef<unsigned>({0}));
+
+ const bool flagDoReference = expr.operands.size();
+ if (flagDoReference) {
+ const ExpandedType& subtyp = ExpandedType(typVariant->__operands.at(id));
+ llvm::Type* subtypRaw = l.toLLVMType(subtyp);
+ Attachments::put<TypeInferred>(expr.operands.at(0), subtyp);
+ llvm::Value* subtypValue = process(expr.operands.at(0));
+
+ llvm::Type* typStorageRaw = llvm::cast<llvm::StructType>(typVariantRaw)->getElementType(1);
+ llvm::Value* addrAsStorage = l.builder.CreateAlloca(typStorageRaw);
+ llvm::Value* addrAsSubtyp = l.builder.CreateBitOrPointerCast(addrAsStorage, subtypRaw->getPointerTo());
+
+ l.builder.CreateStore(subtypValue, addrAsSubtyp);
+ llvm::Value* storageRaw = l.builder.CreateLoad(typStorageRaw, addrAsStorage);
+ variantRaw = l.builder.CreateInsertValue(variantRaw, storageRaw, llvm::ArrayRef<unsigned>({1}));
}
- case Operator::SWITCH_LATE: {
- assert(false && "Instruction's compilation should've been redirected to interpretation");
- return nullptr;
- }
+ return variantRaw;
+ }
- case Operator::SEQUENCE: {
- return instructions.compileSequence(expr);
- }
+ case Operator::SWITCH_VARIANT:
+ {
+ return instructions.compileSwitchVariant(expr, DEFAULT("tmpswitch"));
+ }
- case Operator::UNDEF: {
- llvm::Type* typExprUndef = l.toLLVMType(typeinference::getType(expr, *pass->man->root));
- return llvm::UndefValue::get(typExprUndef);
- }
+ case Operator::SWITCH_LATE:
+ {
+ assert(false && "Instruction's compilation should've been redirected to interpretation");
+ return nullptr;
+ }
- case Operator::INVALID:
- assert(expr.__state != Expression::COMPOUND);
+ case Operator::SEQUENCE:
+ {
+ return instructions.compileSequence(expr);
+ }
- switch (expr.__state) {
- case Expression::IDENT:
- {
- Symbol s = Attachments::get<IdentifierSymbol>(expr);
- return processSymbol(s, expr.getValueString());
- }
+ case Operator::UNDEF:
+ {
+ llvm::Type* typExprUndef = l.toLLVMType(typeinference::getType(expr, *pass->man->root));
+ return llvm::UndefValue::get(typExprUndef);
+ }
- case Expression::NUMBER:
- {
- llvm::Type* typConst = l.toLLVMType(typeinference::getType(expr, *pass->man->root));
- int literal = expr.getValueDouble();
+ case Operator::INVALID:
+ assert(expr.__state != Expression::COMPOUND);
- return llvm::ConstantInt::get(typConst, literal);
- }
+ switch (expr.__state) {
+ case Expression::IDENT:
+ {
+ Symbol s = Attachments::get<IdentifierSymbol>(expr);
+ return processSymbol(s, expr.getValueString());
+ }
- case Expression::STRING:
- {
- return instructions.compileConstantStringAsPChar(expr.getValueString(), DEFAULT("tmp_str"));
- };
+ case Expression::NUMBER:
+ {
+ llvm::Type* typConst = l.toLLVMType(typeinference::getType(expr, *pass->man->root));
+ int literal = expr.getValueDouble();
- default:
- {
- break;
- }
- };
+ return llvm::ConstantInt::get(typConst, literal);
+ }
+
+ case Expression::STRING:
+ {
+ return instructions.compileConstantStringAsPChar(expr.getValueString(), DEFAULT("tmp_str"));
+ };
+ default:
+ {
break;
+ }
+ };
+
+ break;
- default: break;
+ default: break;
}
assert(false && "Can't compile expression");
return 0;
}
llvm::Value*
BasicCodeScopeUnit::compile(const std::string& hintBlockDecl) {
LLVMLayer* llvm = pass->man->llvm;
if (!hintBlockDecl.empty()) {
llvm::BasicBlock *block = llvm::BasicBlock::Create(llvm->llvmContext, hintBlockDecl, function->raw);
pass->man->llvm->builder.SetInsertPoint(block);
}
currentBlockRaw = pass->man->llvm->builder.GetInsertBlock();
Symbol symbScope = Symbol{ScopedSymbol::RetSymbol, scope};
return processSymbol(symbScope);
}
-ICodeScopeUnit::~ICodeScopeUnit() {
-}
+ICodeScopeUnit::~ICodeScopeUnit() { }
-IFunctionUnit::~IFunctionUnit() {
-}
+IFunctionUnit::~IFunctionUnit() { }
llvm::Function*
IFunctionUnit::compile() {
if (raw != nullptr) return raw;
LLVMLayer* llvm = pass->man->llvm;
llvm::IRBuilder<>& builder = llvm->builder;
string&& functionName = prepareName();
std::vector<llvm::Type*>&& types = prepareSignature();
llvm::Type* expectedResultType = prepareResult();
llvm::FunctionType *ft = llvm::FunctionType::get(expectedResultType, types, false);
raw = llvm::cast<llvm::Function>(llvm->module->getOrInsertFunction(functionName, ft));
prepareBindings();
const std::string&blockName = "entry";
llvm::BasicBlock* blockCurrent = builder.GetInsertBlock();
llvm::Value* result = getScopeUnit(function->__entry)->compile(blockName);
assert(result);
//SECTIONTAG types/convert function ret value
builder.CreateRet(typeinference::doAutomaticTypeConversion(result, expectedResultType, llvm->builder));
if (blockCurrent) {
builder.SetInsertPoint(blockCurrent);
}
llvm->moveToGarbage(ft);
return raw;
}
ICodeScopeUnit*
IFunctionUnit::getScopeUnit(const CodeScope * const scope) {
if (__scopes.count(scope)) {
auto result = __scopes.at(scope).lock();
if (result) {
return result.get();
}
}
std::shared_ptr<ICodeScopeUnit> unit(pass->buildCodeScopeUnit(scope, this));
if (scope->__parent != nullptr) {
auto parentUnit = Decorators<CachedScopeDecoratorTag>::getInterface(getScopeUnit(scope->__parent));
parentUnit->registerChildScope(unit);
} else {
__orphanedScopes.push_back(unit);
}
if (!__scopes.emplace(scope, unit).second) {
__scopes[scope] = unit;
}
return unit.get();
}
ICodeScopeUnit*
IFunctionUnit::getScopeUnit(ManagedScpPtr scope) {
return getScopeUnit(&*scope);
}
ICodeScopeUnit*
IFunctionUnit::getEntry() {
return getScopeUnit(function->getEntryScope());
}
template<>
compilation::IFunctionUnit*
-CompilePassCustomDecorators<void, void>::buildFunctionUnit(const ManagedFnPtr& function){
+CompilePassCustomDecorators<void, void>
+::buildFunctionUnit(const ManagedFnPtr& function) {
return new BruteFunctionDefault(function, this);
}
template<>
compilation::ICodeScopeUnit*
-CompilePassCustomDecorators<void, void>::buildCodeScopeUnit(const CodeScope* const scope, IFunctionUnit* function){
+CompilePassCustomDecorators<void, void>
+::buildCodeScopeUnit(const CodeScope * const scope, IFunctionUnit* function) {
return new DefaultCodeScopeUnit(scope, function, this);
}
} // end of compilation
compilation::IFunctionUnit*
CompilePass::getFunctionUnit(const ManagedFnPtr& function) {
unsigned int id = function.id();
if (!functions.count(id)) {
compilation::IFunctionUnit* unit = buildFunctionUnit(function);
functions.emplace(id, unit);
return unit;
}
return functions.at(id);
}
void
CompilePass::run() {
//Initialization:
managerTransformations = new xreate::compilation::TransformationsManager();
targetInterpretation = new interpretation::TargetInterpretation(this->man->root, this);
//Determine entry function:
StaticModel model = man->transcend->query(Config::get("function-entry"));
assert(model.size() && "Error: No entry function found");
assert(model.size() == 1 && "Error: Ambiguous entry function");
string nameMain = std::get<0>(TranscendLayer::parse<std::string>(model.begin()->second));
compilation::IFunctionUnit* unitMain = getFunctionUnit(man->root->findFunction(nameMain));
//Compilation itself:
entry = unitMain->compile();
}
llvm::Function*
CompilePass::getEntryFunction() {
assert(entry);
return entry;
}
void
CompilePass::prepareQueries(TranscendLayer* transcend) {
transcend->registerQuery(new containers::Query(), QueryId::ContainersQuery);
transcend->registerQuery(new polymorph::PolymorphQuery(), QueryId::PolymorphQuery);
+ transcend->registerQuery(new latex::LatexQuery(), QueryId::LatexQuery);
}
} //end of namespace xreate
/**
* \class xreate::CompilePass
* \brief Encapsulates all compilation activities
*
* xreate::CompilePass iterates over xreate::AST tree and produces executable code fed by data(via xreate::Attachments) gathered by previous passes as well as data via queries(xreate::IQuery) from xreate:TranscendLayer reasoner.
* Compilation's done using xreate::LLVMLayer(wrapper over LLVM toolchain) and based on following aspects:
* - Containers support. See \ref compilation/containers.h
* - Late Conext compilation. See xreate::context::LateContextCompiler2
* - Interpretation support. See xreate::interpretation::TargetInterpretation
* - Loop saturation support. See xreate::compilation::TransformerSaturation
* - External Code access. See xreate::ExternLayer(wrapper over Clang library)
*
* \section adaptability_sect Adaptability
* xreate::CompilePass's architecture provides adaptability by employing:
* - %Function Decorators to alter function-level compilation. See xreate::compilation::IFunctionUnit
* - Code Block Decorators to alter code block level compilation. See xreate::compilation::ICodeScopeUnit
* Default functionality defined by \ref xreate::compilation::DefaultCodeScopeUnit
* - Targets to allow more versitile extensions.
* Currently only xreate::interpretation::TargetInterpretation use Targets infrastructure. See xreate::compilation::Target
* - %Altering Function invocation. xreate::compilation::ICallStatement
*
* Client able to construct compiler with desired decorators using xreate::compilation::CompilePassCustomDecorators.
* As a handy alias, `CompilePassCustomDecorators<void, void>` constructs default compiler
*
*/
diff --git a/cpp/src/pass/interpretationpass.cpp b/cpp/src/pass/interpretationpass.cpp
index 1e4d33e..2b440f8 100644
--- a/cpp/src/pass/interpretationpass.cpp
+++ b/cpp/src/pass/interpretationpass.cpp
@@ -1,533 +1,555 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* File: interpretationpass.cpp
* Author: pgess <v.melnychenko@xreate.org>
*
* Created on July 5, 2016, 5:21 PM
*/
/**
* \file interpretationpass.h
* \brief Interpretation analysis: determines what parts of code could be interpreted
*/
#include "pass/interpretationpass.h"
#include <compilation/targetinterpretation.h>
#include <bits/stl_vector.h>
#include "ast.h"
//DEBT implement InterpretationPass purely in transcend
//DEBT represent InterpretationPass as general type inference
using namespace std;
namespace xreate {
template<>
interpretation::InterpretationResolution
defaultValue<interpretation::InterpretationResolution>() {
return interpretation::CMPL_ONLY;
}
namespace interpretation {
enum InterpretationQuery {
QUERY_INTR_ONLY, QUERY_CMPL_ONLY
};
namespace details {
template<InterpretationQuery FLAG_REQUIRED>
bool
checkConstraints(InterpretationResolution flag) {
return( (flag==INTR_ONLY&&FLAG_REQUIRED==QUERY_INTR_ONLY)
||(flag==CMPL_ONLY&&FLAG_REQUIRED==QUERY_CMPL_ONLY));
}
InterpretationResolution
recognizeTags(const map<std::string, Expression>& tags) {
auto i=tags.find("interpretation");
if(i==tags.end()){
return ANY;
}
assert(i->second.op==Operator::CALL);
const string& cmd=i->second.operands.at(0).getValueString();
//TODO make consistent names of annotation and resolution
if(cmd=="force"){
return INTR_ONLY;
} else if(cmd=="suppress"){
return CMPL_ONLY;
}
return ANY;
}
}
InterpretationResolution
unify(InterpretationResolution flag) {
return flag;
}
template<typename FLAG_A, typename FLAG_B, typename... FLAGS>
InterpretationResolution
unify(FLAG_A flagA, FLAG_B flagB, FLAGS... flags) {
if(flagA==ANY){
return unify(flagB, flags...);
}
if(flagB==ANY){
return unify(flagA, flags...);
}
assert(flagA==flagB);
return flagA;
}
template<InterpretationQuery FLAG_REQUIRED>
bool
checkConstraints(std::vector<InterpretationResolution>&& flags) {
assert(flags.size());
InterpretationResolution flag=flags.front();
return details::checkConstraints<FLAG_REQUIRED>(flag);
}
template<InterpretationQuery FLAG_REQUIRED_A, InterpretationQuery FLAG_REQUIRED_B, InterpretationQuery... FLAGS>
bool
checkConstraints(std::vector<InterpretationResolution>&& flags) {
assert(flags.size());
InterpretationResolution flag=flags.front();
flags.pop_back();
if(details::checkConstraints<FLAG_REQUIRED_A>(flag)){
return checkConstraints<FLAG_REQUIRED_B, FLAGS...>(move(flags));
}
return false;
}
bool
InterpretationData::isDefault() const {
return(resolution==ANY&&op==NONE);
}
void
recognizeTags(const Expression& e) {
InterpretationData tag{details::recognizeTags(e.tags), NONE};
if(!tag.isDefault())
Attachments::put<InterpretationData>(e, tag);
}
InterpretationResolution
recognizeTags(const ManagedFnPtr& f) {
return details::recognizeTags(f->getTags());
}
InterpretationPass::InterpretationPass(PassManager* manager)
: AbstractPass(manager) {
Attachments::init<FunctionInterpretationData>();
Attachments::init<InterpretationData>();
}
void
InterpretationPass::run() {
ManagedFnPtr f=man->root->begin<Function>();
auto& visitedSymbols=getSymbolCache();
while(f.isValid()) {
const Symbol&symbolFunction{ScopedSymbol::RetSymbol, f->getEntryScope()};
if(!visitedSymbols.isCached(symbolFunction)){
visitedSymbols.setCachedValue(symbolFunction, process(f));
}
++f;
}
}
InterpretationResolution
InterpretationPass::process(const Expression& expression, PassContext context, const std::string& decl) {
recognizeTags(expression);
InterpretationResolution resolution=ANY;
- InterpretationOperator op=NONE;
+ InterpretationOperator opNo=NONE;
switch(expression.__state) {
case Expression::NUMBER:
case Expression::STRING:
{
break;
}
case Expression::IDENT:
{
resolution=Parent::processSymbol(Attachments::get<IdentifierSymbol>(expression), context);
break;
}
case Expression::COMPOUND:
break;
default:
{
resolution=CMPL_ONLY;
break;
}
}
if(expression.__state==Expression::COMPOUND)
switch(expression.op) {
case Operator::EQU:
case Operator::NE:
{
InterpretationResolution left=process(expression.operands[0], context);
InterpretationResolution right=process(expression.operands[1], context);
resolution=unify(left, right);
break;
}
case Operator::LOGIC_AND:
{
assert(expression.operands.size()==1);
resolution=process(expression.operands[0], context);
break;
}
case Operator::CALL:
{
+ size_t sizeOperands = expression.operands.size();
+ std::vector<InterpretationResolution> operands;
+ operands.reserve(sizeOperands);
+
+ for(size_t opNo=0; opNo<sizeOperands; ++opNo) {
+ const Expression &operand=expression.operands[opNo];
+ operands.push_back(process(operand, context));
+ }
+
//TODO cope with static/dynamic context
//TODO BUG here: if several variants they all are processed as CMPL regardless of signature
list<ManagedFnPtr> callees=man->root->getFunctionSpecializations(expression.getValueString());
if(callees.size()!=1){
resolution=CMPL_ONLY;
break;
}
ManagedFnPtr callee=callees.front();
const Symbol& symbCalleeFunc{ScopedSymbol::RetSymbol, callee->getEntryScope()};
//recursion-aware processing:
// - skip self recursion
const Symbol&symbSelfFunc{ScopedSymbol::RetSymbol, context.function->getEntryScope()};
if(!(symbSelfFunc==symbCalleeFunc)){
InterpretationResolution resCallee=processFnCall(callee, context);
assert(resCallee!=FUNC_POSTPONED&&"Indirect recursion detected: can't decide on interpretation resolution");
resolution=unify(resolution, resCallee);
}
//check arguments compatibility
const FunctionInterpretationData& calleeSignature=FunctionInterpretationHelper::getSignature(callee);
- for(size_t op=0, size=expression.operands.size(); op<size; ++op) {
- const Expression &operand=expression.operands[op];
- InterpretationResolution argActual=process(operand, context);
- InterpretationResolution argExpected=calleeSignature.signature[op];
+ for(size_t opNo=0; opNo<sizeOperands; ++opNo){
+ InterpretationResolution argActual=operands.at(opNo);
+ InterpretationResolution argExpected=calleeSignature.signature[opNo];
//TODO use args unification result to properly process function call
unify(argActual, argExpected);
}
if(FunctionInterpretationHelper::needPartialInterpretation(callee)){
- op=CALL_INTERPRET_PARTIAL;
+ opNo=CALL_INTERPRET_PARTIAL;
}
break;
}
case Operator::CALL_INTRINSIC:
{
- std::string nameFunction=expression.getValueString();
-
- if(nameFunction=="query"){
- resolution=INTR_ONLY;
-
- } else if(nameFunction=="query_scope") {
- resolution=INTR_ONLY;
-
- } else {
- resolution=CMPL_ONLY;
- }
+ resolution=CMPL_ONLY;
break;
}
- case Operator::SWITCH_LATE:
+ case Operator::QUERY:
{
+ resolution=INTR_ONLY;
+ break;
+ }
+
+ case Operator::QUERY_LATE:
+ {
+ InterpretationResolution predicate=process(expression.operands[0], context);
+ unify(predicate, INTR_ONLY);
+
+ CodeScope* exprBody=expression.blocks.front();
+ const std::string& argName=expression.bindings[0];
+ Symbol argS = {
+ ScopedSymbol{exprBody->__identifiers.at(argName), versions::VERSION_NONE},
+ exprBody
+ };
+ getSymbolCache().setCachedValue(argS, INTR_ONLY);
+ Parent::process(expression.blocks.front(), context);
+
resolution = CMPL_ONLY;
- op = SWITCH_LATE;
+ opNo=QUERY_LATE;
break;
}
+ case Operator::SWITCH_LATE:
+ {
+ resolution = CMPL_ONLY;
+ opNo = SWITCH_LATE;
+ break;
+ }
case Operator::IF:
{
InterpretationResolution flagCondition=process(expression.getOperands()[0], context);
InterpretationResolution flagScope1=Parent::process(expression.blocks.front(), context);
InterpretationResolution flagScope2=Parent::process(expression.blocks.back(), context);
//special case: IF_INTERPRET_CONDITION
if(checkConstraints<QUERY_INTR_ONLY>({flagCondition})){
- op=IF_INTERPRET_CONDITION;
+ opNo=IF_INTERPRET_CONDITION;
flagCondition=ANY;
}
resolution=unify(flagCondition, flagScope1, flagScope2);
break;
}
case Operator::FOLD:
{
InterpretationResolution flagInput=process(expression.getOperands()[0], context);
InterpretationResolution flagAccumInit=process(expression.getOperands()[1], context);
CodeScope* scopeBody=expression.blocks.front();
const std::string& nameEl=expression.bindings[0];
Symbol symbEl{ScopedSymbol
{scopeBody->__identifiers.at(nameEl), versions::VERSION_NONE}, scopeBody};
getSymbolCache().setCachedValue(symbEl, InterpretationResolution(flagInput));
const std::string& nameAccum=expression.bindings[1];
Symbol symbAccum{ScopedSymbol
{scopeBody->__identifiers.at(nameAccum), versions::VERSION_NONE}, scopeBody};
getSymbolCache().setCachedValue(symbAccum, InterpretationResolution(flagAccumInit));
InterpretationResolution flagBody=Parent::process(expression.blocks.front(), context);
//special case: FOLD_INTERPRET_INPUT
if(checkConstraints<QUERY_INTR_ONLY>({flagInput})){
- op=FOLD_INTERPRET_INPUT;
+ opNo=FOLD_INTERPRET_INPUT;
flagInput=ANY;
}
resolution=unify(flagInput, flagAccumInit, flagBody);
break;
}
case Operator::INDEX:
{
- for(const Expression &op : expression.getOperands()) {
- resolution=unify(resolution, process(op, context));
+ for(const Expression &opNo : expression.getOperands()) {
+ resolution=unify(resolution, process(opNo, context));
}
break;
}
case Operator::SWITCH:
{
InterpretationResolution flagCondition=process(expression.operands[0], context);
bool hasDefaultCase=expression.operands[1].op==Operator::CASE_DEFAULT;
//determine conditions resolution
InterpretationResolution flagHeaders=flagCondition;
for(size_t size=expression.operands.size(), i=hasDefaultCase?2:1; i<size; ++i) {
const Expression& exprCase=expression.operands[i];
flagHeaders=unify(flagHeaders, Parent::process(exprCase.blocks.front(), context));
}
if(checkConstraints<QUERY_INTR_ONLY>({flagHeaders})){
- op=SWITCH_INTERPRET_CONDITION;
+ opNo=SWITCH_INTERPRET_CONDITION;
flagHeaders=ANY;
}
//determine body resolutions
resolution=flagHeaders;
for(size_t size=expression.operands.size(), i=1; i<size; ++i) {
const Expression& exprCase=expression.operands[i];
resolution=unify(resolution, Parent::process(exprCase.blocks.back(), context));
}
break;
}
case Operator::SWITCH_VARIANT:
{
InterpretationResolution resolutionCondition=process(expression.operands.at(0), context);
resolution=resolutionCondition;
if(checkConstraints<QUERY_INTR_ONLY>({resolution})){
- op=SWITCH_VARIANT;
+ opNo=SWITCH_VARIANT;
resolution=ANY;
}
const string identCondition=expression.bindings.front();
for(auto scope : expression.blocks) {
//set binding resolution
ScopedSymbol symbolInternal=scope->getSymbol(identCondition);
getSymbolCache().setCachedValue(Symbol{symbolInternal, scope}, InterpretationResolution(resolutionCondition));
resolution=unify(resolution, Parent::process(scope, context));
}
for(auto scope : expression.blocks) {
resolution=unify(resolution, Parent::process(scope, context));
}
break;
}
case Operator::LIST:
case Operator::LIST_NAMED:
{
- for(const Expression &op : expression.getOperands()) {
- resolution=unify(resolution, process(op, context));
+ for(const Expression &opNo : expression.getOperands()) {
+ resolution=unify(resolution, process(opNo, context));
}
break;
}
case Operator::VARIANT:
{
if(expression.getOperands().size()){
resolution=process(expression.getOperands().front(), context);
} else {
resolution=ANY;
}
break;
}
default:
{
resolution=CMPL_ONLY;
- for(const Expression &op : expression.getOperands()) {
- process(op, context);
+ for(const Expression &opNo : expression.getOperands()) {
+ process(opNo, context);
}
for(CodeScope* scope : expression.blocks) {
Parent::process(scope, context);
}
break;
}
}
InterpretationData dataExpected=
Attachments::get<InterpretationData>(expression,{ANY, NONE});
resolution=unify(resolution, dataExpected.resolution);
- if(resolution!=dataExpected.resolution || op != dataExpected.op ){
- Attachments::put<InterpretationData>(expression,{resolution, op});
+ if(resolution!=dataExpected.resolution || opNo != dataExpected.op ){
+ Attachments::put<InterpretationData>(expression,{resolution, opNo});
}
return resolution;
}
InterpretationResolution
InterpretationPass::processFnCall(ManagedFnPtr function, PassContext context) {
return process(function);
}
InterpretationResolution
InterpretationPass::process(ManagedFnPtr function) {
CodeScope* entry=function->getEntryScope();
std::vector<std::string> arguments=entry->__bindings;
const Symbol&symbSelfFunc{ScopedSymbol::RetSymbol, function->getEntryScope()};
auto& cache=getSymbolCache();
if(cache.isCached(symbSelfFunc))
return cache.getCachedValue(symbSelfFunc);
const FunctionInterpretationData& fnSignature=FunctionInterpretationHelper::getSignature(function);
InterpretationResolution fnResolutionExpected=details::recognizeTags(function->getTags());
//mark preliminary function resolution as expected
if(fnResolutionExpected!=ANY){
cache.setCachedValue(symbSelfFunc, move(fnResolutionExpected));
} else {
// - in order to recognize indirect recursion mark this function resolution as POSTPONED
cache.setCachedValue(symbSelfFunc, FUNC_POSTPONED);
}
//set resolution for function arguments as expected
for(int argNo=0, size=arguments.size(); argNo<size; ++argNo) {
Symbol symbArg{ScopedSymbol
{entry->__identifiers.at(arguments[argNo]), versions::VERSION_NONE}, entry};
cache.setCachedValue(symbArg, InterpretationResolution(fnSignature.signature[argNo]));
}
PassContext context;
context.function=function;
context.scope=entry;
InterpretationResolution resActual=process(CodeScope::getDefinition(symbSelfFunc), context);
resActual=unify(resActual, fnResolutionExpected);
return cache.setCachedValue(symbSelfFunc, move(resActual));
}
const FunctionInterpretationData
FunctionInterpretationHelper::getSignature(ManagedFnPtr function) {
if(Attachments::exists<FunctionInterpretationData>(function)){
return Attachments::get<FunctionInterpretationData>(function);
}
FunctionInterpretationData&& data=recognizeSignature(function);
Attachments::put<FunctionInterpretationData>(function, data);
return data;
}
FunctionInterpretationData
FunctionInterpretationHelper::recognizeSignature(ManagedFnPtr function) {
CodeScope* entry=function->__entry;
FunctionInterpretationData result;
result.signature.reserve(entry->__bindings.size());
bool flagPartialInterpretation=false;
for(size_t no=0, size=entry->__bindings.size(); no<size; ++no) {
const std::string& argName=entry->__bindings[no];
Symbol symbArg{ScopedSymbol
{entry->__identifiers.at(argName), versions::VERSION_NONE}, entry};
const Expression& arg=CodeScope::getDefinition(symbArg);
InterpretationResolution argResolution=details::recognizeTags(arg.tags);
flagPartialInterpretation|=(argResolution==INTR_ONLY);
result.signature.push_back(argResolution);
}
result.flagPartialInterpretation=flagPartialInterpretation;
return result;
}
bool
FunctionInterpretationHelper::needPartialInterpretation(ManagedFnPtr function) {
const FunctionInterpretationData& data=getSignature(function);
return data.flagPartialInterpretation;
}
}
} //end of namespace xreate::interpretation
/** \class xreate::interpretation::InterpretationPass
*
* Encapsulates *Interpretation Analysis* to support [Interpretation Concept](/w/concepts/dfa)
*
* Recognizes program functions, expressions, instructions eligible for interpretation
* and stores output in Attachments<FunctionInterpretationData> and Attachments<InterpretationData>
*
* There are number of instructions currently able to be interpreted:
* - Basic literals: numbers and strings
* - Compounds: lists, structs, variants
* - Non-versioned identifiers
* - Comparison and logic operators
* - %Function calls
* - `query` intrinsic function calls
* - Branching: `if`, `loop fold`, `switch`, `switch variant` statements
*
- * Some of those instructions are eligibile for *hybrid interpretation* to allow coupling
+ * Some of those instructions are eligibile for *late interpretation* to allow coupling
* of compiled instructions with interpreted ones, those are:
* - Partial function calls
* - Branching: `if`, `loop fold`, `switch`, `switch variant` statements
*
* \sa xreate::interpretation::TargetInterpretation, [Interpretation Concept](/w/concepts/dfa)
*/
diff --git a/cpp/src/pass/interpretationpass.h b/cpp/src/pass/interpretationpass.h
index 21da1d3..1f47aa2 100644
--- a/cpp/src/pass/interpretationpass.h
+++ b/cpp/src/pass/interpretationpass.h
@@ -1,96 +1,96 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* File: interpretationpass.h
* Author: pgess <v.melnychenko@xreate.org>
*
* Created on July 5, 2016, 5:21 PM
*/
#ifndef INTERPRETATIONPASS_H
#define INTERPRETATIONPASS_H
#include "abstractpass.h"
#include <map>
#ifndef FRIENDS_INTERPRETATION_TESTS
#define FRIENDS_INTERPRETATION_TESTS
#endif
-//TODO refactor interpretation. Get rid of InterpretationOperator, put only one operator - Hybrid.
+//TODO refactor interpretation. Get rid of InterpretationOperator, put only one operator - Hybrid/Late.
namespace xreate{ namespace interpretation{
enum InterpretationResolution{ANY, INTR_ONLY, CMPL_ONLY, FUNC_POSTPONED};
enum InterpretationOperator{
- NONE, IF_INTERPRET_CONDITION, FOLD_INTERPRET_INPUT,
+ NONE, IF_INTERPRET_CONDITION, FOLD_INTERPRET_INPUT, QUERY_LATE,
SWITCH_INTERPRET_CONDITION, SWITCH_VARIANT, SWITCH_LATE,
CALL_INTERPRET_PARTIAL
};
struct InterpretationData{
InterpretationResolution resolution;
InterpretationOperator op;
bool isDefault() const;
};
struct FunctionInterpretationData{
typedef std::vector<InterpretationResolution> Signature;
Signature signature;
bool flagPartialInterpretation;
};
class FunctionInterpretationHelper {
public:
static const FunctionInterpretationData
getSignature(ManagedFnPtr function);
static bool needPartialInterpretation(ManagedFnPtr function);
private:
static FunctionInterpretationData recognizeSignature(ManagedFnPtr function);
};
/** \brief Determines parts of program eligible for Interpretation. */
class InterpretationPass: public AbstractPass<InterpretationResolution> {
typedef AbstractPass<InterpretationResolution> Parent;
public:
InterpretationResolution process(const Expression& expression, PassContext context, const std::string& varDecl="") override;
InterpretationResolution process(ManagedFnPtr function);
InterpretationResolution processFnCall(ManagedFnPtr function, PassContext context);
InterpretationPass(PassManager* manager);
void run();
};
namespace details {
InterpretationResolution recognizeTags(const std::map<std::string, Expression>& tags);
}
} //end of namespace interpretation
template<>
interpretation::InterpretationResolution
defaultValue<interpretation::InterpretationResolution>();
template<>
struct AttachmentsDict<interpretation::FunctionInterpretationData>
{
typedef interpretation::FunctionInterpretationData Data;
static const unsigned int key = 5;
};
template<>
struct AttachmentsDict<interpretation::InterpretationData>
{
typedef interpretation::InterpretationData Data;
static const unsigned int key = 3;
};
} //end of namespace xreate
#endif /* INTERPRETATIONPASS_H */
diff --git a/cpp/src/query/latex.cpp b/cpp/src/query/latex.cpp
index 5fc0816..04a7826 100644
--- a/cpp/src/query/latex.cpp
+++ b/cpp/src/query/latex.cpp
@@ -1,94 +1,98 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/*
* Author: pgess <v.melnychenko@xreate.org>
* Created on June 25, 2018, 12:14 PM
*
* \file latex.cpp
* \brief latex
*/
#include "query/latex.h"
#include "aux/transcend-decorators.h"
using namespace std;
using namespace xreate::latereasoning;
namespace xreate{
namespace latex{
void
LatexQuery::init(TranscendLayer* transcend) {
__transcend = transcend;
//schema: latex_fn_demand(Fn, Subject)
StaticModel data = __transcend->query("latex_fn_demand_ordered");
for(const auto& entry : data) {
string fnName, subject; size_t id;
tie(fnName, subject, id) = __transcend->parse<string, string, int>(entry.second);
__demand[fnName].resize(std::max(__demand[fnName].size(), id+1));
__demand[fnName][id] = subject;
}
- //schema: Subject, Decision
+ //schema: latex_registered_subjects(Subject, Decision)
data = __transcend->query("latex_registered_subjects");
for(const auto& entry : data) {
string subject;
Gringo::Symbol decision;
tie(subject, decision) = __transcend->parse<string, Gringo::Symbol>(entry.second);
__domains[subject].push_back(decision);
}
- //schema: Scope, Subject, Decision
+ //schema: latex_decision(Scope, Subject, Decision)
data = __transcend->query("latex_decision");
for(const auto& entry : data) {
ScopePacked scope;
string subject;
Gringo::Symbol decision;
tie(scope, subject, decision) = __transcend->parse<ScopePacked, string, Gringo::Symbol>(entry.second);
__decisions[make_pair(scope, subject)] = entry.second;
}
+ //schema: latex_parameters_group_offset(int)
+ data = __transcend->query("latex_parameters_group_offset");
+ LatexParametersOffset = std::get<0>(__transcend->parse<unsigned int>(data.begin()->second));
+
auto transcendLate =
Decorators<LateReasoningTranscendDecoratorTag>::getInterface(__transcend);
//Later decisions. schema: Scope, Subject, Decision
LateAnnotationsGroup group = transcendLate->queryLate("latex_decision");
for (auto entry: group.annotations) {
auto key = __transcend->parse<ScopePacked, string>(entry.first);
__decisionsLate.emplace(make_pair(get<0>(key), get<1>(key)), entry.second);
}
}
Demand
LatexQuery::getFnDemand(const std::string& fnName) {
if (!__demand.count(fnName)) return Demand();
return __demand.at(fnName);
}
latereasoning::LateAnnotation
LatexQuery::getDecision(const std::string& subject, const CodeScope* scopeCaller) {
ScopePacked scopeP = __transcend->pack(scopeCaller);
if(__decisions.count(make_pair(scopeP, subject))){
//found static decision
return LateAnnotation(__decisions.at(make_pair(scopeP, subject)));
}
return __decisionsLate.at(make_pair(scopeP, subject));
}
std::list<Gringo::Symbol>
LatexQuery::getSubjectDomain(const std::string& subject) {
assert(__domains.count(subject));
return __domains.at(subject);
}
}
}
\ No newline at end of file
diff --git a/cpp/src/query/latex.h b/cpp/src/query/latex.h
index 89ccf56..1239ae9 100644
--- a/cpp/src/query/latex.h
+++ b/cpp/src/query/latex.h
@@ -1,44 +1,46 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/**
* \file query/context.h
* \brief Represents reasoner's solution on [Context](/w/concepts/context)
*
* \class xreate::latex::LatexQuery
*/
#ifndef LATEXQUERY_H
#define LATEXQUERY_H
#include "transcendlayer.h"
#include "aux/latereasoning.h"
#include <list>
namespace xreate{
namespace latex{
typedef std::vector<std::string> Demand;
class LatexQuery: public IQuery{
public:
+ VNameId LatexParametersOffset;
+
Demand getFnDemand(const std::string& fnName);
latereasoning::LateAnnotation getDecision(const std::string& subject, const CodeScope* scopeCaller);
std::list<Gringo::Symbol> getSubjectDomain(const std::string& subject);
void init(TranscendLayer* transcend);
private:
TranscendLayer* __transcend;
std::map<std::string, Demand> __demand;
std::map<std::pair<ScopePacked, std::string>, Gringo::Symbol> __decisions;
std::map<std::pair<ScopePacked, std::string>, latereasoning::LateAnnotation> __decisionsLate;
std::map<std::string, std::list<Gringo::Symbol>> __domains;
};
}
}
#endif
\ No newline at end of file
diff --git a/cpp/src/utils.h b/cpp/src/utils.h
index c98e03e..b45173b 100644
--- a/cpp/src/utils.h
+++ b/cpp/src/utils.h
@@ -1,164 +1,167 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* utils.cpp
*
* Author: pgess <v.melnychenko@xreate.org>
*/
#ifndef UTILS_H
#define UTILS_H
#include "jeayeson/jeayeson.hpp"
namespace xreate {
template<class Tag, class Source>
struct AddTag {
explicit
AddTag(const Source &src)
: __src(src) { }
explicit
AddTag(Source &&src)
: __src(std::move(src)) { }
operator const Source&() const{
return __src;
}
const Source& get() const{
return __src;
}
const Source*
operator->() const {
return &__src;
}
private:
Source __src;
};
struct Expand_t{};
template<class Source>
using Expanded = AddTag<Expand_t, Source>;
//DEBT move to resources compiler. https://github.com/markusfisch/cpprc
class Config {
private:
json_map __storage;
static Config __self;
Config();
public:
static std::string get(std::string key) {
return __self.__storage.get_for_path<json_value>(key).get<std::string>();
}
};
/** \brief Decorators support */
template<class DecoratorTag>
struct DecoratorsDict{
//typedef ConcreteDecoratorForTag result;
};
template<class DecoratorTag>
struct Decorators{
typedef typename DecoratorsDict<DecoratorTag>::result Instance;
template<class Base>
static Instance* getInterface(Base* obj){
- return dynamic_cast< Instance* > (obj);
+ Instance* result = dynamic_cast< Instance* > (obj);
+ assert(result);
+
+ return result;
}
};
template<class Target>
struct ManagedPtr {
static ManagedPtr<Target> Invalid() {
return ManagedPtr<Target>();
}
ManagedPtr() : __storage(0) {
}
ManagedPtr(unsigned int id, const std::vector<Target*>* storage)
: __id(id), __storage(storage) {
}
Target&
operator*() const {
assert(isValid() && "Invalid Ptr");
return *__storage->at(__id);
}
void operator=(const ManagedPtr<Target>& other) {
__id = other.__id;
__storage = other.__storage;
}
bool
operator==(const ManagedPtr<Target>& other) {
return isValid() && (__id == other.__id);
}
Target*
operator->() const noexcept {
assert(isValid() && "Invalid Ptr");
return __storage->at(__id);
}
inline bool isValid() const {
return (__storage) && (0 <= __id) && (__id < __storage->size());
}
inline operator bool() const {
return isValid();
}
ManagedPtr<Target>& operator++() {
++__id;
return *this;
}
inline unsigned int id() const {
return __id;
}
private:
unsigned int __id = 0;
const std::vector<Target*> * __storage = 0;
};
}
std::wstring
utf8_to_wstring(const std::string& str);
std::string
wstring_to_utf8(const std::wstring& str);
#define RST "\x1B[0m"
#define KRED "\x1B[31m"
#define KGRN "\x1B[32m"
#define KYEL "\x1B[33m"
#define KBLU "\x1B[34m"
#define KMAG "\x1B[35m"
#define KCYN "\x1B[36m"
#define KWHT "\x1B[37m"
#define FRED(x) KRED << x << RST
#define FGRN(x) KGRN <<x << RST
#define FYEL(x) KYEL << x << RST
#define FBLU(x) KBLU << x << RST
#define FMAG(x) KMAG x RST
#define FCYN(x) KCYN x RST
#define FWHT(x) KWHT x RST
#define BOLD(x) "\x1B[1m" x RST
#define UNDL(x) "\x1B[4m" x RST
#endif // UTILS_H
diff --git a/cpp/tests/association.cpp b/cpp/tests/association.cpp
index d97d2f3..ce5964e 100644
--- a/cpp/tests/association.cpp
+++ b/cpp/tests/association.cpp
@@ -1,133 +1,124 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*
* association.cpp
*
* Author: pgess <v.melnychenko@xreate.org>
* Created on August 12, 2017, 9:28 PM
*/
#include "xreatemanager.h"
#include "transcendlayer.h"
+#include "pass/interpretationpass.h"
#include <gtest/gtest.h>
+using namespace xreate::interpretation;
using namespace xreate;
using namespace std;
-TEST(Association, test1) {
- std::string controller =
- R"Code(
- program(add).
-)Code";
-
- std::string script =
- R"Code(
-Annotation = type variant {
- Num:: int,
- String:: string,
- Func:: {name::string, arguments::[Annotation]}
-}.
-
-extractCmd = function(program::Annotation):: Annotation; interpretation(force){
- switch variant(program)::Annotation
- case (Num){String("wrong expression")}
- case (String){String("wrong expression")}
- case (Func){program["arguments"][0]}
-}
-
-main= function:: int; entry{
- x= 5::int.
- y = 6::int.
-
- program = intrinsic query("program")[0]::Annotation.
- cmd = extractCmd(program)::Annotation; interpretation(force).
-
- answer = switch variant(cmd)::int
- case (Num) {0}
- case (String){0}
- case (Func){
- switch(cmd["name"])::int
- case("add"){x + y}
- case default {0}
- }.
-
- answer
-}
-)Code";
-
- std::unique_ptr<XreateManager> man(XreateManager::prepare(std::move(script)));
- man->transcend->addRawScript(move(controller));
- int (*main)() = (int (*)())man->run();
- int result = main();
-
- ASSERT_EQ(11, result);
-}
-
-TEST(Association, QueryScope1) {
- std::string script = R"Code(
- Annotation = type variant {
- Num:: int,
- String:: string,
- Func:: {name::string, arguments::[Annotation]}
- }.
-
- func = function::int{10} //aux func in order to have few scopes
-
- main = function:: int; entry {
- scope = intrinsic query_scope()::Annotation.
-
- answer = switch variant(scope):: int
- case (Num) {scope}
- case (String){-1}
- case (Func){-1}.
-
- answer
- }
-
-)Code";
-
- std::unique_ptr<XreateManager> man(XreateManager::prepare(std::move(script)));
- int (*main)() = (int (*)())man->run();
- int result = main();
-
- ASSERT_EQ(1, result);
-}
-
TEST(Association, TypedQuery_1) {
- auto man = details::tier1::XreateManager::prepare(R"Code(
+ auto man = ::xreate::details::tier1::XreateManager::prepare(R"Code(
AtomNumT = type slave atomNumT.
AtomStrT = type slave atomStrT.
CompListT = type slave compListT.
CompArithT = type slave compArithT.
test = function:: num; entry
{
query1 = intrinsic query("atomNumT")::[AtomNumT].
query2 = intrinsic query("atomStrT")::[AtomStrT].
query3 = intrinsic query("compListT")::[CompListT].
query4 = intrinsic query("compArithT")::[CompArithT].
test1 = query1[0] == 5:: bool.
test2 = query2[1] == "y":: bool.
test3 = query3[0, 1] == "x" :: bool.
test4 = query4[0, 0, 0] == 1:: bool.
test1 + test2 + test3 + test4
}
)Code");
man->transcend->addRawScript(R"RAW(
atomNumT(5; 8).
atomStrT("x"; "y").
compListT(5, "x").
compListT(8, "y").
compArithT(add(1, 2)).
compArithT(mul(5, 6)).
)RAW");
man->analyse();
int (*test)() = (int (*)())man->run();
int result = test();
ASSERT_EQ(4, result);
}
+TEST(Association, QueryLate_ast_1){
+ auto man = XreateManager::prepare(
+R"Code(
+ test = function:: num; entry
+ {
+ intrinsic query late("dict"->x:: bool)::bool
+ {
+ (x == true)
+ }
+ }
+)Code");
+}
+
+TEST(Association, QueryLate_pass_1){
+ auto man = ::xreate::details::tier1::XreateManager::prepare(
+R"Code(
+ test = function:: num; entry
+ {
+ intrinsic query late("dict"->x:: bool)::bool
+ {
+ (x == true)
+ }
+ }
+)Code");
+ man->analyse();
+
+ Expression instructionE = man->root->findFunction("test")->getEntryScope()->getBody();
+ InterpretationData instructionData = Attachments::get<InterpretationData>(instructionE);
+ ASSERT_EQ(QUERY_LATE, instructionData.op);
+}
+
+TEST(Association, QueryLate_target_1){
+ auto man = ::xreate::details::tier1::XreateManager::prepare(
+R"Code(
+ Equipment = type variant {dresser, sink, stove}.
+ Room = type variant{kitchen, bedroom, bathroom}.
+
+ test = function:: num; entry
+ {
+ room = bedroom() :: Room; room.
+ equipment = intrinsic query late("whatshere"->x:: Equipment)::int; equipment
+ { if (x == dresser()):: int {1} else {0} }.
+
+ equipment + (room::int)
+ }
+)Code");
+
+ man->transcend->addRawScript(
+R"RAW(
+ room(kitchen; bedroom; bathroom).
+ equipment(dresser;sink;stove).
+ interior(kitchen, stove).
+ interior(bedroom, dresser).
+ interior(bathroom, sink).
+
+ late(VarTarget, VarRoom, Room, whatshere(Equipment)):-
+ bind(VarTarget, equipment);
+ bind(VarRoom, room);
+ interior(Room, Equipment);
+ equipment(Equipment);
+ room(Room).
+)RAW");
+
+ man->analyse();
+ int (*result)() = (int (*)()) man->run();
+ ASSERT_EQ(2, result());
+}
+
diff --git a/cpp/tests/types.cpp b/cpp/tests/types.cpp
index d71319c..73f8349 100644
--- a/cpp/tests/types.cpp
+++ b/cpp/tests/types.cpp
@@ -1,236 +1,248 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*
* types.cpp
*
* Created on: Jun 4, 2015
* Author: pgess <v.melnychenko@xreate.org>
*/
#include "gtest/gtest.h"
#include "xreatemanager.h"
#include "llvmlayer.h"
#include "main/Parser.h"
#include "transcendlayer.h"
#include "analysis/typeinference.h"
#include "analysis/interpretation.h"
using namespace std;
using namespace xreate;
using namespace xreate::grammar::main;
TEST(Types, DependantTypes1) {
string&& code = "XmlNode = type {\n"
" tag:: string,\n"
" attrs:: [string], \n"
" content:: string\n"
"}.\n";
std::unique_ptr<XreateManager> program(XreateManager::prepare(move(code)));
ExpandedType typeXmlNode = program->root->findType("XmlNode");
ASSERT_EQ(TypeOperator::LIST_NAMED, typeXmlNode->__operator);
ASSERT_EQ(3, typeXmlNode->__operands.size());
ASSERT_EQ(TypePrimitive::String, typeXmlNode->__operands.at(0).__value);
ASSERT_EQ(TypeOperator::LIST, typeXmlNode->__operands.at(1).__operator);
ASSERT_EQ(TypePrimitive::String, typeXmlNode->__operands.at(2).__value);
}
TEST(Types, ast_ParameterizedTypes_FeatureTypeIndex_1) {
string&& code = "XmlNode = type {\n"
" tag:: string,\n"
" attrs:: [string],\n"
" content:: string\n"
"}.\n"
""
"Template = type(Leaf) {Leaf, [Leaf[content]]}."
"Concrete = type Template(XmlNode).";
std::unique_ptr<XreateManager> program(XreateManager::prepare(move(code)));
ExpandedType typeConcrete = program->root->findType("Concrete");
ASSERT_EQ(TypeOperator::LIST_NAMED, typeConcrete->__operator);
ASSERT_EQ(2, typeConcrete->__operands.size());
ASSERT_EQ(TypeOperator::LIST_NAMED, typeConcrete->__operands.at(0).__operator);
ASSERT_EQ(TypeOperator::LIST, typeConcrete->__operands.at(1).__operator);
ASSERT_EQ(TypePrimitive::String, typeConcrete->__operands.at(1).__operands.at(0).__value);
}
TEST(Types, TreeType1) {
string&& code = "XmlNode = type {\n"
" tag:: string,\n"
" attrs:: [string],\n"
" content:: string\n"
"}.\n"
""
"Tree = type(Leaf) {Leaf, [Tree(Leaf)]}."
"Concrete = type Tree(XmlNode).";
std::unique_ptr<XreateManager> program(XreateManager::prepare(move(code)));
ExpandedType typeConcrete = program->root->findType("Concrete");
ASSERT_EQ(TypeOperator::LIST_NAMED, typeConcrete->__operator);
ASSERT_EQ(2, typeConcrete->__operands.size());
ASSERT_EQ(TypeOperator::LIST_NAMED, typeConcrete->__operands.at(0).__operator);
ASSERT_EQ(TypeOperator::LIST, typeConcrete->__operands.at(1).__operator);
auto typeLink = typeConcrete->__operands.at(1).__operands.at(0);
ASSERT_EQ(TypeOperator::LINK, typeLink.__operator);
ASSERT_EQ(typeConcrete->conjuctionId, typeLink.conjuctionId);
}
TEST(Types, TreeType1LLvm) {
string&& code = "XmlNode = type {\n"
" tag:: string,\n"
" /* attrs:: [string],*/\n"
" content:: string\n"
"}.\n"
""
"Tree = type(Leaf) {Leaf, [Tree(Leaf)]}."
"Concrete = type Tree(XmlNode).";
std::unique_ptr<XreateManager> program(XreateManager::prepare(move(code)));
ExpandedType typeConcrete = program->root->findType("Concrete");
llvm::Type* raw = program->llvm->toLLVMType(typeConcrete);
}
TEST(Types, ArrayOfExternal1) {
FILE* input = fopen("scripts/containers/Containers_Implementation_LinkedList1.xreate", "r");
assert(input != nullptr);
Scanner scanner(input);
Parser parser(&scanner);
parser.Parse();
AST* ast = parser.root->finalize();
CodeScope* body = ast->findFunction("test")->getEntryScope();
const ExpandedType& t2 = ast->getType(body->getDefinition(body->getSymbol("childrenRaw")));
EXPECT_EQ(t2->__operator, TypeOperator::LIST);
}
TEST(Types, ExternType1) {
FILE* input = fopen("scripts/containers/Containers_Implementation_LinkedList1.xreate", "r");
assert(input != nullptr);
Scanner scanner(input);
Parser parser(&scanner);
parser.Parse();
AST* ast = parser.root->finalize();
CodeScope* body = ast->findFunction("test")->getEntryScope();
const ExpandedType& t2 = ast->getType(body->getDefinition(body->getSymbol("tree")));
EXPECT_EQ(t2->__operator, TypeOperator::CUSTOM);
}
TEST(Types, ast_VariantType1) {
string&& code =
" colors = type variant {RED, BLUE, GREEN}.\n"
" test = function:: colors; entry {GREEN()}";
std::unique_ptr<XreateManager> program(XreateManager::prepare(move(code)));
ExpandedType typ = program->root->findType("colors");
EXPECT_EQ(TypeOperator::VARIANT, typ->__operator);
Expression eRed = program->root->findFunction("test")->getEntryScope()->getBody();
EXPECT_EQ(Operator::VARIANT, eRed.op);
const ExpandedType& typ2 = program->root->getType(eRed);
EXPECT_EQ(TypeOperator::VARIANT, typ2->__operator);
}
TEST(Types, full_VariantType_Switch1) {
string&& code =
"colors = type variant{RED, BLUE, GREEN}. \n"
" test = function:: colors {GREEN()} \n"
"main = function:: int; entry { \n"
" switch(test()):: int \n"
" case (GREEN()) {0} \n"
" case default {1} \n"
"}";
XreateManager* man = XreateManager::prepare(move(code));
int (*main)() = (int (*)()) man->run();
EXPECT_EQ(0, main());
}
TEST(Types, ast_VariantType2) {
std::string script =
R"Code(
Annotation = type
variant {
Num:: int,
String:: string,
Func:: {name::string, arguments::[Expression]}
}.
)Code";
std::unique_ptr<XreateManager> program(XreateManager::prepare(move(script)));
ExpandedType typ = program->root->findType("Annotation");
ASSERT_EQ(3, typ.get().fields.size());
}
TEST(Types, SlaveTypes_UnwrapSlaveType1) {
auto man = details::tier1::XreateManager::prepare(R"Code(
AtomNumT = type slave atomNumT.
AtomStrT = type slave atomStrT.
CmpndIntStrT = type slave cmpndIntStrT.
VariantT = type slave variantT.
VariantComplicatedT = type slave variantComplicatedT.
)Code");
man->transcend->addRawScript(R"RAW(
atomNumT(5). atomNumT(8).
atomStrT("a"). atomStrT("b").
cmpndIntStrT(1, "a").
cmpndIntStrT(2, "b").
variantT(first).
variantT(second).
variantT(third).
variantComplicatedT(first(1, "a")).
variantComplicatedT(second("b")).
)RAW");
man->analyse();
ExpandedType AtomNumT = man->root->findType("AtomNumT");
ASSERT_EQ(AtomNumT->__operator, TypeOperator::SLAVE);
ExpandedType ContentAtomNumT = interpretation::dereferenceSlaveType(AtomNumT, man->transcend);
ASSERT_EQ(TypePrimitive::Num, ContentAtomNumT->__value);
ExpandedType AtomStrT = man->root->findType("AtomStrT");
ExpandedType ContentAtomStrT = interpretation::dereferenceSlaveType(AtomStrT,
man->transcend);
ASSERT_EQ(TypePrimitive::String, ContentAtomStrT->__value);
ExpandedType CmpndIntStrT = man->root->findType("CmpndIntStrT");
ExpandedType ContentCmpndIntStrT = interpretation::dereferenceSlaveType(CmpndIntStrT,
man->transcend);
ASSERT_EQ(TypeOperator::LIST_NAMED, ContentCmpndIntStrT->__operator);
ASSERT_EQ(2, ContentCmpndIntStrT->__operands.size());
ExpandedType VariantT = man->root->findType("VariantT");
ExpandedType ContentVariantT = interpretation::dereferenceSlaveType(VariantT,
man->transcend);
ASSERT_EQ(TypeOperator::VARIANT, ContentVariantT->__operator);
ASSERT_EQ(3, ContentVariantT->fields.size());
ExpandedType VariantComplicatedT = man->root->findType("VariantComplicatedT");
ExpandedType ContentVariantComplicatedT = interpretation::dereferenceSlaveType(VariantComplicatedT,
man->transcend);
ASSERT_EQ(TypeOperator::VARIANT, ContentVariantComplicatedT->__operator);
ASSERT_EQ(2, ContentVariantComplicatedT->fields.size());
ASSERT_EQ(2, ContentVariantComplicatedT->__operands.at(0).__operands.size());
+}
+
+TEST(Types, IndexNumber_1)
+{
+ string&& code =
+R"CODE(
+ Tuple = type {string, int}.
+ Int = type Tuple[1].
+)CODE";
+
+ std::unique_ptr<XreateManager> program(XreateManager::prepare(move(code)));
+ ExpandedType typeInt = program->root->findType("Int");
}
\ No newline at end of file
diff --git a/cpp/tests/virtualization.cpp b/cpp/tests/virtualization.cpp
index d5c10ec..fe6bc53 100644
--- a/cpp/tests/virtualization.cpp
+++ b/cpp/tests/virtualization.cpp
@@ -1,24 +1,60 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*
* virtualization.cpp
*
* Author: pgess <v.melnychenko@xreate.org>
* Created on February 24, 2018, 4:30 PM
*/
#include "xreatemanager.h"
+#include "ast.h"
+#include "analysis/interpretation.h"
#include "gtest/gtest.h"
using namespace xreate;
+using namespace std;
-TEST(Virtualization, test1){
- FILE* input = fopen("scripts/virtualization/test1.xreate","r");
+TEST(Virtualization, UniqueSizoPrefix_1) {
+ FILE* input = fopen("scripts/virtualization/test1.xreate", "r");
assert(input != nullptr);
- std::unique_ptr<XreateManager> man(XreateManager::prepare(input));
+ std::unique_ptr<details::tier1::XreateManager> man(details::tier1::XreateManager::prepare(input));
+ man->analyse();
+
+ ExpandedType typeDictSizoS = man->root->findType("DictSizo");
+ ExpandedType typeDictSizo = interpretation::dereferenceSlaveType(typeDictSizoS, man->transcend);
+ ASSERT_EQ(TypeOperator::LIST_NAMED, typeDictSizo->__operator);
+ int (*main)() = (int (*)())man->run();
+
+ testing::internal::CaptureStdout();
+ main();
+ std::string outputActual = testing::internal::GetCapturedStdout();
+ cout << outputActual << endl;
+ ASSERT_STREQ("file opened: /0/test1 file opened: /1/test1 ", outputActual.c_str());
+}
+TEST(Virtualization, GlobalDereferenceStrategy_1) {
+ FILE* input = fopen("scripts/virtualization/test2.xreate", "r");
+ assert(input != nullptr);
+ std::unique_ptr<XreateManager> man(XreateManager::prepare(input));
int (*main)() = (int (*)())man->run();
- int result = main();
+
+ testing::internal::CaptureStdout();
+ main();
+ std::string outputActual = testing::internal::GetCapturedStdout();
+ cout << outputActual << endl;
+ ASSERT_STREQ("file opened: test1 file opened: test1 ", outputActual.c_str());
+}
- ASSERT_EQ(1, result);
-}
\ No newline at end of file
+TEST(Virtualization, LocalDereferenceStrategy_1) {
+FILE* input = fopen("scripts/virtualization/test3.xreate", "r");
+ assert(input != nullptr);
+ std::unique_ptr<XreateManager> man(XreateManager::prepare(input));
+ int (*main)() = (int (*)())man->run();
+
+ testing::internal::CaptureStdout();
+ main();
+ std::string outputActual = testing::internal::GetCapturedStdout();
+ cout << outputActual << endl;
+ ASSERT_STREQ("file opened: test1 file opened: 1/test1 ", outputActual.c_str());
+}
diff --git a/documentation-api/AST-correspondence.fods b/documentation-api/AST-correspondence.fods
index 159b180..fb51aa6 100644
--- a/documentation-api/AST-correspondence.fods
+++ b/documentation-api/AST-correspondence.fods
@@ -1,558 +1,556 @@
<?xml version="1.0" encoding="UTF-8"?>
<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.spreadsheet">
- <office:meta><meta:creation-date>2018-08-02T18:59:05.238218130</meta:creation-date><meta:generator>LibreOffice/6.0.4.2$Linux_X86_64 LibreOffice_project/00m0$Build-2</meta:generator><dc:date>2018-08-15T21:01:52.425281983</dc:date><meta:editing-duration>PT4H11M37S</meta:editing-duration><meta:editing-cycles>4</meta:editing-cycles><meta:document-statistic meta:table-count="1" meta:cell-count="57" meta:object-count="0"/></office:meta>
+ <office:meta><meta:creation-date>2018-08-02T18:59:05.238218130</meta:creation-date><meta:generator>LibreOffice/6.0.5.2$Linux_X86_64 LibreOffice_project/00m0$Build-2</meta:generator><dc:date>2018-09-19T18:48:14.346688728</dc:date><meta:editing-duration>PT4H42M8S</meta:editing-duration><meta:editing-cycles>7</meta:editing-cycles><meta:document-statistic meta:table-count="1" meta:cell-count="57" meta:object-count="0"/></office:meta>
<office:settings>
<config:config-item-set config:name="ooo:view-settings">
<config:config-item config:name="VisibleAreaTop" config:type="int">0</config:config-item>
<config:config-item config:name="VisibleAreaLeft" config:type="int">0</config:config-item>
<config:config-item config:name="VisibleAreaWidth" config:type="int">38555</config:config-item>
- <config:config-item config:name="VisibleAreaHeight" config:type="int">17596</config:config-item>
+ <config:config-item config:name="VisibleAreaHeight" config:type="int">18048</config:config-item>
<config:config-item-map-indexed config:name="Views">
<config:config-item-map-entry>
<config:config-item config:name="ViewId" config:type="string">view1</config:config-item>
<config:config-item-map-named config:name="Tables">
<config:config-item-map-entry config:name="Sheet1">
<config:config-item config:name="CursorPositionX" config:type="int">1</config:config-item>
- <config:config-item config:name="CursorPositionY" config:type="int">21</config:config-item>
+ <config:config-item config:name="CursorPositionY" config:type="int">25</config:config-item>
<config:config-item config:name="HorizontalSplitMode" config:type="short">0</config:config-item>
<config:config-item config:name="VerticalSplitMode" config:type="short">0</config:config-item>
<config:config-item config:name="HorizontalSplitPosition" config:type="int">0</config:config-item>
<config:config-item config:name="VerticalSplitPosition" config:type="int">0</config:config-item>
<config:config-item config:name="ActiveSplitRange" config:type="short">2</config:config-item>
<config:config-item config:name="PositionLeft" config:type="int">0</config:config-item>
<config:config-item config:name="PositionRight" config:type="int">0</config:config-item>
<config:config-item config:name="PositionTop" config:type="int">0</config:config-item>
- <config:config-item config:name="PositionBottom" config:type="int">0</config:config-item>
+ <config:config-item config:name="PositionBottom" config:type="int">9</config:config-item>
<config:config-item config:name="ZoomType" config:type="short">0</config:config-item>
<config:config-item config:name="ZoomValue" config:type="int">100</config:config-item>
<config:config-item config:name="PageViewZoomValue" config:type="int">60</config:config-item>
<config:config-item config:name="ShowGrid" config:type="boolean">true</config:config-item>
<config:config-item config:name="AnchoredTextOverflowLegacy" config:type="boolean">false</config:config-item>
</config:config-item-map-entry>
</config:config-item-map-named>
<config:config-item config:name="ActiveTable" config:type="string">Sheet1</config:config-item>
- <config:config-item config:name="HorizontalScrollbarWidth" config:type="int">585</config:config-item>
+ <config:config-item config:name="HorizontalScrollbarWidth" config:type="int">1241</config:config-item>
<config:config-item config:name="ZoomType" config:type="short">0</config:config-item>
<config:config-item config:name="ZoomValue" config:type="int">100</config:config-item>
<config:config-item config:name="PageViewZoomValue" config:type="int">60</config:config-item>
<config:config-item config:name="ShowPageBreakPreview" config:type="boolean">false</config:config-item>
<config:config-item config:name="ShowZeroValues" config:type="boolean">true</config:config-item>
<config:config-item config:name="ShowNotes" config:type="boolean">true</config:config-item>
<config:config-item config:name="ShowGrid" config:type="boolean">true</config:config-item>
<config:config-item config:name="GridColor" config:type="long">12632256</config:config-item>
<config:config-item config:name="ShowPageBreaks" config:type="boolean">true</config:config-item>
<config:config-item config:name="HasColumnRowHeaders" config:type="boolean">true</config:config-item>
<config:config-item config:name="HasSheetTabs" config:type="boolean">true</config:config-item>
<config:config-item config:name="IsOutlineSymbolsSet" config:type="boolean">true</config:config-item>
<config:config-item config:name="IsValueHighlightingEnabled" config:type="boolean">false</config:config-item>
<config:config-item config:name="IsSnapToRaster" config:type="boolean">false</config:config-item>
<config:config-item config:name="RasterIsVisible" config:type="boolean">false</config:config-item>
<config:config-item config:name="RasterResolutionX" config:type="int">1270</config:config-item>
<config:config-item config:name="RasterResolutionY" config:type="int">1270</config:config-item>
<config:config-item config:name="RasterSubdivisionX" config:type="int">1</config:config-item>
<config:config-item config:name="RasterSubdivisionY" config:type="int">1</config:config-item>
<config:config-item config:name="IsRasterAxisSynchronized" config:type="boolean">true</config:config-item>
<config:config-item config:name="AnchoredTextOverflowLegacy" config:type="boolean">false</config:config-item>
</config:config-item-map-entry>
</config:config-item-map-indexed>
</config:config-item-set>
<config:config-item-set config:name="ooo:configuration-settings">
<config:config-item config:name="SyntaxStringRef" config:type="short">7</config:config-item>
<config:config-item config:name="AllowPrintJobCancel" config:type="boolean">true</config:config-item>
<config:config-item config:name="SaveVersionOnClose" config:type="boolean">false</config:config-item>
<config:config-item config:name="IsKernAsianPunctuation" config:type="boolean">false</config:config-item>
<config:config-item config:name="CharacterCompressionType" config:type="short">0</config:config-item>
<config:config-item config:name="ApplyUserData" config:type="boolean">true</config:config-item>
- <config:config-item config:name="PrinterSetup" config:type="base64Binary">sgH+/0xleG1hcmstWDY1NmRlAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQ1VQUzpMZXhtYXJrLVg2NTZkZQAAAAAAAAAAAAAAAAAWAAMA0wAAAAAAAAAIAFZUAAAkbQAASm9iRGF0YSAxCnByaW50ZXI9TGV4bWFyay1YNjU2ZGUKb3JpZW50YXRpb249UG9ydHJhaXQKY29waWVzPTEKY29sbGF0ZT1mYWxzZQptYXJnaW5kYWp1c3RtZW50PTAsMCwwLDAKY29sb3JkZXB0aD0yNApwc2xldmVsPTAKcGRmZGV2aWNlPTEKY29sb3JkZXZpY2U9MApQUERDb250ZXhEYXRhCklucHV0U2xvdDpUcmF5MQBEdXBsZXg6Tm9uZQBQYWdlU2l6ZTpMZXR0ZXIAABIAQ09NUEFUX0RVUExFWF9NT0RFDwBEdXBsZXhNb2RlOjpPZmY=</config:config-item>
+ <config:config-item config:name="PrinterSetup" config:type="base64Binary">sgH+/0xleG1hcmstWDY1NmRlAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQ1VQUzpMZXhtYXJrLVg2NTZkZQAAAAAAAAAAAAAAAAAWAAMA0wAAAAAAAAAIAFZUAAAkbQAASm9iRGF0YSAxCnByaW50ZXI9TGV4bWFyay1YNjU2ZGUKb3JpZW50YXRpb249UG9ydHJhaXQKY29waWVzPTEKY29sbGF0ZT1mYWxzZQptYXJnaW5kYWp1c3RtZW50PTAsMCwwLDAKY29sb3JkZXB0aD0yNApwc2xldmVsPTAKcGRmZGV2aWNlPTEKY29sb3JkZXZpY2U9MApQUERDb250ZXhEYXRhClBhZ2VTaXplOkxldHRlcgBEdXBsZXg6Tm9uZQBJbnB1dFNsb3Q6VHJheTEAABIAQ09NUEFUX0RVUExFWF9NT0RFDwBEdXBsZXhNb2RlOjpPZmY=</config:config-item>
<config:config-item config:name="PrinterName" config:type="string">Lexmark-X656de</config:config-item>
<config:config-item config:name="AutoCalculate" config:type="boolean">true</config:config-item>
<config:config-item config:name="LinkUpdateMode" config:type="short">3</config:config-item>
<config:config-item config:name="HasColumnRowHeaders" config:type="boolean">true</config:config-item>
<config:config-item config:name="LoadReadonly" config:type="boolean">false</config:config-item>
<config:config-item config:name="UpdateFromTemplate" config:type="boolean">true</config:config-item>
<config:config-item config:name="ShowZeroValues" config:type="boolean">true</config:config-item>
<config:config-item config:name="GridColor" config:type="long">12632256</config:config-item>
<config:config-item config:name="ShowPageBreaks" config:type="boolean">true</config:config-item>
<config:config-item config:name="ShowGrid" config:type="boolean">true</config:config-item>
<config:config-item config:name="IsOutlineSymbolsSet" config:type="boolean">true</config:config-item>
<config:config-item config:name="IsDocumentShared" config:type="boolean">false</config:config-item>
<config:config-item config:name="ShowNotes" config:type="boolean">true</config:config-item>
<config:config-item config:name="EmbedFonts" config:type="boolean">false</config:config-item>
<config:config-item config:name="HasSheetTabs" config:type="boolean">true</config:config-item>
<config:config-item config:name="RasterSubdivisionY" config:type="int">1</config:config-item>
<config:config-item config:name="RasterIsVisible" config:type="boolean">false</config:config-item>
<config:config-item config:name="RasterResolutionX" config:type="int">1270</config:config-item>
<config:config-item config:name="RasterResolutionY" config:type="int">1270</config:config-item>
<config:config-item config:name="IsSnapToRaster" config:type="boolean">false</config:config-item>
<config:config-item config:name="RasterSubdivisionX" config:type="int">1</config:config-item>
<config:config-item config:name="IsRasterAxisSynchronized" config:type="boolean">true</config:config-item>
</config:config-item-set>
</office:settings>
<office:scripts>
<office:script script:language="ooo:Basic">
- <ooo:libraries xmlns:ooo="http://openoffice.org/2004/office" xmlns:xlink="http://www.w3.org/1999/xlink">
- <ooo:library-embedded ooo:name="Standard"/>
- </ooo:libraries>
+ <ooo:libraries xmlns:ooo="http://openoffice.org/2004/office" xmlns:xlink="http://www.w3.org/1999/xlink"/>
</office:script>
</office:scripts>
<office:font-face-decls>
<style:font-face style:name="Liberation Sans" svg:font-family="&apos;Liberation Sans&apos;" style:font-family-generic="swiss" style:font-pitch="variable"/>
<style:font-face style:name="DejaVu Sans" svg:font-family="&apos;DejaVu Sans&apos;" style:font-family-generic="system" style:font-pitch="variable"/>
<style:font-face style:name="Droid Sans Fallback" svg:font-family="&apos;Droid Sans Fallback&apos;" style:font-family-generic="system" style:font-pitch="variable"/>
<style:font-face style:name="FreeSans" svg:font-family="FreeSans" style:font-family-generic="system" style:font-pitch="variable"/>
</office:font-face-decls>
<office:styles>
<style:default-style style:family="table-cell">
<style:paragraph-properties style:tab-stop-distance="36pt"/>
<style:text-properties style:font-name="Liberation Sans" fo:language="en" fo:country="US" style:font-name-asian="DejaVu Sans" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="DejaVu Sans" style:language-complex="hi" style:country-complex="IN"/>
</style:default-style>
<number:number-style style:name="N0">
<number:number number:min-integer-digits="1"/>
</number:number-style>
<style:style style:name="Default" style:family="table-cell">
<style:text-properties style:font-name-asian="Droid Sans Fallback" style:font-family-asian="&apos;Droid Sans Fallback&apos;" style:font-family-generic-asian="system" style:font-pitch-asian="variable" style:font-name-complex="FreeSans" style:font-family-complex="FreeSans" style:font-family-generic-complex="system" style:font-pitch-complex="variable"/>
</style:style>
<style:style style:name="Heading" style:family="table-cell" style:parent-style-name="Default">
<style:text-properties fo:color="#000000" fo:font-size="24pt" fo:font-style="normal" fo:font-weight="bold"/>
</style:style>
<style:style style:name="Heading_20_1" style:display-name="Heading 1" style:family="table-cell" style:parent-style-name="Heading">
<style:text-properties fo:color="#000000" fo:font-size="18pt" fo:font-style="normal" fo:font-weight="normal"/>
</style:style>
<style:style style:name="Heading_20_2" style:display-name="Heading 2" style:family="table-cell" style:parent-style-name="Heading">
<style:text-properties fo:color="#000000" fo:font-size="12pt" fo:font-style="normal" fo:font-weight="normal"/>
</style:style>
<style:style style:name="Text" style:family="table-cell" style:parent-style-name="Default"/>
<style:style style:name="Note" style:family="table-cell" style:parent-style-name="Text">
<style:table-cell-properties fo:background-color="#ffffcc" style:diagonal-bl-tr="none" style:diagonal-tl-br="none" fo:border="0.74pt solid #808080"/>
<style:text-properties fo:color="#333333" fo:font-size="10pt" fo:font-style="normal" fo:font-weight="normal"/>
</style:style>
<style:style style:name="Footnote" style:family="table-cell" style:parent-style-name="Text">
<style:text-properties fo:color="#808080" fo:font-size="10pt" fo:font-style="italic" fo:font-weight="normal"/>
</style:style>
<style:style style:name="Hyperlink" style:family="table-cell" style:parent-style-name="Text">
<style:text-properties fo:color="#0000ee" fo:font-size="10pt" fo:font-style="normal" style:text-underline-style="solid" style:text-underline-width="auto" style:text-underline-color="#0000ee" fo:font-weight="normal"/>
</style:style>
<style:style style:name="Status" style:family="table-cell" style:parent-style-name="Default"/>
<style:style style:name="Good" style:family="table-cell" style:parent-style-name="Status">
<style:table-cell-properties fo:background-color="#ccffcc"/>
<style:text-properties fo:color="#006600" fo:font-size="10pt" fo:font-style="normal" fo:font-weight="normal"/>
</style:style>
<style:style style:name="Neutral" style:family="table-cell" style:parent-style-name="Status">
<style:table-cell-properties fo:background-color="#ffffcc"/>
<style:text-properties fo:color="#996600" fo:font-size="10pt" fo:font-style="normal" fo:font-weight="normal"/>
</style:style>
<style:style style:name="Bad" style:family="table-cell" style:parent-style-name="Status">
<style:table-cell-properties fo:background-color="#ffcccc"/>
<style:text-properties fo:color="#cc0000" fo:font-size="10pt" fo:font-style="normal" fo:font-weight="normal"/>
</style:style>
<style:style style:name="Warning" style:family="table-cell" style:parent-style-name="Status">
<style:text-properties fo:color="#cc0000" fo:font-size="10pt" fo:font-style="normal" fo:font-weight="normal"/>
</style:style>
<style:style style:name="Error" style:family="table-cell" style:parent-style-name="Status">
<style:table-cell-properties fo:background-color="#cc0000"/>
<style:text-properties fo:color="#ffffff" fo:font-size="10pt" fo:font-style="normal" fo:font-weight="bold"/>
</style:style>
<style:style style:name="Accent" style:family="table-cell" style:parent-style-name="Default">
<style:text-properties fo:color="#000000" fo:font-size="10pt" fo:font-style="normal" fo:font-weight="bold"/>
</style:style>
<style:style style:name="Accent_20_1" style:display-name="Accent 1" style:family="table-cell" style:parent-style-name="Accent">
<style:table-cell-properties fo:background-color="#000000"/>
<style:text-properties fo:color="#ffffff" fo:font-size="10pt" fo:font-style="normal" fo:font-weight="normal"/>
</style:style>
<style:style style:name="Accent_20_2" style:display-name="Accent 2" style:family="table-cell" style:parent-style-name="Accent">
<style:table-cell-properties fo:background-color="#808080"/>
<style:text-properties fo:color="#ffffff" fo:font-size="10pt" fo:font-style="normal" fo:font-weight="normal"/>
</style:style>
<style:style style:name="Accent_20_3" style:display-name="Accent 3" style:family="table-cell" style:parent-style-name="Accent">
<style:table-cell-properties fo:background-color="#dddddd"/>
</style:style>
</office:styles>
<office:automatic-styles>
<style:style style:name="co1" style:family="table-column">
<style:table-column-properties fo:break-before="auto" style:column-width="306.45pt"/>
</style:style>
<style:style style:name="co2" style:family="table-column">
<style:table-column-properties fo:break-before="auto" style:column-width="235.39pt"/>
</style:style>
<style:style style:name="co3" style:family="table-column">
<style:table-column-properties fo:break-before="auto" style:column-width="285.59pt"/>
</style:style>
<style:style style:name="co4" style:family="table-column">
<style:table-column-properties fo:break-before="auto" style:column-width="64.01pt"/>
</style:style>
<style:style style:name="co5" style:family="table-column">
<style:table-column-properties fo:break-before="auto" style:column-width="201.46pt"/>
</style:style>
<style:style style:name="ro1" style:family="table-row">
<style:table-row-properties style:row-height="31.49pt" fo:break-before="auto" style:use-optimal-row-height="false"/>
</style:style>
<style:style style:name="ro2" style:family="table-row">
<style:table-row-properties style:row-height="12.81pt" fo:break-before="auto" style:use-optimal-row-height="true"/>
</style:style>
<style:style style:name="ro3" style:family="table-row">
<style:table-row-properties style:row-height="24.01pt" fo:break-before="auto" style:use-optimal-row-height="true"/>
</style:style>
<style:style style:name="ro4" style:family="table-row">
<style:table-row-properties style:row-height="46.49pt" fo:break-before="auto" style:use-optimal-row-height="true"/>
</style:style>
<style:style style:name="ta1" style:family="table" style:master-page-name="Default">
<style:table-properties table:display="true" style:writing-mode="lr-tb"/>
</style:style>
<style:style style:name="ce1" style:family="table-cell" style:parent-style-name="Default">
<style:table-cell-properties style:text-align-source="fix" style:repeat-content="false" style:vertical-align="middle"/>
<style:paragraph-properties fo:text-align="center" fo:margin-left="0pt"/>
<style:text-properties fo:font-size="13pt" fo:font-weight="bold" style:font-size-asian="13pt" style:font-weight-asian="bold" style:font-size-complex="13pt" style:font-weight-complex="bold"/>
</style:style>
<style:style style:name="ce6" style:family="table-cell" style:parent-style-name="Default">
<style:text-properties fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold"/>
</style:style>
<style:style style:name="ce5" style:family="table-cell" style:parent-style-name="Default">
<style:table-cell-properties style:text-align-source="fix" style:repeat-content="false"/>
<style:paragraph-properties fo:text-align="center" fo:margin-left="0pt"/>
<style:text-properties fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold"/>
</style:style>
<style:style style:name="ce4" style:family="table-cell" style:parent-style-name="Default">
<style:table-cell-properties fo:background-color="#fff200"/>
</style:style>
<style:page-layout style:name="pm1">
<style:page-layout-properties style:writing-mode="lr-tb"/>
<style:header-style>
<style:header-footer-properties fo:min-height="21.26pt" fo:margin-left="0pt" fo:margin-right="0pt" fo:margin-bottom="7.09pt"/>
</style:header-style>
<style:footer-style>
<style:header-footer-properties fo:min-height="21.26pt" fo:margin-left="0pt" fo:margin-right="0pt" fo:margin-top="7.09pt"/>
</style:footer-style>
</style:page-layout>
<style:page-layout style:name="pm2">
<style:page-layout-properties style:writing-mode="lr-tb"/>
<style:header-style>
<style:header-footer-properties fo:min-height="21.26pt" fo:margin-left="0pt" fo:margin-right="0pt" fo:margin-bottom="7.09pt" fo:border="2.49pt solid #000000" fo:padding="0.51pt" fo:background-color="#c0c0c0">
<style:background-image/>
</style:header-footer-properties>
</style:header-style>
<style:footer-style>
<style:header-footer-properties fo:min-height="21.26pt" fo:margin-left="0pt" fo:margin-right="0pt" fo:margin-top="7.09pt" fo:border="2.49pt solid #000000" fo:padding="0.51pt" fo:background-color="#c0c0c0">
<style:background-image/>
</style:header-footer-properties>
</style:footer-style>
</style:page-layout>
</office:automatic-styles>
<office:master-styles>
<style:master-page style:name="Default" style:page-layout-name="pm1">
<style:header>
<text:p><text:sheet-name>???</text:sheet-name></text:p>
</style:header>
<style:header-left style:display="false"/>
<style:footer>
<text:p>Page <text:page-number>1</text:page-number></text:p>
</style:footer>
<style:footer-left style:display="false"/>
</style:master-page>
<style:master-page style:name="Report" style:page-layout-name="pm2">
<style:header>
<style:region-left>
<text:p><text:sheet-name>???</text:sheet-name><text:s/>(<text:title>???</text:title>)</text:p>
</style:region-left>
<style:region-right>
- <text:p><text:date style:data-style-name="N2" text:date-value="2018-08-15">00/00/0000</text:date>, <text:time style:data-style-name="N2" text:time-value="18:00:53.929404118">00:00:00</text:time></text:p>
+ <text:p><text:date style:data-style-name="N2" text:date-value="2018-09-19">00/00/0000</text:date>, <text:time style:data-style-name="N2" text:time-value="18:48:05.142748542">00:00:00</text:time></text:p>
</style:region-right>
</style:header>
<style:header-left style:display="false"/>
<style:footer>
<text:p>Page <text:page-number>1</text:page-number><text:s/>/ <text:page-count>99</text:page-count></text:p>
</style:footer>
<style:footer-left style:display="false"/>
</style:master-page>
</office:master-styles>
<office:body>
<office:spreadsheet>
<table:calculation-settings table:automatic-find-labels="false" table:use-regular-expressions="false" table:use-wildcards="true"/>
<table:table table:name="Sheet1" table:style-name="ta1">
<table:table-column table:style-name="co1" table:default-cell-style-name="Default"/>
<table:table-column table:style-name="co2" table:default-cell-style-name="Default"/>
<table:table-column table:style-name="co3" table:default-cell-style-name="Default"/>
<table:table-column table:style-name="co4" table:default-cell-style-name="Default"/>
<table:table-column table:style-name="co5" table:default-cell-style-name="Default"/>
<table:table-row table:style-name="ro1">
<table:table-cell table:style-name="ce1" office:value-type="string" calcext:value-type="string">
<text:p>AST</text:p>
</table:table-cell>
<table:table-cell table:style-name="ce1" office:value-type="string" calcext:value-type="string">
<text:p>Current Transcend</text:p>
</table:table-cell>
<table:table-cell table:style-name="ce1" office:value-type="string" calcext:value-type="string">
<text:p>Proposition 1</text:p>
</table:table-cell>
<table:table-cell table:style-name="ce1" office:value-type="string" calcext:value-type="string">
<text:p>Types</text:p>
</table:table-cell>
<table:table-cell table:style-name="ce1" office:value-type="string" calcext:value-type="string">
<text:p>Tests</text:p>
</table:table-cell>
</table:table-row>
<table:table-row table:style-name="ro2">
<table:table-cell table:style-name="ce6" office:value-type="string" calcext:value-type="string">
<text:p>Expr</text:p>
</table:table-cell>
<table:table-cell table:number-columns-repeated="4"/>
</table:table-row>
<table:table-row table:style-name="ro2">
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>op</text:p>
</table:table-cell>
<table:table-cell table:number-columns-repeated="4"/>
</table:table-row>
<table:table-row table:style-name="ro2">
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>id</text:p>
</table:table-cell>
<table:table-cell table:number-columns-repeated="4"/>
</table:table-row>
<table:table-row table:style-name="ro2">
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>state</text:p>
</table:table-cell>
<table:table-cell table:number-columns-repeated="4"/>
</table:table-row>
<table:table-row table:style-name="ro2">
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>bindings</text:p>
</table:table-cell>
<table:table-cell table:number-columns-repeated="4"/>
</table:table-row>
<table:table-row table:style-name="ro2">
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>operands</text:p>
</table:table-cell>
<table:table-cell table:number-columns-repeated="4"/>
</table:table-row>
<table:table-row table:style-name="ro2">
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>type</text:p>
</table:table-cell>
<table:table-cell table:number-columns-repeated="4"/>
</table:table-row>
<table:table-row table:style-name="ro2">
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>tags</text:p>
</table:table-cell>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>bind(var, annotation)</text:p>
</table:table-cell>
<table:table-cell table:number-columns-repeated="3"/>
</table:table-row>
<table:table-row table:style-name="ro2">
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>blocks</text:p>
</table:table-cell>
<table:table-cell table:number-columns-repeated="4"/>
</table:table-row>
<table:table-row table:style-name="ro2">
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>value</text:p>
</table:table-cell>
<table:table-cell table:number-columns-repeated="4"/>
</table:table-row>
<table:table-row table:style-name="ro2">
<table:table-cell table:number-columns-repeated="5"/>
</table:table-row>
<table:table-row table:style-name="ro2">
<table:table-cell table:style-name="ce6" office:value-type="string" calcext:value-type="string">
<text:p>CodeScope</text:p>
</table:table-cell>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>scope(scopeId)</text:p>
</table:table-cell>
<table:table-cell table:style-name="ce4" office:value-type="string" calcext:value-type="string">
<text:p>ast_scope(scopeId)</text:p>
</table:table-cell>
<table:table-cell table:number-columns-repeated="2"/>
</table:table-row>
<table:table-row table:style-name="ro3">
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>bindings</text:p>
</table:table-cell>
<table:table-cell office:value-type="string" calcext:value-type="string"><text:p>ast_scope_binding(scopeId, BindingId, </text:p><text:p>ScopeBindName)</text:p>
</table:table-cell>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>ast_scope_binding(scopeId, BindingId, ScopeBindName)</text:p>
</table:table-cell>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>LIST</text:p>
</table:table-cell>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>CFA.ASTCorrespondence_Scope_Bindings_1</text:p>
</table:table-cell>
</table:table-row>
<table:table-row table:style-name="ro2">
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>identifiers</text:p>
</table:table-cell>
<table:table-cell/>
<table:table-cell table:style-name="ce4" office:value-type="string" calcext:value-type="string">
<text:p>ast_scope_identifier(scopeId, Var)</text:p>
</table:table-cell>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>LIST</text:p>
</table:table-cell>
<table:table-cell/>
</table:table-row>
<table:table-row table:style-name="ro2">
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>parent</text:p>
</table:table-cell>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>cfa_parent(scopeCurrent, scope(scopeParent))</text:p>
</table:table-cell>
<table:table-cell table:style-name="ce4" office:value-type="string" calcext:value-type="string">
<text:p>ast_scope_parent(ScopeId, ScopeParentId)</text:p>
</table:table-cell>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>SINGLE</text:p>
</table:table-cell>
<table:table-cell/>
</table:table-row>
<table:table-row table:style-name="ro2">
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>declarations</text:p>
</table:table-cell>
<table:table-cell table:number-columns-repeated="2"/>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>LIST</text:p>
</table:table-cell>
<table:table-cell/>
</table:table-row>
<table:table-row table:style-name="ro2">
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>tags</text:p>
</table:table-cell>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>bind_scope(scopeId, tag, strong/weak(..))</text:p>
</table:table-cell>
<table:table-cell/>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>LIST</text:p>
</table:table-cell>
<table:table-cell/>
</table:table-row>
<table:table-row table:style-name="ro2">
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>contextRules</text:p>
</table:table-cell>
<table:table-cell table:number-columns-repeated="4"/>
</table:table-row>
<table:table-row table:style-name="ro2">
<table:table-cell table:number-columns-repeated="5"/>
</table:table-row>
<table:table-row table:style-name="ro2">
<table:table-cell table:style-name="ce6" office:value-type="string" calcext:value-type="string">
<text:p>Function</text:p>
</table:table-cell>
<table:table-cell table:number-columns-repeated="4"/>
</table:table-row>
<table:table-row table:style-name="ro2">
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>entry</text:p>
</table:table-cell>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>cfa_parent(scopeEntry, functon(name))</text:p>
</table:table-cell>
<table:table-cell/>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>SINGLE</text:p>
</table:table-cell>
<table:table-cell/>
</table:table-row>
<table:table-row table:style-name="ro2">
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>name</text:p>
</table:table-cell>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>function(name)</text:p>
</table:table-cell>
<table:table-cell/>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>SINGLE</text:p>
</table:table-cell>
<table:table-cell/>
</table:table-row>
<table:table-row table:style-name="ro2">
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>guard</text:p>
</table:table-cell>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>cfa_function_specializations(funcName, tag)</text:p>
</table:table-cell>
<table:table-cell/>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>SINGLE</text:p>
</table:table-cell>
<table:table-cell/>
</table:table-row>
<table:table-row table:style-name="ro2">
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>tags</text:p>
</table:table-cell>
<table:table-cell office:value-type="string" calcext:value-type="string">
- <text:p>bind_function(name, tag)</text:p>
+ <text:p>bind_func(name, tag)</text:p>
</table:table-cell>
<table:table-cell/>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>LIST</text:p>
</table:table-cell>
<table:table-cell/>
</table:table-row>
- <table:table-row table:style-name="ro2">
+ <table:table-row table:style-name="ro2" table:number-rows-repeated="2">
<table:table-cell table:number-columns-repeated="5"/>
</table:table-row>
<table:table-row table:style-name="ro2">
<table:table-cell table:style-name="ce5" office:value-type="string" calcext:value-type="string">
<text:p>Special Expressions</text:p>
</table:table-cell>
<table:table-cell table:number-columns-repeated="4"/>
</table:table-row>
<table:table-row table:style-name="ro4">
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>CALL</text:p>
</table:table-cell>
<table:table-cell office:value-type="string" calcext:value-type="string"><text:p>cfa_call(scopeFrom, functionTo)</text:p><text:p>dfa_callfn(SymbRet, FnName)</text:p><text:p>weak/dfa_callargs(SymbRet, argFormal, argActual)</text:p><text:p>weak/dfa_alias(aliasFormal, Actual)</text:p>
</table:table-cell>
<table:table-cell table:number-columns-repeated="3"/>
</table:table-row>
<table:table-row table:style-name="ro2" table:number-rows-repeated="2">
<table:table-cell table:number-columns-repeated="5"/>
</table:table-row>
<table:table-row table:style-name="ro2">
<table:table-cell/>
<table:table-cell table:style-name="ce5" office:value-type="string" calcext:value-type="string">
<text:p>OTHER</text:p>
</table:table-cell>
<table:table-cell table:number-columns-repeated="3"/>
</table:table-row>
<table:table-row table:style-name="ro2">
<table:table-cell/>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>var: <text:s/>s(id, <text:s/>version, scope), a(Num)</text:p>
</table:table-cell>
<table:table-cell table:number-columns-repeated="3"/>
</table:table-row>
<table:table-row table:style-name="ro2">
<table:table-cell/>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>v(var1)</text:p>
</table:table-cell>
<table:table-cell table:number-columns-repeated="3"/>
</table:table-row>
<table:table-row table:style-name="ro2">
<table:table-cell/>
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>dfa_fnret(fnName, symbRet)</text:p>
</table:table-cell>
<table:table-cell table:number-columns-repeated="3"/>
</table:table-row>
</table:table>
<table:named-expressions/>
</office:spreadsheet>
</office:body>
</office:document>
\ No newline at end of file
diff --git a/documentation-api/latereasoning.graphml b/documentation-api/latereasoning.graphml
index 481aca0..25c65a6 100644
--- a/documentation-api/latereasoning.graphml
+++ b/documentation-api/latereasoning.graphml
@@ -1,545 +1,552 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:java="http://www.yworks.com/xml/yfiles-common/1.0/java" xmlns:sys="http://www.yworks.com/xml/yfiles-common/markup/primitives/2.0" xmlns:x="http://www.yworks.com/xml/yfiles-common/markup/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml/1.1/ygraphml.xsd">
<!--Created by yEd 3.18.1-->
<key attr.name="Description" attr.type="string" for="graph" id="d0"/>
<key for="port" id="d1" yfiles.type="portgraphics"/>
<key for="port" id="d2" yfiles.type="portgeometry"/>
<key for="port" id="d3" yfiles.type="portuserdata"/>
<key attr.name="Property 1" attr.type="string" for="node" id="d4">
<default xml:space="preserve"/>
</key>
<key attr.name="url" attr.type="string" for="node" id="d5"/>
<key attr.name="description" attr.type="string" for="node" id="d6"/>
<key for="node" id="d7" yfiles.type="nodegraphics"/>
<key for="graphml" id="d8" yfiles.type="resources"/>
<key attr.name="url" attr.type="string" for="edge" id="d9"/>
<key attr.name="description" attr.type="string" for="edge" id="d10"/>
<key for="edge" id="d11" yfiles.type="edgegraphics"/>
<graph edgedefault="directed" id="G">
<data key="d0" xml:space="preserve"/>
<node id="n0" yfiles.foldertype="group">
<data key="d7">
<y:TableNode configuration="YED_TABLE_NODE">
<y:Geometry height="493.14999999999986" width="1170.1863671874994" x="160.62499999999994" y="-344.2918182373043"/>
<y:Fill color="#ECF5FF" color2="#0042F440" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="20.7578125" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="166.59765625" x="501.79435546874976" xml:space="preserve" y="4.0">Late Reasonng Diagram</y:NodeLabel>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="17.40625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="30.677734375" x="143.6611328125" xml:space="preserve" y="33.0">Pass<y:LabelModel><y:ColumnNodeLabelModel offset="3.0"/></y:LabelModel><y:ModelParameter><y:ColumnNodeLabelModelParameter id="column_0" inside="true" verticalPosition="0.0"/></y:ModelParameter></y:NodeLabel>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="17.40625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="74.7109375" x="508.65771484374983" xml:space="preserve" y="33.0">Interpretation<y:LabelModel><y:ColumnNodeLabelModel offset="3.0"/></y:LabelModel><y:ModelParameter><y:ColumnNodeLabelModelParameter id="column_1" inside="true" verticalPosition="0.0"/></y:ModelParameter></y:NodeLabel>
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="21.578125" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="163.6533203125" x="503.26652343749976" xml:space="preserve" y="4.0">Late Reasonng Diagram</y:NodeLabel>
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.0625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="30.484375" x="143.7578125" xml:space="preserve" y="33.0">Pass<y:LabelModel><y:ColumnNodeLabelModel offset="3.0"/></y:LabelModel><y:ModelParameter><y:ColumnNodeLabelModelParameter id="column_0" inside="true" verticalPosition="0.0"/></y:ModelParameter></y:NodeLabel>
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.0625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="76.181640625" x="507.92236328124983" xml:space="preserve" y="33.0">Interpretation<y:LabelModel><y:ColumnNodeLabelModel offset="3.0"/></y:LabelModel><y:ModelParameter><y:ColumnNodeLabelModelParameter id="column_1" inside="true" verticalPosition="0.0"/></y:ModelParameter></y:NodeLabel>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" hasText="false" height="4.0" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="4.0" x="583.0931835937497" y="244.57499999999993">
<y:LabelModel>
<y:SmartNodeLabelModel distance="4.0"/>
</y:LabelModel>
<y:ModelParameter>
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
</y:ModelParameter>
</y:NodeLabel>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="17.40625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="60.6953125" x="941.7587109374995" xml:space="preserve" y="33.0">Transcend<y:LabelModel><y:ColumnNodeLabelModel offset="3.0"/></y:LabelModel><y:ModelParameter><y:ColumnNodeLabelModelParameter id="column_2" inside="true" verticalPosition="0.0"/></y:ModelParameter></y:NodeLabel>
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.0625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="60.61328125" x="941.7997265624995" xml:space="preserve" y="33.0">Transcend<y:LabelModel><y:ColumnNodeLabelModel offset="3.0"/></y:LabelModel><y:ModelParameter><y:ColumnNodeLabelModelParameter id="column_2" inside="true" verticalPosition="0.0"/></y:ModelParameter></y:NodeLabel>
<y:StyleProperties>
<y:Property class="java.awt.Color" name="yed.table.section.color" value="#7192b2"/>
<y:Property class="java.lang.Double" name="yed.table.header.height" value="24.0"/>
<y:Property class="java.awt.Color" name="yed.table.lane.color.main" value="#c4d7ed"/>
<y:Property class="java.awt.Color" name="yed.table.lane.color.alternating" value="#abc8e2"/>
<y:Property class="java.awt.Color" name="yed.table.header.color.alternating" value="#abc8e2"/>
<y:Property class="java.lang.String" name="yed.table.lane.style" value="lane.style.columns"/>
<y:Property class="java.awt.Color" name="yed.table.header.color.main" value="#c4d7ed"/>
</y:StyleProperties>
<y:State autoResize="true" closed="false" closedHeight="80.0" closedWidth="100.0"/>
<y:Insets bottom="0" bottomF="0.0" left="0" leftF="0.0" right="0" rightF="0.0" top="0" topF="0.0"/>
<y:BorderInsets bottom="71" bottomF="71.11204177848737" left="0" leftF="0.0" right="48" rightF="48.0" top="0" topF="0.0"/>
<y:Table autoResizeTable="true" defaultColumnWidth="120.0" defaultMinimumColumnWidth="80.0" defaultMinimumRowHeight="50.0" defaultRowHeight="80.0">
<y:DefaultColumnInsets bottom="0.0" left="0.0" right="0.0" top="24.0"/>
<y:DefaultRowInsets bottom="0.0" left="0.0" right="0.0" top="0.0"/>
<y:Insets bottom="0.0" left="0.0" right="0.0" top="30.0"/>
<y:Columns>
<y:Column id="column_0" minimumWidth="80.0" width="318.0">
<y:Insets bottom="0.0" left="0.0" right="0.0" top="24.0"/>
</y:Column>
<y:Column id="column_1" minimumWidth="80.0" width="456.02636718749966">
<y:Insets bottom="0.0" left="0.0" right="0.0" top="24.0"/>
</y:Column>
<y:Column id="column_2" minimumWidth="80.0" width="396.15999999999974">
<y:Insets bottom="0.0" left="0.0" right="0.0" top="24.0"/>
</y:Column>
</y:Columns>
<y:Rows>
<y:Row height="439.14999999999986" id="row_0" minimumHeight="50.0">
<y:Insets bottom="0.0" left="0.0" right="0.0" top="0.0"/>
</y:Row>
</y:Rows>
</y:Table>
</y:TableNode>
</data>
<graph edgedefault="directed" id="n0:">
<node id="n0::n0">
<data key="d5" xml:space="preserve"/>
<data key="d7">
<y:UMLClassNode>
<y:Geometry height="75.0" width="111.0" x="183.12499999999994" y="-162.89181823730445"/>
<y:Fill color="#FFCC00" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="33.046875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="97.18359375" x="6.908203125" xml:space="preserve" y="25.40625">LateReasoning
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="34.46875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="91.19775390625" x="9.901123046875" xml:space="preserve" y="26.0625">LateReasoning
Scope<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="-0.03703090122767855" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="17.40625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="36.68359375" x="37.158203125" xml:space="preserve" y="28.796875">fvffdfd<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="30.8125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="51.35546875" x="29.822265625" xml:space="preserve" y="22.09375">vdffldkjfd
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.0625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="40.03515625" x="35.482421875" xml:space="preserve" y="28.46875">fvffdfd<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="32.125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="54.501953125" x="28.2490234375" xml:space="preserve" y="21.4375">vdffldkjfd
fdfdfd<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:UML clipContent="true" constraint="" hasDetailsColor="false" omitDetails="false" stereotype="pass" use3DEffect="true">
<y:AttributeLabel xml:space="preserve"/>
<y:MethodLabel xml:space="preserve"/>
</y:UML>
</y:UMLClassNode>
</data>
</node>
<node id="n0::n1">
<data key="d5" xml:space="preserve"/>
<data key="d7">
<y:UMLClassNode>
- <y:Geometry height="116.7890625" width="119.3984375" x="350.92578124999994" y="-183.78634948730445"/>
+ <y:Geometry height="145.7890625" width="119.3984375" x="350.92578124999994" y="-183.78634948730445"/>
<y:Fill color="#FFCC00" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="47.5703125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="97.18359375" x="11.107421875" xml:space="preserve" y="25.40625">LateReasoning
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="49.703125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="91.19775390625" x="14.100341796875" xml:space="preserve" y="26.0625">LateReasoning
DFAPass
Decorator<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="-0.03703090122767855" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="17.40625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="36.68359375" x="41.357421875" xml:space="preserve" y="49.69140625">fvffdfd<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="30.8125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="51.35546875" x="34.021484375" xml:space="preserve" y="42.98828125">vdffldkjfd
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.0625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="40.03515625" x="39.681640625" xml:space="preserve" y="63.86328125">fvffdfd<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="32.125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="54.501953125" x="32.4482421875" xml:space="preserve" y="56.83203125">vdffldkjfd
fdfdfd<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:UML clipContent="true" constraint="" hasDetailsColor="false" omitDetails="false" stereotype="pass" use3DEffect="true">
<y:AttributeLabel xml:space="preserve"/>
<y:MethodLabel xml:space="preserve">registerLateScope
processAnnotations</y:MethodLabel>
</y:UML>
</y:UMLClassNode>
</data>
</node>
<node id="n0::n2">
<data key="d5" xml:space="preserve"/>
<data key="d7">
<y:UMLClassNode>
<y:Geometry height="34.0" width="100.0" x="360.62499999999994" y="-267.39181823730434"/>
<y:Fill color="#CCCCCC" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="18.5234375" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="61.078125" x="19.4609375" xml:space="preserve" y="3.0">DFAPass<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="-0.03703090122767855" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="19.234375" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="57.0791015625" x="21.46044921875" xml:space="preserve" y="3.0">DFAPass<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="-0.03703090122767855" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:UML clipContent="true" constraint="" hasDetailsColor="false" omitDetails="false" stereotype="" use3DEffect="true">
<y:AttributeLabel xml:space="preserve"/>
<y:MethodLabel xml:space="preserve"/>
</y:UML>
</y:UMLClassNode>
</data>
</node>
<node id="n0::n3">
<data key="d5" xml:space="preserve"/>
<data key="d7">
<y:UMLClassNode>
<y:Geometry height="28.0" width="100.0" x="160.62499999999994" y="-62.64181823730439"/>
<y:Fill color="#CCCCCC" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="18.5234375" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="79.12451171875" x="10.437744140625" xml:space="preserve" y="3.0">ICodeScope<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="-0.03703090122767855" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="19.234375" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="74.49072265625" x="12.754638671875" xml:space="preserve" y="3.0">ICodeScope<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="-0.03703090122767855" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:UML clipContent="true" constraint="" hasDetailsColor="false" omitDetails="false" stereotype="" use3DEffect="true">
<y:AttributeLabel xml:space="preserve"/>
<y:MethodLabel xml:space="preserve"/>
</y:UML>
</y:UMLClassNode>
</data>
</node>
<node id="n0::n4">
<data key="d5" xml:space="preserve"/>
<data key="d7">
<y:UMLClassNode>
<y:Geometry height="66.0" width="100.0" x="180.62499999999994" y="-12.641818237304335"/>
<y:Fill color="#FFCC00" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="33.046875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="77.68359375" x="11.158203125" xml:space="preserve" y="25.40625">LateSymbol
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="34.46875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="73.32275390625" x="13.338623046875" xml:space="preserve" y="26.0625">LateSymbol
Recognized<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="-0.03703090122767855" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:UML clipContent="true" constraint="" hasDetailsColor="false" omitDetails="false" stereotype="analysis" use3DEffect="true">
<y:AttributeLabel xml:space="preserve"/>
<y:MethodLabel xml:space="preserve"/>
</y:UML>
</y:UMLClassNode>
</data>
</node>
<node id="n0::n5">
<data key="d5" xml:space="preserve"/>
<data key="d7">
<y:UMLClassNode>
<y:Geometry height="28.0" width="100.0" x="355.52692893401" y="-7.124275090096319"/>
<y:Fill color="#CCCCCC" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="18.5234375" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="69.0" x="15.5" xml:space="preserve" y="3.0">DFAGraph<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="-0.03703090122767855" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="19.234375" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="63.50927734375" x="18.245361328125" xml:space="preserve" y="3.0">DFAGraph<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="-0.03703090122767855" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:UML clipContent="true" constraint="" hasDetailsColor="false" omitDetails="false" stereotype="" use3DEffect="true">
<y:AttributeLabel xml:space="preserve"/>
<y:MethodLabel xml:space="preserve"/>
</y:UML>
</y:UMLClassNode>
</data>
</node>
<node id="n0::n6">
<data key="d5" xml:space="preserve"/>
<data key="d7">
<y:UMLClassNode>
- <y:Geometry height="115.671875" width="169.4140625" x="618.825" y="-187.6180682373045"/>
+ <y:Geometry height="131.671875" width="169.4140625" x="618.825" y="-187.6180682373045"/>
<y:Fill color="#FFCC00" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="33.046875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="97.18359375" x="36.115234375" xml:space="preserve" y="25.40625">LateReasoning
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="34.46875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="91.19775390625" x="39.108154296875" xml:space="preserve" y="26.0625">LateReasoning
Compiler<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="-0.03703090122767855" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:UML clipContent="true" constraint="" hasDetailsColor="false" omitDetails="false" stereotype="compilation" use3DEffect="true">
<y:AttributeLabel xml:space="preserve"/>
<y:MethodLabel xml:space="preserve">processSwitchLateStatement
compileAutoExpand
-</y:MethodLabel>
+findKeys</y:MethodLabel>
</y:UML>
</y:UMLClassNode>
</data>
</node>
<node id="n0::n7">
<data key="d5" xml:space="preserve"/>
<data key="d7">
<y:UMLClassNode>
- <y:Geometry height="103.3828125" width="107.18359375" x="1020.4432031249999" y="-184.78322448730432"/>
+ <y:Geometry height="130.3828125" width="107.18359375" x="1020.4432031249999" y="-193.78322448730432"/>
<y:Fill color="#FFCC00" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="47.5703125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="97.18359375" x="5.0" xml:space="preserve" y="25.40625">LateReasoning
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="49.703125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="91.19775390625" x="7.992919921875" xml:space="preserve" y="26.0625">LateReasoning
Transcend
Decorator<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="-0.03703090122767855" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:UML clipContent="true" constraint="" hasDetailsColor="false" omitDetails="false" stereotype="aux" use3DEffect="true">
<y:AttributeLabel xml:space="preserve"/>
- <y:MethodLabel xml:space="preserve">findKeys</y:MethodLabel>
+ <y:MethodLabel xml:space="preserve">queryLate
+processSolution</y:MethodLabel>
</y:UML>
</y:UMLClassNode>
</data>
</node>
<node id="n0::n8">
<data key="d5" xml:space="preserve"/>
<data key="d7">
<y:UMLClassNode>
<y:Geometry height="43.0" width="100.0" x="1023.8349999999996" y="-290.2918182373043"/>
<y:Fill color="#CCCCCC" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="33.046875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="69.74267578125" x="15.128662109375" xml:space="preserve" y="3.0">Transcend
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="34.46875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="66.15625" x="16.921875" xml:space="preserve" y="3.0">Transcend
Layer<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="-0.03703090122767855" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:UML clipContent="true" constraint="" hasDetailsColor="false" omitDetails="false" stereotype="" use3DEffect="true">
<y:AttributeLabel xml:space="preserve"/>
<y:MethodLabel xml:space="preserve"/>
</y:UML>
</y:UMLClassNode>
</data>
</node>
<node id="n0::n9">
<data key="d5" xml:space="preserve"/>
<data key="d7">
<y:UMLClassNode>
- <y:Geometry height="88.859375" width="116.552734375" x="1166.2586328124994" y="-177.52150573730432"/>
+ <y:Geometry height="95.859375" width="116.552734375" x="1166.2586328124994" y="-184.52150573730432"/>
<y:Fill color="#FFCC00" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="33.046875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="106.552734375" x="5.0" xml:space="preserve" y="25.40625">LateAnnotations
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="34.46875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="100.61767578125" x="7.967529296875" xml:space="preserve" y="26.0625">LateAnnotations
Group<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="-0.03703090122767855" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:UML clipContent="true" constraint="" hasDetailsColor="false" omitDetails="false" stereotype="aux" use3DEffect="true">
<y:AttributeLabel xml:space="preserve"/>
<y:MethodLabel xml:space="preserve">select()</y:MethodLabel>
</y:UML>
</y:UMLClassNode>
</data>
</node>
<node id="n0::n10">
<data key="d5" xml:space="preserve"/>
<data key="d7">
<y:UMLClassNode>
<y:Geometry height="61.0" width="100.0" x="1174.5349999999999" y="-27.841818237304324"/>
<y:Fill color="#FFCC00" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="33.046875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="72.5927734375" x="13.70361328125" xml:space="preserve" y="25.40625">Late
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="34.46875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="68.49853515625" x="15.750732421875" xml:space="preserve" y="26.0625">Late
Annotation<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="-0.03703090122767855" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:UML clipContent="true" constraint="" hasDetailsColor="false" omitDetails="false" stereotype="aux" use3DEffect="true">
<y:AttributeLabel xml:space="preserve"/>
<y:MethodLabel xml:space="preserve"/>
</y:UML>
</y:UMLClassNode>
</data>
</node>
<node id="n0::n11">
<data key="d7">
<y:GenericNode configuration="com.yworks.flowchart.cloud">
<y:Geometry height="40.8125" width="70.6953125" x="1042.7898074036061" y="36.933639984208185"/>
<y:Fill color="#E8EEF7" color2="#B7C9E3" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="30.8125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="60.6953125" x="5.0" xml:space="preserve" y="5.0">Transcend
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="32.125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="60.61328125" x="5.041015625" xml:space="preserve" y="4.34375">Transcend
program<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
</y:GenericNode>
</data>
</node>
<node id="n0::n12">
<data key="d7">
<y:ShapeNode>
<y:Geometry height="46.57249999999999" width="61.377578124999985" x="279.5392109375001" y="-250.9342499999999"/>
<y:Fill color="#00FFFF" transparent="false"/>
<y:BorderStyle color="#000000" raised="false" type="line" width="1.0"/>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="30.8125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="52.017578125" x="4.680000000000007" xml:space="preserve" y="7.8799999999999955">DFA
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="32.125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="51.00390625" x="5.186835937500007" xml:space="preserve" y="7.2237499999999955">DFA
PassDec<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:Shape type="star8"/>
</y:ShapeNode>
</data>
</node>
<node id="n0::n13">
<data key="d5" xml:space="preserve"/>
<data key="d7">
<y:UMLClassNode>
<y:Geometry height="43.046875" width="97.78271484375" x="652.5486425781247" y="-267.2114374999999"/>
<y:Fill color="#C0C0C0" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="33.046875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="87.78271484375" x="5.0" xml:space="preserve" y="3.0">Interpretation
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="34.46875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="84.1708984375" x="6.805908203125" xml:space="preserve" y="3.0">Interpretation
Scope<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:UML clipContent="true" constraint="" hasDetailsColor="false" omitDetails="false" stereotype="" use3DEffect="true">
<y:AttributeLabel xml:space="preserve"/>
<y:MethodLabel xml:space="preserve"/>
</y:UML>
</y:UMLClassNode>
</data>
</node>
<node id="n0::n14">
<data key="d7">
<y:ShapeNode>
<y:Geometry height="53.00758629441623" width="53.52207177982234" x="956.9023549730332" y="-244.3871637055837"/>
<y:Fill color="#00FFFF" transparent="false"/>
<y:BorderStyle color="#000000" raised="false" type="line" width="1.0"/>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="44.21875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="34.673828125" x="9.424121827411227" xml:space="preserve" y="4.394418147208114">LR
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="46.1875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="34.57421875" x="9.473926514911227" xml:space="preserve" y="3.410043147208114">LR
Trans
Dec<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:Shape type="star8"/>
</y:ShapeNode>
</data>
</node>
</graph>
</node>
<node id="n1">
<data key="d5" xml:space="preserve"/>
<data key="d7">
<y:UMLClassNode>
<y:Geometry height="34.24520648967541" width="63.841796875" x="1270.3964872557149" y="197.92477876106204"/>
<y:Fill color="#C0C0C0" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="33.046875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="53.841796875" x="5.0" xml:space="preserve" y="3.0">AST
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="34.46875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="51.76611328125" x="6.037841796875" xml:space="preserve" y="3.0">AST
getType<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="-0.03703090122767855" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="17.40625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="36.68359375" x="13.5791015625" xml:space="preserve" y="8.419478244837705">fvffdfd<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="30.8125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="51.35546875" x="6.2431640625" xml:space="preserve" y="1.7163532448377055">vdffldkjfd
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.0625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="40.03515625" x="11.9033203125" xml:space="preserve" y="8.091353244837705">fvffdfd<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="32.125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="54.501953125" x="4.669921875" xml:space="preserve" y="1.0601032448377055">vdffldkjfd
fdfdfd<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:UML clipContent="true" constraint="" hasDetailsColor="false" omitDetails="false" stereotype="" use3DEffect="true">
<y:AttributeLabel xml:space="preserve"/>
<y:MethodLabel xml:space="preserve"/>
</y:UML>
</y:UMLClassNode>
</data>
</node>
<node id="n2">
<data key="d5" xml:space="preserve"/>
<data key="d7">
<y:UMLClassNode>
<y:Geometry height="28.0" width="152.0234375" x="1113.5850178316282" y="162.5569180494092"/>
<y:Fill color="#C0C0C0" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="18.5234375" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="142.0234375" x="5.0" xml:space="preserve" y="3.0">dereferenceSlaveType<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="19.234375" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="135.61865234375" x="8.202392578125" xml:space="preserve" y="3.0">dereferenceSlaveType<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:UML clipContent="true" constraint="" hasDetailsColor="false" omitDetails="false" stereotype="" use3DEffect="true">
<y:AttributeLabel xml:space="preserve"/>
<y:MethodLabel xml:space="preserve"/>
</y:UML>
</y:UMLClassNode>
</data>
</node>
<edge id="n0::e0" source="n0::n5" target="n0::n4">
<data key="d9" xml:space="preserve"/>
<data key="d11">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="none" target="plain"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n0::e1" source="n0::n0" target="n0::n4">
<data key="d9" xml:space="preserve"/>
<data key="d11">
<y:PolyLineEdge>
<y:Path sx="-8.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="none" target="plain"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n0::e2" source="n0::n0" target="n0::n3">
<data key="d9" xml:space="preserve"/>
<data key="d11">
<y:PolyLineEdge>
<y:Path sx="-28.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="line" width="1.0"/>
<y:Arrows source="none" target="none"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n0::e3" source="n0::n1" target="n0::n0">
<data key="d9" xml:space="preserve"/>
<data key="d11">
<y:PolyLineEdge>
- <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
+ <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0">
+ <y:Point x="324.62499999999994" y="-110.89181823730445"/>
+ <y:Point x="324.62499999999994" y="-125.39181823730445"/>
+ </y:Path>
<y:LineStyle color="#000000" type="line" width="1.0"/>
<y:Arrows source="diamond" target="none"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n0::e4" source="n0::n1" target="n0::n2">
<data key="d9" xml:space="preserve"/>
<data key="d11">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="line" width="1.0"/>
<y:Arrows source="none" target="white_delta"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n0::e5" source="n0::n7" target="n0::n9">
<data key="d9" xml:space="preserve"/>
<data key="d11">
<y:PolyLineEdge>
- <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
+ <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0">
+ <y:Point x="1149.2849999999996" y="-128.59181823730432"/>
+ <y:Point x="1149.2849999999996" y="-136.59181823730432"/>
+ </y:Path>
<y:LineStyle color="#000000" type="line" width="1.0"/>
<y:Arrows source="diamond" target="none"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n0::e6" source="n0::n9" target="n0::n10">
<data key="d9" xml:space="preserve"/>
<data key="d11">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0">
<y:Point x="1224.5349999999994" y="-59.216818237304324"/>
<y:Point x="1224.5349999999999" y="-59.216818237304324"/>
</y:Path>
<y:LineStyle color="#000000" type="line" width="1.0"/>
<y:Arrows source="diamond" target="none"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n0::e7" source="n0::n7" target="n0::n8">
<data key="d9" xml:space="preserve"/>
<data key="d11">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0">
<y:Point x="1074.0349999999999" y="-193.34181823730432"/>
<y:Point x="1073.8349999999996" y="-193.34181823730432"/>
</y:Path>
<y:LineStyle color="#000000" type="line" width="1.0"/>
<y:Arrows source="none" target="white_delta"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n0::e8" source="n0::n5" target="n0::n11">
<data key="d11">
<y:GenericEdge configuration="com.yworks.edge.framed">
<y:Path sx="0.055000000000063665" sy="3.253818237304529" tx="0.0" ty="0.0">
<y:Point x="405.5819289340101" y="57.33988998420841"/>
</y:Path>
<y:LineStyle color="#000000" type="line" width="3.0"/>
<y:Arrows source="none" target="standard"/>
</y:GenericEdge>
</data>
</edge>
<edge id="n0::e9" source="n0::n11" target="n0::n7">
<data key="d11">
<y:GenericEdge configuration="com.yworks.edge.framed">
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="line" width="3.0"/>
<y:Arrows source="none" target="standard"/>
</y:GenericEdge>
</data>
</edge>
<edge id="n0::e10" source="n0::n6" target="n0::n10">
<data key="d9" xml:space="preserve"/>
<data key="d11">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="none" target="plain"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n0::e11" source="n0::n6" target="n0::n13">
<data key="d9" xml:space="preserve"/>
<data key="d11">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="line" width="1.0"/>
<y:Arrows source="white_diamond" target="none"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n0::e12" source="n0::n1" target="n0::n5">
<data key="d9" xml:space="preserve"/>
<data key="d11">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="none" target="plain"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n0::e13" source="n0::n12" target="n0::n1">
<data key="d9" xml:space="preserve"/>
<data key="d11">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="none" target="plain"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n0::e14" source="n0::n14" target="n0::n7">
<data key="d9" xml:space="preserve"/>
<data key="d11">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="none" target="plain"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="e0" source="n0::n10" target="n1">
<data key="d9" xml:space="preserve"/>
<data key="d11">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0">
<y:Point x="1224.5349999999999" y="215.04738200589975"/>
</y:Path>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="none" target="plain"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="e1" source="n0::n10" target="n2">
<data key="d9" xml:space="preserve"/>
<data key="d11">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0">
<y:Point x="1189.5967365816282" y="2.6581817626956763"/>
</y:Path>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="none" target="plain"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
</graph>
<data key="d8">
<y:Resources/>
</data>
</graphml>
diff --git a/documentation-api/latex.graphml b/documentation-api/latex.graphml
index 7c0447f..818a882 100644
--- a/documentation-api/latex.graphml
+++ b/documentation-api/latex.graphml
@@ -1,834 +1,819 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:java="http://www.yworks.com/xml/yfiles-common/1.0/java" xmlns:sys="http://www.yworks.com/xml/yfiles-common/markup/primitives/2.0" xmlns:x="http://www.yworks.com/xml/yfiles-common/markup/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml/1.1/ygraphml.xsd">
<!--Created by yEd 3.18.1-->
<key attr.name="Description" attr.type="string" for="graph" id="d0"/>
<key for="port" id="d1" yfiles.type="portgraphics"/>
<key for="port" id="d2" yfiles.type="portgeometry"/>
<key for="port" id="d3" yfiles.type="portuserdata"/>
<key attr.name="url" attr.type="string" for="node" id="d4"/>
<key attr.name="description" attr.type="string" for="node" id="d5"/>
<key for="node" id="d6" yfiles.type="nodegraphics"/>
<key for="graphml" id="d7" yfiles.type="resources"/>
<key attr.name="url" attr.type="string" for="edge" id="d8"/>
<key attr.name="description" attr.type="string" for="edge" id="d9"/>
<key for="edge" id="d10" yfiles.type="edgegraphics"/>
<graph edgedefault="directed" id="G">
<data key="d0" xml:space="preserve"/>
<node id="n0" yfiles.foldertype="group">
<data key="d6">
<y:TableNode configuration="YED_TABLE_NODE">
<y:Geometry height="301.2117579823405" width="799.186140432126" x="180.6552734375001" y="-192.46513398234035"/>
<y:Fill color="#ECF5FF" color2="#0042F440" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="21.578125" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="40.54052734375" x="379.322806544188" xml:space="preserve" y="4.0">Latex</y:NodeLabel>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.0625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="68.59375" x="136.27219521606293" xml:space="preserve" y="33.0">Compilation<y:LabelModel><y:ColumnNodeLabelModel offset="3.0"/></y:LabelModel><y:ModelParameter><y:ColumnNodeLabelModelParameter id="column_0" inside="true" verticalPosition="0.0"/></y:ModelParameter></y:NodeLabel>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.0625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="60.61328125" x="652.3354998071259" xml:space="preserve" y="33.0">Transcend<y:LabelModel><y:ColumnNodeLabelModel offset="3.0"/></y:LabelModel><y:ModelParameter><y:ColumnNodeLabelModelParameter id="column_1" inside="true" verticalPosition="0.0"/></y:ModelParameter></y:NodeLabel>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.0625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="76.181640625" x="415.52732011962587" xml:space="preserve" y="33.0">Interpretation<y:LabelModel><y:ColumnNodeLabelModel offset="3.0"/></y:LabelModel><y:ModelParameter><y:ColumnNodeLabelModelParameter id="column_2" inside="true" verticalPosition="0.0"/></y:ModelParameter></y:NodeLabel>
<y:StyleProperties>
<y:Property class="java.awt.Color" name="yed.table.section.color" value="#7192b2"/>
<y:Property class="java.lang.Double" name="yed.table.header.height" value="24.0"/>
<y:Property class="java.awt.Color" name="yed.table.lane.color.main" value="#c4d7ed"/>
<y:Property class="java.awt.Color" name="yed.table.lane.color.alternating" value="#abc8e2"/>
<y:Property class="java.awt.Color" name="yed.table.header.color.alternating" value="#abc8e2"/>
<y:Property class="java.lang.String" name="yed.table.lane.style" value="lane.style.columns"/>
<y:Property class="java.awt.Color" name="yed.table.header.color.main" value="#c4d7ed"/>
</y:StyleProperties>
<y:State autoResize="true" closed="false" closedHeight="80.0" closedWidth="100.0"/>
<y:Insets bottom="0" bottomF="0.0" left="0" leftF="0.0" right="0" rightF="0.0" top="0" topF="0.0"/>
<y:BorderInsets bottom="33" bottomF="33.42941839334418" left="0" leftF="0.0" right="106" rightF="106.4960000000001" top="0" topF="0.0"/>
<y:Table autoResizeTable="true" defaultColumnWidth="120.0" defaultMinimumColumnWidth="80.0" defaultMinimumRowHeight="50.0" defaultRowHeight="80.0">
<y:DefaultColumnInsets bottom="0.0" left="0.0" right="0.0" top="24.0"/>
<y:DefaultRowInsets bottom="0.0" left="0.0" right="0.0" top="0.0"/>
<y:Insets bottom="0.0" left="0.0" right="0.0" top="30.0"/>
<y:Columns>
<y:Column id="column_0" minimumWidth="80.0" width="341.13814043212585">
<y:Insets bottom="0.0" left="0.0" right="0.0" top="24.0"/>
</y:Column>
<y:Column id="column_2" minimumWidth="80.0" width="224.95999999999992">
<y:Insets bottom="0.0" left="0.0" right="0.0" top="24.0"/>
</y:Column>
<y:Column id="column_1" minimumWidth="80.0" width="233.0880000000002">
<y:Insets bottom="0.0" left="0.0" right="0.0" top="24.0"/>
</y:Column>
</y:Columns>
<y:Rows>
<y:Row height="247.2117579823405" id="row_0" minimumHeight="50.0">
<y:Insets bottom="0.0" left="0.0" right="0.0" top="0.0"/>
</y:Row>
</y:Rows>
</y:Table>
</y:TableNode>
</data>
<graph edgedefault="directed" id="n0:">
<node id="n0::n0">
<data key="d6">
<y:UMLClassNode>
<y:Geometry height="43.046875" width="94.88818359375" x="189.2599082031249" y="25.265718750000076"/>
<y:Fill color="#FFCC00" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="34.46875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="79.638671875" x="7.624755859375" xml:space="preserve" y="3.0">ExtraArgs
FnInvocation<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:UML clipContent="true" constraint="" hasDetailsColor="false" omitDetails="false" stereotype="" use3DEffect="true">
<y:AttributeLabel xml:space="preserve"/>
<y:MethodLabel xml:space="preserve"/>
</y:UML>
</y:UMLClassNode>
</data>
</node>
<node id="n0::n1">
<data key="d4" xml:space="preserve"/>
<data key="d6">
<y:UMLClassNode>
<y:Geometry height="57.5703125" width="86.9599609375" x="193.20801953124987" y="-76.87315624999997"/>
<y:Fill color="#FFCC00" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="49.703125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="72.21826171875" x="7.370849609375" xml:space="preserve" y="3.0">Latex
BruteScope
Dec<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:UML clipContent="true" constraint="" hasDetailsColor="false" omitDetails="false" stereotype="" use3DEffect="true">
<y:AttributeLabel xml:space="preserve"/>
<y:MethodLabel xml:space="preserve"/>
</y:UML>
</y:UMLClassNode>
</data>
</node>
<node id="n0::n2">
<data key="d4" xml:space="preserve"/>
<data key="d6">
<y:UMLClassNode>
<y:Geometry height="30.0" width="114.39453125" x="180.6552734375001" y="-138.46513398234035"/>
<y:Fill color="#CCCCCC" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="19.234375" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="98.16748046875" x="8.113525390625" xml:space="preserve" y="3.0">ICodeScopeUnit<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="-0.03703090122767855" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:UML clipContent="true" constraint="" hasDetailsColor="false" omitDetails="false" stereotype="" use3DEffect="true">
<y:AttributeLabel xml:space="preserve"/>
<y:MethodLabel xml:space="preserve"/>
</y:UML>
</y:UMLClassNode>
</data>
</node>
<node id="n0::n3">
<data key="d6">
<y:UMLClassNode>
<y:Geometry height="57.5703125" width="102.82275390625" x="334.36462304687484" y="-77.20915624999992"/>
<y:Fill color="#FFCC00" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="49.703125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="86.69091796875" x="8.06591796875" xml:space="preserve" y="3.0">Latex
BruteFunction
Dec<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:UML clipContent="true" constraint="" hasDetailsColor="false" omitDetails="false" stereotype="" use3DEffect="true">
<y:AttributeLabel xml:space="preserve"/>
<y:MethodLabel xml:space="preserve"/>
</y:UML>
</y:UMLClassNode>
</data>
</node>
<node id="n0::n4">
<data key="d4" xml:space="preserve"/>
<data key="d6">
<y:UMLClassNode>
<y:Geometry height="28.0" width="97.75732421875" x="335.14147744262544" y="-137.1598241279998"/>
<y:Fill color="#C0C0C0" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="19.234375" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="82.4189453125" x="7.669189453125" xml:space="preserve" y="3.0">IFunctionUnit<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:UML clipContent="true" constraint="" hasDetailsColor="false" omitDetails="false" stereotype="" use3DEffect="true">
<y:AttributeLabel xml:space="preserve"/>
<y:MethodLabel xml:space="preserve"/>
</y:UML>
</y:UMLClassNode>
</data>
</node>
<node id="n0::n5">
<data key="d4" xml:space="preserve"/>
<data key="d6">
<y:UMLClassNode>
<y:Geometry height="30.0" width="128.12451171875" x="570.5217441406251" y="-126.27999999999997"/>
<y:Fill color="#FFCC00" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="19.234375" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="111.783203125" x="8.170654296875" xml:space="preserve" y="3.0">getSubjectDomain<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:UML clipContent="true" constraint="" hasDetailsColor="false" omitDetails="false" stereotype="" use3DEffect="true">
<y:AttributeLabel xml:space="preserve"/>
<y:MethodLabel xml:space="preserve"/>
</y:UML>
</y:UMLClassNode>
</data>
</node>
<node id="n0::n6">
<data key="d6">
<y:UMLClassNode>
<y:Geometry height="43.046875" width="51.57177734375" x="820.4941113281249" y="-76.30628124999996"/>
<y:Fill color="#FFCC00" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="34.46875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="38.56298828125" x="6.50439453125" xml:space="preserve" y="3.0">Latex
Query<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:UML clipContent="true" constraint="" hasDetailsColor="false" omitDetails="false" stereotype="" use3DEffect="true">
<y:AttributeLabel xml:space="preserve"/>
<y:MethodLabel xml:space="preserve"/>
</y:UML>
</y:UMLClassNode>
</data>
</node>
<node id="n0::n7">
<data key="d4" xml:space="preserve"/>
<data key="d6">
<y:UMLClassNode>
<y:Geometry height="28.0" width="55.18359375" x="818.161820119626" y="-135.99964825599963"/>
<y:Fill color="#C0C0C0" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="19.234375" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="42.35888671875" x="6.412353515625" xml:space="preserve" y="3.0">IQuery<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:UML clipContent="true" constraint="" hasDetailsColor="false" omitDetails="false" stereotype="" use3DEffect="true">
<y:AttributeLabel xml:space="preserve"/>
<y:MethodLabel xml:space="preserve"/>
</y:UML>
</y:UMLClassNode>
</data>
</node>
<node id="n0::n8">
<data key="d4" xml:space="preserve"/>
<data key="d6">
<y:UMLClassNode>
<y:Geometry height="30.0" width="114.4072265625" x="580.2603867187496" y="-59.25599999999994"/>
<y:Fill color="#C0C0C0" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="19.234375" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="98.1611328125" x="8.123046875" xml:space="preserve" y="3.0">collapseColumn<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:UML clipContent="true" constraint="" hasDetailsColor="false" omitDetails="false" stereotype="" use3DEffect="true">
<y:AttributeLabel xml:space="preserve"/>
<y:MethodLabel xml:space="preserve"/>
</y:UML>
</y:UMLClassNode>
</data>
</node>
<node id="n0::n9">
<data key="d6">
<y:ShapeNode>
<y:Geometry height="30.0" width="46.677734375" x="756.9171328125" y="-116.655824128"/>
<y:Fill color="#00FFFF" transparent="false"/>
<y:BorderStyle color="#000000" raised="false" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="32.125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="34.978515625" x="5.849609375" xml:space="preserve" y="-1.0625">Latex
Query<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:Shape type="star6"/>
</y:ShapeNode>
</data>
</node>
<node id="n0::n10">
<data key="d6">
<y:UMLClassNode>
<y:Geometry height="57.5703125" width="86.48447265624998" x="592.3191508036989" y="17.74689310665596"/>
<y:Fill color="#C0C0C0" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="49.703125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="68.48583984375" x="8.999316406249989" xml:space="preserve" y="3.0">represent
Trans
Expression<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:UML clipContent="true" constraint="" hasDetailsColor="false" omitDetails="false" stereotype="" use3DEffect="true">
<y:AttributeLabel xml:space="preserve"/>
<y:MethodLabel xml:space="preserve"/>
</y:UML>
</y:UMLClassNode>
</data>
</node>
</graph>
</node>
<node id="n1" yfiles.foldertype="group">
<data key="d4" xml:space="preserve"/>
<data key="d6">
<y:ProxyAutoBoundsNode>
<y:Realizers active="0">
<y:GroupNode>
<y:Geometry height="630.4203124999996" width="839.7171093750001" x="181.1570562500006" y="171.51831875000016"/>
<y:Fill color="#CAECFF80" transparent="false"/>
<y:BorderStyle color="#666699" type="dotted" width="1.0"/>
<y:NodeLabel alignment="right" autoSizePolicy="node_width" backgroundColor="#99CCFF" borderDistance="0.0" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasLineColor="false" height="21.578125" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="839.7171093750001" x="0.0" xml:space="preserve" y="0.0">Latex script</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:State closed="false" closedHeight="50.0" closedWidth="50.0" innerGraphDisplayEnabled="false"/>
<y:NodeBounds considerNodeLabelSize="true"/>
<y:Insets bottom="5" bottomF="5.0" left="5" leftF="5.0" right="5" rightF="5.0" top="5" topF="5.0"/>
<y:BorderInsets bottom="30" bottomF="30.0" left="152" leftF="152.3701171875" right="85" rightF="85.42316406250006" top="61" topF="60.842187499999795"/>
</y:GroupNode>
<y:GroupNode>
<y:Geometry height="50.0" width="102.0" x="181.1570562500006" y="172.33863125000016"/>
<y:Fill color="#CAECFF80" transparent="false"/>
<y:BorderStyle color="#666699" type="dotted" width="1.0"/>
<y:NodeLabel alignment="right" autoSizePolicy="node_width" backgroundColor="#99CCFF" borderDistance="0.0" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasLineColor="false" height="21.578125" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="102.0" x="0.0" xml:space="preserve" y="0.0">Latex script</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:State closed="true" closedHeight="50.0" closedWidth="102.0" innerGraphDisplayEnabled="false"/>
<y:NodeBounds considerNodeLabelSize="true"/>
<y:Insets bottom="5" bottomF="5.0" left="5" leftF="5.0" right="5" rightF="5.0" top="5" topF="5.0"/>
<y:BorderInsets bottom="0" bottomF="0.0" left="0" leftF="0.0" right="0" rightF="0.0" top="0" topF="0.0"/>
</y:GroupNode>
</y:Realizers>
</y:ProxyAutoBoundsNode>
</data>
<graph edgedefault="directed" id="n1:">
<node id="n1::n0" yfiles.foldertype="group">
<data key="d6">
<y:TableNode configuration="com.yworks.bpmn.Pool">
<y:Geometry height="507.9999999999998" width="591.923828125" x="338.5271734375006" y="258.93863124999996"/>
<y:Fill color="#FFF2BC" color2="#D4D4D4CC" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="21.578125" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="l" rotationAngle="270.0" textColor="#000000" verticalTextPosition="bottom" visible="true" width="40.54052734375" x="4.0" xml:space="preserve" y="233.7297363281249">Latex</y:NodeLabel>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.0625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" rotationAngle="270.0" textColor="#000000" verticalTextPosition="bottom" visible="true" width="40.076171875" x="33.0" xml:space="preserve" y="89.48278808593773">Output<y:LabelModel><y:RowNodeLabelModel offset="3.0"/></y:LabelModel><y:ModelParameter><y:RowNodeLabelModelParameter horizontalPosition="0.0" id="row_0" inside="true"/></y:ModelParameter></y:NodeLabel>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.0625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" rotationAngle="270.0" textColor="#000000" verticalTextPosition="bottom" visible="true" width="63.794921875" x="33.0" xml:space="preserve" y="266.29272460937545">Processing<y:LabelModel><y:RowNodeLabelModel offset="3.0"/></y:LabelModel><y:ModelParameter><y:RowNodeLabelModelParameter horizontalPosition="0.0" id="row_1" inside="true"/></y:ModelParameter></y:NodeLabel>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.0625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" rotationAngle="270.0" textColor="#000000" verticalTextPosition="bottom" visible="true" width="31.169921875" x="33.0" xml:space="preserve" y="435.5843505859376">Input<y:LabelModel><y:RowNodeLabelModel offset="3.0"/></y:LabelModel><y:ModelParameter><y:RowNodeLabelModelParameter horizontalPosition="0.0" id="row_2" inside="true"/></y:ModelParameter></y:NodeLabel>
<y:StyleProperties>
<y:Property name="y.view.tabular.TableNodePainter.ALTERNATE_ROW_STYLE">
<y:SimpleStyle fillColor="#474A4340" lineColor="#000000" lineType="line" lineWidth="1.0"/>
</y:Property>
<y:Property class="java.awt.Color" name="com.yworks.bpmn.icon.line.color" value="#000000"/>
<y:Property name="y.view.tabular.TableNodePainter.ALTERNATE_COLUMN_SELECTION_STYLE">
<y:SimpleStyle fillColor="#474A4380" lineColor="#000000" lineType="line" lineWidth="3.0"/>
</y:Property>
<y:Property name="y.view.tabular.TableNodePainter.ALTERNATE_ROW_SELECTION_STYLE">
<y:SimpleStyle fillColor="#474A4380" lineColor="#000000" lineType="line" lineWidth="3.0"/>
</y:Property>
<y:Property class="java.awt.Color" name="POOL_LANE_COLOR_ALTERNATING" value="#ffffff"/>
<y:Property class="java.awt.Color" name="POOL_LANE_COLOR_MAIN" value="#ffffcc"/>
<y:Property class="java.lang.String" name="POOL_LANE_STYLE" value="LANE_STYLE_ROWS"/>
<y:Property class="java.awt.Color" name="com.yworks.bpmn.icon.fill2" value="#d4d4d4cc"/>
<y:Property class="java.awt.Color" name="com.yworks.bpmn.icon.fill" value="#ffffffe6"/>
<y:Property class="com.yworks.yfiles.bpmn.view.BPMNTypeEnum" name="com.yworks.bpmn.type" value="POOL_TYPE_LANE"/>
<y:Property name="y.view.tabular.TableNodePainter.ALTERNATE_COLUMN_STYLE">
<y:SimpleStyle fillColor="#474A4340" lineColor="#000000" lineType="line" lineWidth="1.0"/>
</y:Property>
</y:StyleProperties>
<y:State autoResize="true" closed="false" closedHeight="80.0" closedWidth="100.0"/>
<y:Insets bottom="0" bottomF="0.0" left="0" leftF="0.0" right="0" rightF="0.0" top="0" topF="0.0"/>
- <y:BorderInsets bottom="25" bottomF="25.499999999999886" left="0" leftF="0.0" right="6" rightF="6.0" top="5" topF="4.938631249999958"/>
+ <y:BorderInsets bottom="25" bottomF="25.499999999999886" left="0" leftF="0.0" right="24" rightF="23.56306093749936" top="5" topF="4.938631249999958"/>
<y:Table autoResizeTable="true" defaultColumnWidth="360.0" defaultMinimumColumnWidth="30.0" defaultMinimumRowHeight="30.0" defaultRowHeight="107.0">
<y:DefaultColumnInsets bottom="3.0" left="3.0" right="3.0" top="20.0"/>
<y:DefaultRowInsets bottom="3.0" left="20.0" right="3.0" top="3.0"/>
<y:Insets bottom="0.0" left="30.0" right="0.0" top="0.0"/>
<y:Columns>
<y:Column id="column_0" minimumWidth="30.0" width="538.923828125">
<y:Insets bottom="3.0" left="3.0" right="3.0" top="20.0"/>
</y:Column>
</y:Columns>
<y:Rows>
<y:Row height="179.04174804687545" id="row_0" minimumHeight="50.703125">
<y:Insets bottom="3.0" left="20.0" right="3.0" top="3.0"/>
</y:Row>
<y:Row height="198.296875" id="row_1" minimumHeight="50.703125">
<y:Insets bottom="3.0" left="20.0" right="3.0" top="3.0"/>
</y:Row>
<y:Row height="107.66137695312432" id="row_2" minimumHeight="50.703125">
<y:Insets bottom="3.0" left="20.0" right="3.0" top="3.0"/>
</y:Row>
</y:Rows>
</y:Table>
</y:TableNode>
</data>
<graph edgedefault="directed" id="n1::n0:">
<node id="n1::n0::n0">
<data key="d6">
<y:GenericNode configuration="com.yworks.bpmn.Artifact.withShadow">
<y:Geometry height="30.0" width="64.021484375" x="520.9099859375006" y="695.9386312499998"/>
<y:Fill color="#FFFFFFE6" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="32.125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="54.953125" x="4.5341796875" xml:space="preserve" y="-1.0625">Demand
upstream<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:StyleProperties>
<y:Property class="java.awt.Color" name="com.yworks.bpmn.icon.line.color" value="#000000"/>
<y:Property class="java.awt.Color" name="com.yworks.bpmn.icon.fill2" value="#d4d4d4cc"/>
<y:Property class="java.awt.Color" name="com.yworks.bpmn.icon.fill" value="#ffffffe6"/>
<y:Property class="com.yworks.yfiles.bpmn.view.BPMNTypeEnum" name="com.yworks.bpmn.type" value="ARTIFACT_TYPE_ANNOTATION"/>
</y:StyleProperties>
</y:GenericNode>
</data>
</node>
<node id="n1::n0::n1">
<data key="d6">
<y:GenericNode configuration="com.yworks.bpmn.Activity.withShadow">
<y:Geometry height="55.0" width="96.060546875" x="401.5379156250006" y="683.4386312499998"/>
<y:Fill color="#FFFFFFE6" color2="#D4D4D4CC" transparent="false"/>
<y:BorderStyle color="#123EA2" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.0625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="85.41015625" x="5.3251953125" xml:space="preserve" y="18.46875">scope_demand<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:StyleProperties>
<y:Property class="java.awt.Color" name="com.yworks.bpmn.icon.line.color" value="#000000"/>
<y:Property class="com.yworks.yfiles.bpmn.view.TaskTypeEnum" name="com.yworks.bpmn.taskType" value="TASK_TYPE_ABSTRACT"/>
<y:Property class="java.awt.Color" name="com.yworks.bpmn.icon.fill2" value="#d4d4d4cc"/>
<y:Property class="java.awt.Color" name="com.yworks.bpmn.icon.fill" value="#ffffffe6"/>
<y:Property class="com.yworks.yfiles.bpmn.view.BPMNTypeEnum" name="com.yworks.bpmn.type" value="ACTIVITY_TYPE"/>
<y:Property class="com.yworks.yfiles.bpmn.view.ActivityTypeEnum" name="com.yworks.bpmn.activityType" value="ACTIVITY_TYPE_TASK"/>
</y:StyleProperties>
</y:GenericNode>
</data>
</node>
<node id="n1::n0::n2">
<data key="d6">
<y:GenericNode configuration="com.yworks.bpmn.Activity.withShadow">
<y:Geometry height="30.0" width="150.078125" x="620.8816656250006" y="695.9386312499998"/>
<y:Fill color="#FFFFFFE6" color2="#D4D4D4CC" transparent="false"/>
<y:BorderStyle color="#123EA2" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.0625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="139.462890625" x="5.3076171875" xml:space="preserve" y="5.96875">latex_registered_subjects<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:StyleProperties>
<y:Property class="java.awt.Color" name="com.yworks.bpmn.icon.line.color" value="#000000"/>
<y:Property class="com.yworks.yfiles.bpmn.view.TaskTypeEnum" name="com.yworks.bpmn.taskType" value="TASK_TYPE_ABSTRACT"/>
<y:Property class="java.awt.Color" name="com.yworks.bpmn.icon.fill2" value="#d4d4d4cc"/>
<y:Property class="java.awt.Color" name="com.yworks.bpmn.icon.fill" value="#ffffffe6"/>
<y:Property class="com.yworks.yfiles.bpmn.view.BPMNTypeEnum" name="com.yworks.bpmn.type" value="ACTIVITY_TYPE"/>
<y:Property class="com.yworks.yfiles.bpmn.view.ActivityTypeEnum" name="com.yworks.bpmn.activityType" value="ACTIVITY_TYPE_TASK"/>
</y:StyleProperties>
</y:GenericNode>
</data>
</node>
<node id="n1::n0::n3">
<data key="d6">
<y:GenericNode configuration="com.yworks.bpmn.Activity.withShadow">
<y:Geometry height="55.0" width="110.7265625" x="394.2049078125006" y="526.9386312499997"/>
<y:Fill color="#FFFFFFE6" color2="#D4D4D4CC" transparent="false"/>
<y:BorderStyle color="#123EA2" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.0625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="100.439453125" x="5.1435546875" xml:space="preserve" y="18.46875">scope_demand(1)<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:StyleProperties>
<y:Property class="java.awt.Color" name="com.yworks.bpmn.icon.line.color" value="#000000"/>
<y:Property class="com.yworks.yfiles.bpmn.view.TaskTypeEnum" name="com.yworks.bpmn.taskType" value="TASK_TYPE_ABSTRACT"/>
<y:Property class="java.awt.Color" name="com.yworks.bpmn.icon.fill2" value="#d4d4d4cc"/>
<y:Property class="java.awt.Color" name="com.yworks.bpmn.icon.fill" value="#ffffffe6"/>
<y:Property class="com.yworks.yfiles.bpmn.view.BPMNTypeEnum" name="com.yworks.bpmn.type" value="ACTIVITY_TYPE"/>
<y:Property class="com.yworks.yfiles.bpmn.view.ActivityTypeEnum" name="com.yworks.bpmn.activityType" value="ACTIVITY_TYPE_TASK"/>
</y:StyleProperties>
</y:GenericNode>
</data>
</node>
<node id="n1::n0::n4">
<data key="d6">
<y:GenericNode configuration="com.yworks.bpmn.Activity.withShadow">
<y:Geometry height="30.0" width="74.046875" x="412.5447515625006" y="395.93863124999996"/>
<y:Fill color="#FFFFFFE6" color2="#D4D4D4CC" transparent="false"/>
<y:BorderStyle color="#123EA2" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.0625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="63.7890625" x="5.12890625" xml:space="preserve" y="5.96875">fn_demand<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:StyleProperties>
<y:Property class="java.awt.Color" name="com.yworks.bpmn.icon.line.color" value="#000000"/>
<y:Property class="com.yworks.yfiles.bpmn.view.TaskTypeEnum" name="com.yworks.bpmn.taskType" value="TASK_TYPE_ABSTRACT"/>
<y:Property class="java.awt.Color" name="com.yworks.bpmn.icon.fill2" value="#d4d4d4cc"/>
<y:Property class="java.awt.Color" name="com.yworks.bpmn.icon.fill" value="#ffffffe6"/>
<y:Property class="com.yworks.yfiles.bpmn.view.BPMNTypeEnum" name="com.yworks.bpmn.type" value="ACTIVITY_TYPE"/>
<y:Property class="com.yworks.yfiles.bpmn.view.ActivityTypeEnum" name="com.yworks.bpmn.activityType" value="ACTIVITY_TYPE_TASK"/>
</y:StyleProperties>
</y:GenericNode>
</data>
</node>
<node id="n1::n0::n5">
<data key="d6">
<y:GenericNode configuration="com.yworks.bpmn.Activity.withShadow">
<y:Geometry height="30.0" width="58.02734375" x="556.4070562500006" y="395.93863124999996"/>
<y:Fill color="#FFFFFFE6" color2="#D4D4D4CC" transparent="false"/>
<y:BorderStyle color="#123EA2" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.0625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="48.912109375" x="4.5576171875" xml:space="preserve" y="5.96875">decision<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:StyleProperties>
<y:Property class="java.awt.Color" name="com.yworks.bpmn.icon.line.color" value="#000000"/>
<y:Property class="com.yworks.yfiles.bpmn.view.TaskTypeEnum" name="com.yworks.bpmn.taskType" value="TASK_TYPE_ABSTRACT"/>
<y:Property class="java.awt.Color" name="com.yworks.bpmn.icon.fill2" value="#d4d4d4cc"/>
<y:Property class="java.awt.Color" name="com.yworks.bpmn.icon.fill" value="#ffffffe6"/>
<y:Property class="com.yworks.yfiles.bpmn.view.BPMNTypeEnum" name="com.yworks.bpmn.type" value="ACTIVITY_TYPE"/>
<y:Property class="com.yworks.yfiles.bpmn.view.ActivityTypeEnum" name="com.yworks.bpmn.activityType" value="ACTIVITY_TYPE_TASK"/>
</y:StyleProperties>
</y:GenericNode>
</data>
</node>
<node id="n1::n0::n6">
<data key="d6">
<y:GenericNode configuration="com.yworks.bpmn.Activity.withShadow">
<y:Geometry height="30.0" width="110.7265625" x="530.0574468750006" y="539.4386312499997"/>
<y:Fill color="#FFFFFFE6" color2="#D4D4D4CC" transparent="false"/>
<y:BorderStyle color="#123EA2" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.0625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="100.439453125" x="5.1435546875" xml:space="preserve" y="5.96875">scope_demand(2)<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:StyleProperties>
<y:Property class="java.awt.Color" name="com.yworks.bpmn.icon.line.color" value="#000000"/>
<y:Property class="com.yworks.yfiles.bpmn.view.TaskTypeEnum" name="com.yworks.bpmn.taskType" value="TASK_TYPE_ABSTRACT"/>
<y:Property class="java.awt.Color" name="com.yworks.bpmn.icon.fill2" value="#d4d4d4cc"/>
<y:Property class="java.awt.Color" name="com.yworks.bpmn.icon.fill" value="#ffffffe6"/>
<y:Property class="com.yworks.yfiles.bpmn.view.BPMNTypeEnum" name="com.yworks.bpmn.type" value="ACTIVITY_TYPE"/>
<y:Property class="com.yworks.yfiles.bpmn.view.ActivityTypeEnum" name="com.yworks.bpmn.activityType" value="ACTIVITY_TYPE_TASK"/>
</y:StyleProperties>
</y:GenericNode>
</data>
</node>
<node id="n1::n0::n7">
<data key="d6">
<y:GenericNode configuration="com.yworks.bpmn.Activity.withShadow">
<y:Geometry height="30.0" width="85.3671875" x="725.9371343750006" y="396.33863124999993"/>
<y:Fill color="#FFFFFFE6" color2="#D4D4D4CC" transparent="false"/>
<y:BorderStyle color="#FF0000" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.0625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="76.931640625" x="4.2177734375" xml:space="preserve" y="5.96875">late(decision)<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:StyleProperties>
<y:Property class="java.awt.Color" name="com.yworks.bpmn.icon.line.color" value="#000000"/>
<y:Property class="com.yworks.yfiles.bpmn.view.TaskTypeEnum" name="com.yworks.bpmn.taskType" value="TASK_TYPE_ABSTRACT"/>
<y:Property class="java.awt.Color" name="com.yworks.bpmn.icon.fill2" value="#d4d4d4cc"/>
<y:Property class="java.awt.Color" name="com.yworks.bpmn.icon.fill" value="#ffffffe6"/>
<y:Property class="com.yworks.yfiles.bpmn.view.BPMNTypeEnum" name="com.yworks.bpmn.type" value="ACTIVITY_TYPE"/>
<y:Property class="com.yworks.yfiles.bpmn.view.ActivityTypeEnum" name="com.yworks.bpmn.activityType" value="ACTIVITY_TYPE_TASK"/>
</y:StyleProperties>
</y:GenericNode>
</data>
</node>
<node id="n1::n0::n8">
<data key="d6">
<y:GenericNode configuration="com.yworks.bpmn.Activity.withShadow">
<y:Geometry height="30.0" width="62.703125" x="737.2691656250006" y="539.4386312499997"/>
<y:Fill color="#FFFFFFE6" color2="#D4D4D4CC" transparent="false"/>
<y:BorderStyle color="#123EA2" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.0625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="52.6328125" x="5.03515625" xml:space="preserve" y="5.96875">scope_fn<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:StyleProperties>
<y:Property class="java.awt.Color" name="com.yworks.bpmn.icon.line.color" value="#000000"/>
<y:Property class="com.yworks.yfiles.bpmn.view.TaskTypeEnum" name="com.yworks.bpmn.taskType" value="TASK_TYPE_ABSTRACT"/>
<y:Property class="java.awt.Color" name="com.yworks.bpmn.icon.fill2" value="#d4d4d4cc"/>
<y:Property class="java.awt.Color" name="com.yworks.bpmn.icon.fill" value="#ffffffe6"/>
<y:Property class="com.yworks.yfiles.bpmn.view.BPMNTypeEnum" name="com.yworks.bpmn.type" value="ACTIVITY_TYPE"/>
<y:Property class="com.yworks.yfiles.bpmn.view.ActivityTypeEnum" name="com.yworks.bpmn.activityType" value="ACTIVITY_TYPE_TASK"/>
</y:StyleProperties>
</y:GenericNode>
</data>
</node>
<node id="n1::n0::n9">
<data key="d6">
<y:GenericNode configuration="com.yworks.bpmn.Activity.withShadow">
- <y:Geometry height="30.0" width="108.060546875" x="813.3904546875006" y="540.93863125"/>
+ <y:Geometry height="30.0" width="122.08203125" x="388.5271734375006" y="283.8772624999999"/>
<y:Fill color="#FFFFFFE6" color2="#D4D4D4CC" transparent="false"/>
<y:BorderStyle color="#123EA2" type="line" width="1.0"/>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.0625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="97.029296875" x="5.515625" xml:space="preserve" y="5.96875">fn_signature_size<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.0625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="110.44140625" x="5.8203125" xml:space="preserve" y="5.96875">fn_demand_ordered<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:StyleProperties>
<y:Property class="java.awt.Color" name="com.yworks.bpmn.icon.line.color" value="#000000"/>
<y:Property class="com.yworks.yfiles.bpmn.view.TaskTypeEnum" name="com.yworks.bpmn.taskType" value="TASK_TYPE_ABSTRACT"/>
<y:Property class="java.awt.Color" name="com.yworks.bpmn.icon.fill2" value="#d4d4d4cc"/>
<y:Property class="java.awt.Color" name="com.yworks.bpmn.icon.fill" value="#ffffffe6"/>
<y:Property class="com.yworks.yfiles.bpmn.view.BPMNTypeEnum" name="com.yworks.bpmn.type" value="ACTIVITY_TYPE"/>
<y:Property class="com.yworks.yfiles.bpmn.view.ActivityTypeEnum" name="com.yworks.bpmn.activityType" value="ACTIVITY_TYPE_TASK"/>
</y:StyleProperties>
</y:GenericNode>
</data>
</node>
<node id="n1::n0::n10">
<data key="d6">
<y:GenericNode configuration="com.yworks.bpmn.Activity.withShadow">
- <y:Geometry height="30.0" width="122.08203125" x="388.5271734375006" y="283.8772624999999"/>
+ <y:Geometry height="30.0" width="83.99609375" x="819.8918468750012" y="539.8772624999995"/>
<y:Fill color="#FFFFFFE6" color2="#D4D4D4CC" transparent="false"/>
<y:BorderStyle color="#123EA2" type="line" width="1.0"/>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.0625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="110.44140625" x="5.8203125" xml:space="preserve" y="5.96875">fn_demand_ordered<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.0625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="73.99609375" x="5.0" xml:space="preserve" y="5.96875">latex_symbol<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:StyleProperties>
<y:Property class="java.awt.Color" name="com.yworks.bpmn.icon.line.color" value="#000000"/>
<y:Property class="com.yworks.yfiles.bpmn.view.TaskTypeEnum" name="com.yworks.bpmn.taskType" value="TASK_TYPE_ABSTRACT"/>
<y:Property class="java.awt.Color" name="com.yworks.bpmn.icon.fill2" value="#d4d4d4cc"/>
<y:Property class="java.awt.Color" name="com.yworks.bpmn.icon.fill" value="#ffffffe6"/>
<y:Property class="com.yworks.yfiles.bpmn.view.BPMNTypeEnum" name="com.yworks.bpmn.type" value="ACTIVITY_TYPE"/>
<y:Property class="com.yworks.yfiles.bpmn.view.ActivityTypeEnum" name="com.yworks.bpmn.activityType" value="ACTIVITY_TYPE_TASK"/>
</y:StyleProperties>
</y:GenericNode>
</data>
</node>
</graph>
</node>
</graph>
</node>
<edge id="n0::e0" source="n0::n1" target="n0::n0">
<data key="d8" xml:space="preserve"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="none" target="plain"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n0::e1" source="n0::n1" target="n0::n6">
<data key="d8" xml:space="preserve"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0">
<y:Point x="574.9961395520005" y="48.36017587200024"/>
</y:Path>
<y:LineStyle color="#000000" type="line" width="1.0"/>
<y:Arrows source="white_diamond" target="none"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n0::e2" source="n0::n3" target="n0::n6">
<data key="d8" xml:space="preserve"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0">
<y:Point x="647.1881395520005" y="-6.167824127999808"/>
</y:Path>
<y:LineStyle color="#000000" type="line" width="1.0"/>
<y:Arrows source="white_diamond" target="none"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n0::e3" source="n0::n3" target="n0::n5">
<data key="d8" xml:space="preserve"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="none" target="plain"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n0::e4" source="n0::n1" target="n0::n5">
<data key="d8" xml:space="preserve"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="none" target="plain"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n0::e5" source="n0::n5" target="n0::n8">
<data key="d8" xml:space="preserve"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="none" target="plain"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n0::e6" source="n0::n1" target="n0::n2">
<data key="d8" xml:space="preserve"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="none" target="white_delta"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n0::e7" source="n0::n3" target="n0::n4">
<data key="d8" xml:space="preserve"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="none" target="white_delta"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n0::e8" source="n0::n6" target="n0::n7">
<data key="d8" xml:space="preserve"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="none" target="white_delta"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n0::e9" source="n0::n9" target="n0::n6">
<data key="d8" xml:space="preserve"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="none" target="plain"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n0::e10" source="n0::n1" target="n0::n10">
<data key="d8" xml:space="preserve"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="29.599999999999966" sy="0.0" tx="0.0" ty="17.599999999999994">
<y:Point x="307.961387131824" y="-46.26795064334408"/>
<y:Point x="308.6879999999999" y="63.33204935665589"/>
</y:Path>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="none" target="plain"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n1::e0" source="n1::n0" target="n1::n0::n5">
<data key="d8" xml:space="preserve"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="-13.01307826711736" sy="-170.1693115234376" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="none" target="plain"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n1::n0::e0" source="n1::n0::n0" target="n1::n0::n1">
<data key="d8" xml:space="preserve"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="none" target="plain"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n1::n0::e1" source="n1::n0::n3" target="n1::n0::n1">
<data key="d8" xml:space="preserve"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="none" target="plain"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n1::n0::e2" source="n1::n0::n4" target="n1::n0::n3">
<data key="d8" xml:space="preserve"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="none" target="plain"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n1::n0::e3" source="n1::n0::n5" target="n1::n0::n4">
<data key="d8" xml:space="preserve"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="none" target="plain"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n1::n0::e4" source="n1::n0::n5" target="n1::n0::n2">
<data key="d8" xml:space="preserve"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0">
<y:Point x="695.9207281250006" y="411.93863124999996"/>
</y:Path>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="none" target="plain"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n1::n0::e5" source="n1::n0::n6" target="n1::n0::n4">
<data key="d8" xml:space="preserve"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="none" target="plain"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n1::n0::e6" source="n1::n0::n6" target="n1::n0::n5">
<data key="d8" xml:space="preserve"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="crows_foot_one_mandatory" target="plain"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n1::n0::e7" source="n1::n0::n7" target="n1::n0::n8">
<data key="d8" xml:space="preserve"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="none" target="plain"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
- <edge id="n1::n0::e8" source="n1::n0::n7" target="n1::n0::n9">
- <data key="d8" xml:space="preserve"/>
- <data key="d10">
- <y:PolyLineEdge>
- <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0">
- <y:Point x="867.4207281250006" y="411.33863124999993"/>
- </y:Path>
- <y:LineStyle color="#000000" type="dashed" width="1.0"/>
- <y:Arrows source="none" target="plain"/>
- <y:BendStyle smoothed="false"/>
- </y:PolyLineEdge>
- </data>
- </edge>
<edge id="n1::e1" source="n1::n0::n7" target="n1::n0">
<data key="d8" xml:space="preserve"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="-139.5127241750008" ty="-154.9999999999999">
<y:Point x="768.6207281250006" y="357.93863124999996"/>
</y:Path>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="none" target="plain"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
- <edge id="n1::n0::e9" source="n1::n0::n7" target="n1::n0::n2">
+ <edge id="n1::n0::e8" source="n1::n0::n7" target="n1::n0::n2">
<data key="d8" xml:space="preserve"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="13.0" ty="0.0">
<y:Point x="708.9207281250006" y="411.33863124999993"/>
</y:Path>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="none" target="plain"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
- <edge id="n1::n0::e10" source="n1::n0::n10" target="n1::n0::n4">
+ <edge id="n1::n0::e9" source="n1::n0::n9" target="n1::n0::n4">
<data key="d8" xml:space="preserve"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="-19.0" sy="0.0" tx="-19.0" ty="0.0"/>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="none" target="plain"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
- <edge id="n1::n0::e11" source="n1::n0::n10" target="n1::n0::n7">
+ <edge id="n1::n0::e10" source="n1::n0::n9" target="n1::n0::n7">
<data key="d8" xml:space="preserve"/>
- <data key="d9"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="19.0" ty="0.0">
<y:Point x="787.6207281250006" y="298.8772624999999"/>
</y:Path>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="none" target="plain"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
- <edge id="n1::n0::e12" source="n1::n0::n4" target="n1::n0::n7">
+ <edge id="n1::n0::e11" source="n1::n0::n4" target="n1::n0::n7">
<data key="d8" xml:space="preserve"/>
- <data key="d9"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="-20.0" ty="0.0">
<y:Point x="460.0" y="410.93863124999996"/>
<y:Point x="460.0" y="357.0"/>
<y:Point x="748.6207281250006" y="357.0"/>
</y:Path>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="none" target="plain"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
</graph>
<data key="d7">
<y:Resources/>
</data>
</graphml>
diff --git a/documentation-api/polymorphism.graphml b/documentation-api/polymorphism.graphml
index 43eea1f..baa6ea4 100644
--- a/documentation-api/polymorphism.graphml
+++ b/documentation-api/polymorphism.graphml
@@ -1,309 +1,338 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:java="http://www.yworks.com/xml/yfiles-common/1.0/java" xmlns:sys="http://www.yworks.com/xml/yfiles-common/markup/primitives/2.0" xmlns:x="http://www.yworks.com/xml/yfiles-common/markup/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml/1.1/ygraphml.xsd">
<!--Created by yEd 3.18.1-->
<key attr.name="Description" attr.type="string" for="graph" id="d0"/>
<key for="port" id="d1" yfiles.type="portgraphics"/>
<key for="port" id="d2" yfiles.type="portgeometry"/>
<key for="port" id="d3" yfiles.type="portuserdata"/>
<key attr.name="url" attr.type="string" for="node" id="d4"/>
<key attr.name="description" attr.type="string" for="node" id="d5"/>
<key for="node" id="d6" yfiles.type="nodegraphics"/>
<key for="graphml" id="d7" yfiles.type="resources"/>
<key attr.name="url" attr.type="string" for="edge" id="d8"/>
<key attr.name="description" attr.type="string" for="edge" id="d9"/>
<key for="edge" id="d10" yfiles.type="edgegraphics"/>
<graph edgedefault="directed" id="G">
<data key="d0" xml:space="preserve"/>
<node id="n0" yfiles.foldertype="group">
<data key="d6">
<y:TableNode configuration="YED_TABLE_NODE">
- <y:Geometry height="260.65019897460866" width="503.427265625" x="135.02669921875008" y="62.33943300882976"/>
+ <y:Geometry height="326.7583807373044" width="528.9366308593751" x="109.517333984375" y="-3.768748753865964"/>
<y:Fill color="#ECF5FF" color2="#0042F440" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="20.7578125" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="99.0244140625" x="202.20142578125" xml:space="preserve" y="4.0">Polymorphism</y:NodeLabel>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="17.40625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="67.36328125" x="116.93199218749999" xml:space="preserve" y="33.0">Compilation<y:LabelModel><y:ColumnNodeLabelModel offset="3.0"/></y:LabelModel><y:ModelParameter><y:ColumnNodeLabelModelParameter id="column_0" inside="true" verticalPosition="0.0"/></y:ModelParameter></y:NodeLabel>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="17.40625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="60.6953125" x="371.979609375" xml:space="preserve" y="33.0">Transcend<y:LabelModel><y:ColumnNodeLabelModel offset="3.0"/></y:LabelModel><y:ModelParameter><y:ColumnNodeLabelModelParameter id="column_1" inside="true" verticalPosition="0.0"/></y:ModelParameter></y:NodeLabel>
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="21.578125" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="100.7822265625" x="214.07720214843755" xml:space="preserve" y="4.0">Polymorphism</y:NodeLabel>
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.0625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="68.59375" x="129.07144042968753" xml:space="preserve" y="33.0">Compilation<y:LabelModel><y:ColumnNodeLabelModel offset="3.0"/></y:LabelModel><y:ModelParameter><y:ColumnNodeLabelModelParameter id="column_0" inside="true" verticalPosition="0.0"/></y:ModelParameter></y:NodeLabel>
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.0625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="60.61328125" x="397.5299902343751" xml:space="preserve" y="33.0">Transcend<y:LabelModel><y:ColumnNodeLabelModel offset="3.0"/></y:LabelModel><y:ModelParameter><y:ColumnNodeLabelModelParameter id="column_1" inside="true" verticalPosition="0.0"/></y:ModelParameter></y:NodeLabel>
<y:StyleProperties>
<y:Property class="java.awt.Color" name="yed.table.section.color" value="#7192b2"/>
<y:Property class="java.lang.Double" name="yed.table.header.height" value="24.0"/>
<y:Property class="java.awt.Color" name="yed.table.lane.color.main" value="#c4d7ed"/>
<y:Property class="java.awt.Color" name="yed.table.lane.color.alternating" value="#abc8e2"/>
<y:Property class="java.awt.Color" name="yed.table.header.color.alternating" value="#abc8e2"/>
<y:Property class="java.lang.String" name="yed.table.lane.style" value="lane.style.columns"/>
<y:Property class="java.awt.Color" name="yed.table.header.color.main" value="#c4d7ed"/>
</y:StyleProperties>
<y:State autoResize="true" closed="false" closedHeight="80.0" closedWidth="100.0"/>
<y:Insets bottom="0" bottomF="0.0" left="0" leftF="0.0" right="0" rightF="0.0" top="0" topF="0.0"/>
- <y:BorderInsets bottom="65" bottomF="65.36000000000013" left="11" leftF="10.875908203124993" right="58" rightF="58.16000000000008" top="2" topF="1.8918182373042782"/>
+ <y:BorderInsets bottom="65" bottomF="65.36000000000013" left="33" leftF="32.765380859375" right="58" rightF="58.16000000000008" top="0" topF="0.0"/>
<y:Table autoResizeTable="true" defaultColumnWidth="120.0" defaultMinimumColumnWidth="80.0" defaultMinimumRowHeight="50.0" defaultRowHeight="80.0">
<y:DefaultColumnInsets bottom="0.0" left="0.0" right="0.0" top="24.0"/>
<y:DefaultRowInsets bottom="0.0" left="0.0" right="0.0" top="0.0"/>
<y:Insets bottom="0.0" left="0.0" right="0.0" top="30.0"/>
<y:Columns>
- <y:Column id="column_0" minimumWidth="80.0" width="301.227265625">
+ <y:Column id="column_0" minimumWidth="80.0" width="326.73663085937505">
<y:Insets bottom="0.0" left="0.0" right="0.0" top="24.0"/>
</y:Column>
<y:Column id="column_1" minimumWidth="80.0" width="202.20000000000005">
<y:Insets bottom="0.0" left="0.0" right="0.0" top="24.0"/>
</y:Column>
</y:Columns>
<y:Rows>
- <y:Row height="206.65019897460866" id="row_0" minimumHeight="50.0">
+ <y:Row height="272.7583807373044" id="row_0" minimumHeight="50.0">
<y:Insets bottom="0.0" left="0.0" right="0.0" top="0.0"/>
</y:Row>
</y:Rows>
</y:Table>
</y:TableNode>
</data>
<graph edgedefault="directed" id="n0:">
<node id="n0::n0">
<data key="d4" xml:space="preserve"/>
<data key="d6">
<y:UMLClassNode>
<y:Geometry height="43.046875" width="81.89453125" x="498.3994335937501" y="202.8796319834383"/>
<y:Fill color="#FFCC00" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="33.046875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="71.89453125" x="5.0" xml:space="preserve" y="3.0">Polymorph
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="34.46875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="67.67333984375" x="7.110595703125" xml:space="preserve" y="3.0">Polymorph
Query<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:UML clipContent="true" constraint="" hasDetailsColor="false" omitDetails="false" stereotype="" use3DEffect="true">
<y:AttributeLabel xml:space="preserve"/>
<y:MethodLabel xml:space="preserve"/>
</y:UML>
</y:UMLClassNode>
</data>
</node>
<node id="n0::n1">
<data key="d4" xml:space="preserve"/>
<data key="d6">
<y:UMLClassNode>
- <y:Geometry height="30.0" width="55.18359375" x="500.0599023437501" y="118.23125124613404"/>
+ <y:Geometry height="30.0" width="55.18359375" x="503.0599023437501" y="50.231251246134036"/>
<y:Fill color="#CCCCCC" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="18.5234375" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="45.18359375" x="5.0" xml:space="preserve" y="3.0">IQuery<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="-0.03703090122767855" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="19.234375" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="42.35888671875" x="6.412353515625" xml:space="preserve" y="3.0">IQuery<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="-0.03703090122767855" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:UML clipContent="true" constraint="" hasDetailsColor="false" omitDetails="false" stereotype="" use3DEffect="true">
<y:AttributeLabel xml:space="preserve"/>
<y:MethodLabel xml:space="preserve"/>
</y:UML>
</y:UMLClassNode>
</data>
</node>
<node id="n0::n2">
<data key="d4" xml:space="preserve"/>
<data key="d6">
<y:UMLClassNode>
<y:Geometry height="66.453125" width="110.78271484375" x="281.9553417968751" y="191.1765069834383"/>
<y:Fill color="#FFCC00" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="33.046875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="100.78271484375" x="5.0" xml:space="preserve" y="3.0">Polymorph
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="34.46875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="94.37158203125" x="8.20556640625" xml:space="preserve" y="3.0">Polymorph
CodeScopeUnit<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:UML clipContent="true" constraint="" hasDetailsColor="false" omitDetails="false" stereotype="" use3DEffect="true">
<y:AttributeLabel xml:space="preserve"/>
<y:MethodLabel xml:space="preserve">findFunction</y:MethodLabel>
</y:UML>
</y:UMLClassNode>
</data>
</node>
<node id="n0::n3">
<data key="d4" xml:space="preserve"/>
<data key="d6">
<y:UMLClassNode>
- <y:Geometry height="30.0" width="114.39453125" x="269.2876367187501" y="118.25943300882977"/>
+ <y:Geometry height="30.0" width="114.39453125" x="272.2876367187501" y="50.259433008829774"/>
<y:Fill color="#CCCCCC" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="18.5234375" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="104.39453125" x="5.0" xml:space="preserve" y="3.0">ICodeScopeUnit<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="-0.03703090122767855" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="19.234375" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="98.16748046875" x="8.113525390625" xml:space="preserve" y="3.0">ICodeScopeUnit<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="-0.03703090122767855" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:UML clipContent="true" constraint="" hasDetailsColor="false" omitDetails="false" stereotype="" use3DEffect="true">
<y:AttributeLabel xml:space="preserve"/>
<y:MethodLabel xml:space="preserve"/>
</y:UML>
</y:UMLClassNode>
</data>
</node>
<node id="n0::n4">
<data key="d6">
<y:UMLClassNode>
<y:Geometry height="43.046875" width="94.88818359375" x="145.90260742187508" y="202.8796319834383"/>
<y:Fill color="#FFCC00" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="33.046875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="84.88818359375" x="5.0" xml:space="preserve" y="3.0">Polymorph
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="34.46875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="79.638671875" x="7.624755859375" xml:space="preserve" y="3.0">Polymorph
FnInvocation<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:UML clipContent="true" constraint="" hasDetailsColor="false" omitDetails="false" stereotype="" use3DEffect="true">
<y:AttributeLabel xml:space="preserve"/>
<y:MethodLabel xml:space="preserve"/>
</y:UML>
</y:UMLClassNode>
</data>
</node>
<node id="n0::n5">
<data key="d6">
<y:ShapeNode>
<y:Geometry height="41.52000000000004" width="47.135625000000005" x="448.5132954166678" y="147.56170500000025"/>
<y:Fill color="#CCFFCC" transparent="false"/>
<y:BorderStyle color="#000000" raised="false" type="line" width="1.0"/>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="17.40625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="48.015625" x="-0.4399999999999977" xml:space="preserve" y="12.05687500000002">P.Query<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.0625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="45.712890625" x="0.7113671875000023" xml:space="preserve" y="11.72875000000002">P.Query<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:Shape type="star8"/>
</y:ShapeNode>
</data>
</node>
<node id="n0::n6">
<data key="d6">
<y:ShapeNode>
- <y:Geometry height="41.52000000000004" width="47.33984375" x="209.6044814583356" y="138.5634100000005"/>
+ <y:Geometry height="41.52000000000004" width="47.33984375" x="237.6044814583356" y="149.5634100000005"/>
<y:Fill color="#CCFFCC" transparent="false"/>
<y:BorderStyle color="#000000" raised="false" type="line" width="1.0"/>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="17.40625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="37.33984375" x="5.0" xml:space="preserve" y="12.05687500000002">PSCU<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.0625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="34.287109375" x="6.5263671875" xml:space="preserve" y="11.72875000000002">PSCU<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:Shape type="star8"/>
</y:ShapeNode>
</data>
</node>
+ <node id="n0::n7">
+ <data key="d4" xml:space="preserve"/>
+ <data key="d6">
+ <y:UMLClassNode>
+ <y:Geometry height="30.0" width="93.4345703125" x="142.28271484375" y="51.5"/>
+ <y:Fill color="#CCCCCC" transparent="false"/>
+ <y:BorderStyle color="#000000" type="line" width="1.0"/>
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="19.234375" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="83.4345703125" x="5.0" xml:space="preserve" y="3.0">IFnInvocation<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="-0.03703090122767855" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
+ <y:UML clipContent="true" constraint="" hasDetailsColor="false" omitDetails="false" stereotype="" use3DEffect="true">
+ <y:AttributeLabel xml:space="preserve"/>
+ <y:MethodLabel xml:space="preserve"/>
+ </y:UML>
+ </y:UMLClassNode>
+ </data>
+ </node>
</graph>
</node>
<node id="n1">
<data key="d4" xml:space="preserve"/>
<data key="d6">
<y:UMLClassNode>
<y:Geometry height="28.0" width="136.79541015625" x="125.60899414062504" y="437.6794330088297"/>
<y:Fill color="#C0C0C0" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="18.5234375" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="126.79541015625" x="5.0" xml:space="preserve" y="3.0">InterpretationScope<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="19.234375" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="120.64453125" x="8.075439453125" xml:space="preserve" y="3.0">InterpretationScope<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:UML clipContent="true" constraint="" hasDetailsColor="false" omitDetails="false" stereotype="" use3DEffect="true">
<y:AttributeLabel xml:space="preserve"/>
<y:MethodLabel xml:space="preserve"/>
</y:UML>
</y:UMLClassNode>
</data>
</node>
<node id="n2">
<data key="d4" xml:space="preserve"/>
<data key="d6">
<y:UMLClassNode>
<y:Geometry height="28.0" width="163.525390625" x="112.64400390625002" y="362.43943300882967"/>
<y:Fill color="#C0C0C0" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
- <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="18.5234375" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="153.525390625" x="5.0" xml:space="preserve" y="3.0">LateReasoningCompiler<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
+ <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="19.234375" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="144.30224609375" x="9.611572265625" xml:space="preserve" y="3.0">LateReasoningCompiler<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:UML clipContent="true" constraint="" hasDetailsColor="false" omitDetails="false" stereotype="" use3DEffect="true">
<y:AttributeLabel xml:space="preserve"/>
<y:MethodLabel xml:space="preserve"/>
</y:UML>
</y:UMLClassNode>
</data>
</node>
<edge id="n0::e0" source="n0::n2" target="n0::n3">
<data key="d8" xml:space="preserve"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0">
<y:Point x="328.0266992187501" y="217.73125124613404"/>
</y:Path>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="none" target="white_delta"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n0::e1" source="n0::n0" target="n0::n1">
<data key="d8" xml:space="preserve"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0">
- <y:Point x="531.0266992187501" y="133.23125124613404"/>
+ <y:Point x="534.0266992187501" y="65.23125124613404"/>
</y:Path>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="none" target="white_delta"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n0::e2" source="n0::n2" target="n0::n0">
<data key="d8" xml:space="preserve"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="none" target="plain"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n0::e3" source="n0::n2" target="n0::n4">
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="none" target="plain"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="e0" source="n2" target="n1">
<data key="d8" xml:space="preserve"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="none" target="plain"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="e1" source="n0::n4" target="n2">
<data key="d8" xml:space="preserve"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="none" target="plain"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="e2" source="n0::n4" target="n0">
<data key="d8" xml:space="preserve"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="none" target="plain"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n0::e4" source="n0::n4" target="n0::n0">
<data key="d8" xml:space="preserve"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0">
<y:Point x="367.8200000000001" y="296.7666666666667"/>
</y:Path>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="none" target="plain"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n0::e5" source="n0::n5" target="n0::n0">
<data key="d8" xml:space="preserve"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="none" target="plain"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n0::e6" source="n0::n6" target="n0::n2">
<data key="d8" xml:space="preserve"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="dashed" width="1.0"/>
<y:Arrows source="none" target="plain"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
+ <edge id="n0::e7" source="n0::n4" target="n0::n7">
+ <data key="d8" xml:space="preserve"/>
+ <data key="d9"/>
+ <data key="d10">
+ <y:PolyLineEdge>
+ <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0">
+ <y:Point x="189.0" y="224.4030694834383"/>
+ </y:Path>
+ <y:LineStyle color="#000000" type="dashed" width="1.0"/>
+ <y:Arrows source="none" target="white_delta"/>
+ <y:BendStyle smoothed="false"/>
+ </y:PolyLineEdge>
+ </data>
+ </edge>
</graph>
<data key="d7">
<y:Resources/>
</data>
</graphml>
diff --git a/grammar/gen-grammar b/grammar/gen-grammar
index f387d59..8d1c31c 100755
--- a/grammar/gen-grammar
+++ b/grammar/gen-grammar
@@ -1,9 +1,11 @@
+#!/bin/bash
+
COCO_EXECUTABLE=${2:-cococpp}
COCO_FRAMES_PATH=${3:-/usr/share/coco-cpp/}
echo "Run coco generator: "
case $1 in
main) $COCO_EXECUTABLE ./xreate.ATG -frames $COCO_FRAMES_PATH -o main -namespace xreate::grammar::main;;
modules) $COCO_EXECUTABLE ./modules.ATG -frames $COCO_FRAMES_PATH -o modules -namespace xreate::modules;;
esac
diff --git a/grammar/xreate.ATG b/grammar/xreate.ATG
index a880168..5342343 100644
--- a/grammar/xreate.ATG
+++ b/grammar/xreate.ATG
@@ -1,676 +1,708 @@
//TODO add ListLiteral
//TODO ExprTyped: assign default(none) type
#include "ast.h"
#include "ExternLayer.h"
#include <string>
#include <stack>
#define wprintf(format, ...) \
char __buffer[100]; \
wcstombs(__buffer, format, 100); \
fprintf(stderr, __buffer, __VA_ARGS__)
using namespace std;
COMPILER Xreate
details::inconsistent::AST* root = nullptr; // current program unit
void ensureInitalizedAST(){
if (root == nullptr) root = new details::inconsistent::AST();
}
struct {
std::stack<CodeScope*> scopesOld;
CodeScope* scope = nullptr;
} context;
void pushContextScope(CodeScope* scope){
context.scopesOld.push(context.scope);
context.scope = scope;
}
void popContextScope(){
context.scope = context.scopesOld.top();
context.scopesOld.pop();
}
int nextToken()
{
scanner->ResetPeek();
return scanner->Peek()->kind;
}
bool checkTokenAfterIdent(int key){
if (la->kind != _ident) return false;
return nextToken() == key;
}
bool checkParametersList()
{
return la->kind == _ident && nextToken() == _lparen;
}
bool checkInfix()
{
return la->kind == _ident && nextToken() == _ident;
}
bool checkIndex()
{
return la->kind == _ident && nextToken() == _lbrack;
}
bool checkFuncDecl()
{
if (la->kind != _ident) return false;
int token2 = nextToken();
int token3 = scanner->Peek()->kind;
return token2 == _assign && (token3 == _function || token3 == _pre);
}
bool checkAssignment()
{
if (la->kind != _ident) return false;
scanner->ResetPeek();
int token2 = scanner->Peek()->kind;
if (token2 == _lcurbrack) {
scanner->Peek();
int token3 = scanner->Peek()->kind;
if (token3 != _rcurbrack) return false;
int token4 = scanner->Peek()->kind;
return token4 == _assign;
}
return token2 == _assign;
}
void recognizeIdentifier(Expression& i){
if (!context.scope->recognizeIdentifier(i)){
root->postponeIdentifier(context.scope, i);
}
}
enum SwitchKind{SWITCH_NORMAL, SWITCH_META};
CHARACTERS
letter = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".
any = ANY - '"'.
digit = "0123456789".
cr = '\r'.
lf = '\n'.
tab = '\t'.
TOKENS
ident = (letter | '_') {letter | digit | '_'}.
number = (digit | '-' digit) {digit}.
string = '"' { any } '"'.
function = "function".
pre = "pre".
comma = ','.
period = '.'.
lparen = '('.
rparen = ')'.
lbrack = '['.
rbrack = ']'.
lcurbrack = '{'.
rcurbrack = '}'.
equal = "==".
assign = '='.
implic = '-' '>'.
colon = ':'.
context = "context".
tagcolon = "::".
lse = "<=".
lss = "<".
gte = ">=".
gtr = ">".
ne1 = "!=".
ne2= "<>".
COMMENTS FROM "/*" TO "*/" NESTED
COMMENTS FROM "//" TO lf
IGNORE cr + lf + tab
PRODUCTIONS
Xreate = (. Function* function; ensureInitalizedAST(); .)
{( RuleDecl
| InterfaceData | Imprt | GuardSection
| IF(checkFuncDecl()) FDecl<function> (. root->add(function); .)
| TDecl
| SkipModulesSection
)} (. .)
.
Ident<std::wstring& name>
= ident (. name = t->val; .).
VarIdent<Expression& e>
= ident (. e = Expression(Atom<Identifier_t>(t->val)); .)
[ lcurbrack (
ident (. SemErr(coco_string_create("var version as ident is not implemented yet")); .)
| number (. Attachments::put<versions::VariableVersion>(e, Atom<Number_t>(t->val).get()); .)
) rcurbrack ]
.
FDecl<Function*& f> = (. std::wstring fname; std::wstring argName; TypeAnnotation typIn; TypeAnnotation typOut; bool flagIsPrefunct = false; Expression binding; .)
Ident<fname> assign
[pre (. flagIsPrefunct = true; .)]
function (. f = new Function(fname); f->isPrefunction = flagIsPrefunct; CodeScope* entry = f->getEntryScope(); .)
[lparen Ident<argName> tagcolon ExprAnnotations<binding> (. f->addBinding(Atom<Identifier_t>(argName), move(binding)); .)
{comma Ident<argName> tagcolon ExprAnnotations<binding> (. f->addBinding(Atom <Identifier_t>(argName), move(binding));.)
} rparen]
[ tagcolon
( IF(flagIsPrefunct) FnTag<f>
| Type<typOut>
)
{';' FnTag<f> }]
BDecl<entry> (. const_cast<Expression&>(entry->getBody()).bindType(move(typOut));.)
.
GuardSection<>= (. Expression guard; Function* f; .)
"guard" tagcolon MetaSimpExpr<guard>
lcurbrack { FDecl<f> (. f->guard = guard; root->add(f); .)
} rcurbrack.
/**
* TYPES
*
*/
TypeTerm<TypePrimitive& typ> = (. std::wstring tid; .)
("string" (. typ = TypePrimitive::String;.)
| "num" (. typ = TypePrimitive::Num;.)
| "int" (. typ = TypePrimitive::Int;.)
| "float" (. typ = TypePrimitive::Float;.)
| "bool" (. typ = TypePrimitive::Bool; .)
| "i8" (. typ = TypePrimitive::I8; .)
| "i32" (. typ = TypePrimitive::I32; .)
| "i64" (. typ = TypePrimitive::I64; .)
).
-Type<TypeAnnotation& typ> = (. TypeAnnotation typ2; TypePrimitive typ3; std::wstring tid, field; .)
+Type<TypeAnnotation& typ> = (. TypeAnnotation typ2; TypePrimitive typ3; std::wstring tid; std::string field; .)
(
TList<typ>
| TStruct<typ>
| TVariant<typ>
| TSlave<typ>
| TypeTerm<typ3> (. typ = typ3; .)
| IF (checkIndex()) Ident<tid> lbrack
- Ident<field> (. typ = TypeAnnotation(TypeOperator::ACCESS, {}); typ.__valueCustom = Atom<Identifier_t>(tid).get(); typ.fields.push_back(Atom<Identifier_t>(field).get()); .)
- {comma Ident<field> (. typ.fields.push_back(Atom<Identifier_t>(field).get()); .)
- } rbrack
+ TypeIndex<field> (. typ = TypeAnnotation(TypeOperator::ACCESS, {}); typ.__valueCustom = Atom<Identifier_t>(tid).get(); typ.fields.push_back(field); .)
+ {comma TypeIndex<field> (. typ.fields.push_back(field); .)
+ } rbrack
| Ident<tid> (. typ = TypeAnnotation(TypeOperator::CUSTOM, {}); typ.__valueCustom = Atom<Identifier_t>(tid).get(); .)
[lparen Type<typ2> (. typ.__operator = TypeOperator::CALL; typ.__operands.push_back(typ2); .)
{comma Type<typ2> (. typ.__operands.push_back(typ2); .)
} rparen]
) .
+TypeIndex<std::string& name> =
+(
+ number (. name = Atom<Identifier_t>(t->val).get(); .)
+ | string (. name = Atom<String_t>(t->val).get(); .)
+)
+.
+
TList<TypeAnnotation& typ> = (. TypeAnnotation ty; .)
lbrack Type<ty> rbrack (. typ = TypeAnnotation(TypeOperator::LIST, {ty}); .)
.
TStruct<TypeAnnotation& typ> = (. TypeAnnotation t; std::wstring key; size_t keyCounter=0; .)
lcurbrack
(
IF(checkTokenAfterIdent(_tagcolon)) Ident<key> tagcolon Type<t>
| Type<t> (. key = to_wstring(keyCounter++); .)
) (. typ = TypeAnnotation(TypeOperator::LIST_NAMED, {t}); typ.fields.push_back(Atom<Identifier_t>(key).get()); .)
{comma (
IF(checkTokenAfterIdent(_tagcolon)) Ident<key> tagcolon Type<t>
| Type<t> (. key = to_wstring(keyCounter++); .)
) (. typ.__operands.push_back(t); typ.fields.push_back(Atom<Identifier_t>(key).get()); .)
} rcurbrack.
TVariant<TypeAnnotation& typ>= (. TypeAnnotation t, typVoid; std::vector<TypeAnnotation> operands; std::vector<Atom<Identifier_t>> keys; std::wstring variant; .)
"variant" lcurbrack
Ident<variant> (. t=typVoid; .)
[tagcolon Type<t>] (. keys.push_back(Atom<Identifier_t>(variant)); operands.push_back(t); .)
{comma Ident<variant> (. t=typVoid; .)
[tagcolon Type<t>] (. keys.push_back(Atom<Identifier_t>(variant)); operands.push_back(t); .)
}
rcurbrack (. typ = TypeAnnotation(TypeOperator::VARIANT, {}); typ.__operands = operands; typ.addFields(std::move(keys)); .)
.
TSlave<TypeAnnotation& typ>= (. std::wstring identMaster; .)
"slave" Ident<identMaster> (. typ = TypeAnnotation(TypeOperator::SLAVE, {}); typ.__valueCustom = Atom<Identifier_t>(identMaster).get(); .)
.
TDecl = (. TypeAnnotation t; std::wstring tname, arg; std::vector<Atom<Identifier_t>> args; .)
Ident<tname> assign "type"
[lparen Ident<arg> (. args.push_back(Atom<Identifier_t>(arg)); .)
{comma Ident<arg> (. args.push_back(Atom<Identifier_t>(arg)); .)
} rparen]
Type<t>period (. t.addBindings(move(args)); root->add(move(t), Atom<Identifier_t>(tname)); .)
.
ContextDecl<CodeScope * scope> = (. Expression tag; .)
context tagcolon
MetaSimpExpr<tag> (. scope->tags.push_back(tag); .)
{';' MetaSimpExpr<tag> (. scope->tags.push_back(tag); .)
}.
VDecl<CodeScope* f> = (. std::wstring vname; Expression var, value;.)
VarIdent<var> assign ExprTyped<value> (. Symbol identSymbol = f->addDefinition(move(var), move(value));
Attachments::put<SymbolAlias>(value, identSymbol);
.)
.
BDecl<CodeScope* scope> = lcurbrack (. Expression body; pushContextScope(scope); .)
{(IF(checkAssignment()) VDecl<scope> period
| RuleContextDecl<scope>
| ContextDecl<scope>period
| ExprTyped<body> (. scope->setBody(body); Attachments::put<SymbolAlias>(body, Symbol{ScopedSymbol::RetSymbol, scope});.)
)}
rcurbrack (. popContextScope(); .)
.
IfDecl<Expression& e> = (. Expression cond; ManagedScpPtr blockTrue = root->add(new CodeScope(context.scope)); ManagedScpPtr blockFalse = root->add(new CodeScope(context.scope)); .)
"if" lparen Expr<cond> rparen (. e = Expression(Operator::IF, {cond}); .)
tagcolon ExprAnnotations<e>
BDecl<&*blockTrue> "else" BDecl<&*blockFalse> (. e.addBlock(blockTrue); e.addBlock(blockFalse); .)
.
LoopDecl<Expression& e> =
(. Expression eIn, eAcc, eFilters; std::wstring varEl, varAcc, contextClass; Expression tagsEl;
ManagedScpPtr block = root->add(new CodeScope(context.scope)); .)
"loop"
("map" lparen Expr<eIn> implic Ident<varEl> (. e = Expression(Operator::MAP, {eIn}); .)
tagcolon ExprAnnotations<tagsEl> rparen tagcolon ExprAnnotations<e>
(.
e.addBindings({Atom<Identifier_t>(varEl)});
block->addBinding(Atom<Identifier_t>(varEl), move(tagsEl));
.)
BDecl<&*block>
(. e.addBlock(block); .)
|"fold"
("inf" lparen Expr<eAcc> implic Ident<varAcc> rparen
(.
e = Expression(Operator::FOLD_INF, {eAcc});
e.addBindings({Atom<Identifier_t>(varAcc)});
block->addBinding(Atom<Identifier_t>(varAcc), Expression());
.)
tagcolon ExprAnnotations<e> BDecl<&*block>
(. e.addBlock(block); .)
| lparen Expr<eIn> implic Ident<varEl> tagcolon ExprAnnotations<tagsEl> ['|' Expr<eFilters> ] comma Expr<eAcc> implic Ident<varAcc>rparen
(.
e = Expression(Operator::FOLD, {eIn, eAcc});
e.addBindings({Atom<Identifier_t>(varEl), Atom<Identifier_t>(varAcc)});
.)
tagcolon ExprAnnotations<e>
(.
block->addBinding(Atom<Identifier_t>(varEl), move(tagsEl));
block->addBinding(Atom<Identifier_t>(varAcc), Expression());
.)
BDecl<&*block>
(. e.addBlock(block); .)
)
).
// Switches
SwitchDecl<Expression& eSwitch, SwitchKind flagSwitchKind> = (. TypeAnnotation typ; eSwitch = Expression(Operator::SWITCH, {}); Expression eCondition; Expression tag;.)
"switch"
(
SwitchVariantDecl<eSwitch>
| SwitchLateDecl<eSwitch>
| lparen ExprTyped<eCondition> rparen tagcolon ExprAnnotations<eSwitch> (. eSwitch.operands.push_back(eCondition);.)
CaseDecl<eSwitch, flagSwitchKind> {CaseDecl<eSwitch, flagSwitchKind>}
)
.
CaseDecl<Expression& outer, SwitchKind flagSwitchKind> = (. ManagedScpPtr scope = root->add(new CodeScope(context.scope)); Expression condition; .)
"case"
( IF(flagSwitchKind == SWITCH_META)
lparen MetaSimpExpr<condition> rparen BDecl<&*scope> (. Expression exprCase(Operator::CASE, {}); exprCase.addTags({condition}); exprCase.addBlock(scope); outer.addArg(move(exprCase));.)
| "default" BDecl<&*scope> (. Expression exprCase(Operator::CASE_DEFAULT, {});
exprCase.addBlock(scope);
outer.operands.insert(++outer.operands.begin(), exprCase); .)
| lparen CaseParams<&*scope> rparen (. ManagedScpPtr scopeBody = root->add(new CodeScope(&*scope)); Expression exprCase(Operator::CASE, {}); .)
BDecl<&*scopeBody> (. exprCase.addBlock(scope); exprCase.addBlock(scopeBody); outer.addArg(move(exprCase)); .)
).
CaseParams<CodeScope* scope> = (. Expression condition; Expression guard(Operator::LOGIC_AND, {}); pushContextScope(scope); .)
ExprTyped<condition> (. guard.addArg(Expression(condition)); .)
{comma ExprTyped<condition> (. guard.addArg(Expression(condition)); .)
} (. scope->setBody(guard); popContextScope(); .)
.
SwitchLateDecl<Expression& expr> =
(.
std::wstring aliasCondition; Expression exprCondition, aliasAnns;
expr = Expression(Operator::SWITCH_LATE, {});
ManagedScpPtr scope = root->add(new CodeScope(context.scope));
.)
"late" lparen Expr<exprCondition> [implic Ident<aliasCondition>] [tagcolon ExprAnnotations<aliasAnns>] rparen
tagcolon ExprAnnotations<expr> BDecl<&*scope>
(.
expr.addArg(Expression(exprCondition));
expr.addBlock(scope);
std::string alias;
if(aliasCondition.empty()){
if(exprCondition.__state != Expression::IDENT){
SemErr(coco_string_create("An identifier expected in the short form"));
return;
}
//Use exprCondition as identifier
alias = exprCondition.getValueString();
} else {
//Use aliasCondition
alias = Atom<Identifier_t>(move(aliasCondition)).get();
}
expr.addBindings({Atom<Identifier_t>(string(alias))});
scope->addBinding(Atom<Identifier_t>(move(alias)), move(aliasAnns));
.)
.
SwitchVariantDecl<Expression& expr> =
(. Expression varTested; std::wstring varAlias; bool flagAliasFound = false; expr = Expression(Operator::SWITCH_VARIANT, {}); .)
"variant" lparen Expr<varTested> [implic Ident<varAlias>
(. flagAliasFound = true; .)
] [tagcolon ExprAnnotations<varTested>] rparen tagcolon ExprAnnotations<expr>
(. expr.addArg(std::move(varTested));
if (flagAliasFound) {
expr.addBindings({Atom<Identifier_t>(varAlias)});
} else {
if(varTested.__state == Expression::IDENT){
expr.addBindings({Atom<Identifier_t>(string(varTested.getValueString()))});
}
}
.)
CaseVariantDecl<expr> {CaseVariantDecl<expr>}
.
CaseVariantDecl<Expression& expr> = (. ManagedScpPtr scope = root->add(new CodeScope(context.scope)); std::wstring key; scope->addBinding(Atom<Identifier_t>(string(expr.bindings.front())), Expression()); .)
"case" lparen Ident<key> rparen (. expr.addArg(root->recognizeVariantConstructor(Atom<Identifier_t>(std::move(key)))); .)
BDecl<&*scope> (. expr.addBlock(scope); .)
.
IntrinsicDecl<Expression& outer>= (. std::wstring name; .)
-"intrinsic" Ident< name> (. outer = Expression(Operator::CALL_INTRINSIC, {}); outer.setValue(Atom<Identifier_t>(name)); .)
-lparen [CalleeParams<outer>] rparen .
+ "intrinsic"
+(
+ Ident< name> lparen [CalleeParams<outer>] rparen
+ (. outer = Expression(Operator::CALL_INTRINSIC, {}); outer.setValue(Atom<Identifier_t>(name)); .)
+ | "query" (. outer = Expression(Operator::QUERY, {}); .)
+ (
+ "late" IntrinsicQueryLateDecl<outer>
+ | lparen [CalleeParams<outer>] rparen
+ )
+).
+
+IntrinsicQueryLateDecl<Expression& expr> =
+ (.
+ std::wstring predicateAlias; Expression predicateE, predicateAnns;
+ expr = Expression(Operator::QUERY_LATE, {});
+ ManagedScpPtr scope = root->add(new CodeScope(context.scope));
+ .)
+
+ lparen Expr<predicateE> implic Ident<predicateAlias> tagcolon ExprAnnotations<predicateAnns> rparen
+ tagcolon ExprAnnotations<expr> BDecl<&*scope>
+ (.
+ expr.addArg(move(predicateE));
+ expr.addBindings({Atom<Identifier_t>(wstring(predicateAlias))});
+ scope->addBinding(Atom<Identifier_t>(move(predicateAlias)), move(predicateAnns));
+ expr.addBlock(scope);
+ .)
+.
SequenceDecl<Expression& sequence> = (. sequence = Expression(); sequence.setOp(Operator::SEQUENCE); ManagedScpPtr scope = root->add(new CodeScope(context.scope)); .)
"seq" BDecl<&*scope> (. sequence.blocks.push_back(&*scope); scope = root->add(new CodeScope(&*scope)); .)
{ (. scope = root->add(new CodeScope(&*scope)); .)
BDecl<&*scope> (. sequence.blocks.push_back(&*scope); .)
}.
/*============================ INTERFACES ===============================*/
Imprt<> =
"import" "raw" lparen string (. root->__rawImports.push_back(Atom<String_t>(t->val).get()); .)
rparen period.
InterfaceData<> = "interface" lparen
( "dfa" rparen InterfaceDFA
| "extern-c" rparen InterfaceExternC
| "cfa" rparen InterfaceCFA
).
InterfaceExternC<> = (. ExternData data; .)
lcurbrack {IncludeExternDecl<data> | LibExternDecl<data> } rcurbrack
(. root->addExternData(move(data)); .)
.
LibExternDecl<ExternData& data> = (. std::wstring pkgname, libname; .)
Ident<libname> assign "library" tagcolon "pkgconfig"
lparen string (. pkgname = t->val; .)
rparen period (. data.addLibrary(Atom<Identifier_t>(libname), Atom<String_t>(pkgname)); .)
.
IncludeExternDecl<ExternData& data> = (. Expression inc; .)
"include" StructLiteral<inc> period (. data.addIncludeDecl(move(inc)); .)
.
InterfaceDFA<> = lcurbrack { InstructDecl } rcurbrack .
InstructDecl = (.Operator op; Expression tag;
Expression scheme;
std::vector<Expression>& tags = scheme.operands;
tags.push_back(Expression()); /* return value */ .)
"operator" InstructAlias<op> tagcolon lparen (.scheme.setOp(op); .)
[
MetaSimpExpr<tag> (. tags.push_back(tag); .)
{
comma MetaSimpExpr<tag> (. tags.push_back(tag); .)
}
] rparen [ implic MetaSimpExpr<tag> (. tags[0] = tag; .)
] (. root->addDFAData(move(scheme)); .)
period.
InstructAlias<Operator& op> =
(
"map" (. op = Operator::MAP; .)
| "list_range" (. op = Operator::LIST_RANGE; .)
| "list" (. op = Operator::LIST; .)
| "fold" (. op = Operator::FOLD; .)
| "index" (. op = Operator::INDEX; .)
).
InterfaceCFA<> = lcurbrack { InstructCFADecl } rcurbrack .
InstructCFADecl<> = (.Operator op; Expression tag;
Expression scheme;
std::vector<Expression>& tags = scheme.operands; .)
"operator" InstructAlias<op> tagcolon (. scheme.setOp(op); .)
[
MetaSimpExpr<tag> (. tags.push_back(tag); .)
{
comma MetaSimpExpr<tag> (. tags.push_back(tag); .)
}
] period (. root->addInterfaceData(CFA, move(scheme)); .).
/*============================ METAPROGRAMMING ===============================*/
// TagsDecl<CodeScope* f> = (. Expression tag; TagModifier mod = TagModifier::NONE; .)
// ':' { MetaSimpExpr<tag> (. /*f.addTag(std::move(tag), mod); */ .)
// }.
FnTag<Function* f> = (. Expression tag; TagModifier mod = TagModifier::NONE; .)
MetaSimpExpr<tag>
['-' TagMod<mod>] (. f->addTag(std::move(tag), mod); .).
TagMod<TagModifier& mod> =
( "assert" (. mod = TagModifier::ASSERT; .)
| "require" (. mod = TagModifier::REQUIRE; .)
).
RuleDecl<> =
"rule" tagcolon (. RuleArguments args; RuleGuards guards; DomainAnnotation typ; std::wstring arg; .)
lparen Ident<arg> tagcolon Domain<typ> (. args.add(arg, typ); .)
{comma Ident<arg> tagcolon Domain<typ> (. args.add(arg, typ); .)
} rparen
["case" RGuard<guards> {comma RGuard<guards>}]
lcurbrack RBody<args, guards> rcurbrack .
/* - TODO use RGuard for guards-*/
RuleContextDecl<CodeScope* scope> = (.Expression eHead, eGuards, eBody; .)
"rule" "context" tagcolon MetaSimpExpr<eHead>
"case" lparen MetaSimpExpr<eGuards> rparen
lcurbrack MetaSimpExpr<eBody> rcurbrack (.scope->contextRules.push_back(Expression(Operator::CONTEXT_RULE, {eHead, eGuards, eBody})); .).
Domain<DomainAnnotation& dom> =
(
"function" (. dom = DomainAnnotation::FUNCTION; .)
| "variable" (. dom = DomainAnnotation::VARIABLE; .)
).
RGuard<RuleGuards& guards>= (. Expression e; .)
MetaExpr<e> (. guards.add(std::move(e)); .).
MetaExpr<Expression& e>= (.Operator op; Expression e2; .)
MetaExpr2<e>
[MetaOp<op> MetaExpr2<e2> (. e = Expression(op, {e, e2}); .)
].
MetaExpr2<Expression& e>=
(
lparen MetaExpr<e> rparen
| MetaSimpExpr<e>
).
MetaSimpExpr<Expression& e>= (. std::wstring i1, infix; Expression e2; .)
( '-' MetaSimpExpr<e2> (. e = Expression(Operator::NEG, {e2}); .)
| IF(checkParametersList()) Ident<i1> (. e = Expression(Operator::CALL, {Expression(Atom<Identifier_t>(i1))}); .)
lparen [ MetaCalleeParams<e> ] rparen
| IF(checkInfix()) Ident<i1> Ident<infix> MetaSimpExpr<e2>
(. e = Expression(Operator::CALL, {Expression(Atom<Identifier_t>(infix))});
e.addArg(Expression(Atom<Identifier_t>(i1)));
e.addArg(std::move(e2));
.)
| Ident<i1> (. e = Expression(Operator::CALL, {Atom<Identifier_t>(i1)}); .)
).
MetaCalleeParams<Expression& e> = (. Expression e2; .)
MetaSimpExpr<e2> (. e.addArg(Expression(e2)); .)
{comma MetaSimpExpr<e2> (. e.addArg(Expression(e2)); .)
}.
RBody<const RuleArguments& args, const RuleGuards& guards> =
(. Expression e; std::wstring msg; .)
"warning" MetaExpr<e> ["message" string (. msg = t->val; .)
] (. root->add(new RuleWarning(RuleArguments(args), RuleGuards(guards), std::move(e), Atom<String_t>(msg))); .)
.
MetaOp< Operator& op> =
implic (. op = Operator::IMPL; .)
.
/*============================ Expressions ===============================*/
ExprAnnotations<Expression& e> = (. TypeAnnotation typ; std::list<Expression> tags; Expression tag; e.tags.clear();.)
Type<typ> (. e.bindType(move(typ)); .)
{';' MetaSimpExpr<tag> (. tags.push_back(tag); .)
} (. e.addTags(tags); .)
.
ExprTyped<Expression&e> = Expr<e> [tagcolon ExprAnnotations<e>].
Expr< Expression& e> (. Operator op; Expression e2; .)
= ExprArithmAdd<e>
[ RelOp<op>
ExprArithmAdd<e2> (. e = Expression(op, {e, e2}); .)
].
ExprArithmAdd< Expression& e>= (. Operator op; Expression e2; .)
ExprArithmMul< e>
[ AddOp< op>
ExprArithmAdd< e2> (. e = Expression(op, {e, e2});.)
].
ExprArithmMul< Expression& e> (. Operator op; Expression e2; .)
= ExprPostfix< e>
[ MulOp< op>
ExprArithmMul< e2> (. e = Expression(op, {e, e2}); .)
].
ExprPostfix<Expression& e>
= Term<e>
[ (. e = Expression(Operator::INDEX, {e}); .)
{lbrack CalleeParams<e> rbrack }
].
Term< Expression& e> (. std::wstring name; e = Expression(); .)
=
(IF (checkParametersList()) Ident< name>
(. e = Expression(Operator::CALL, {Atom<Identifier_t>(name)}); root->recognizeVariantConstructor(e); .)
lparen [CalleeParams<e>] rparen
| VarIdent<e> (. recognizeIdentifier(e); .)
| ListLiteral<e> (. /* tuple */.)
| StructLiteral<e> (. /* struct */.)
| LoopDecl<e>
| IfDecl<e>
| SwitchDecl<e, SWITCH_NORMAL>
| IntrinsicDecl<e>
| SequenceDecl<e>
| number (. e = Expression(Atom<Number_t>(t->val)); .)
| string (. e = Expression(Atom<String_t>(t->val)); .)
| "true" (. e = Expression(Atom<Number_t>(1)); e.bindType(TypePrimitive::Bool); .)
| "false" (. e = Expression(Atom<Number_t>(0)); e.bindType(TypePrimitive::Bool); .)
| "undef" (. e = Expression(Operator::UNDEF, {}); .)
| '-' Term<e> (. e = Expression(Operator::NEG, {e}); .)
| lparen ExprTyped<e> rparen
).
StructLiteral<Expression& e> = (. std::wstring key; Expression val; std::list<Atom<Identifier_t>> keys; size_t keyCounter=0; .)
lcurbrack
(IF(checkTokenAfterIdent(_assign)) Ident<key> assign Expr<val>
| Expr<val> (. key = to_wstring(keyCounter++); .)
) (. keys.push_back(Atom<Identifier_t>(key)); e = Expression(Operator::LIST_NAMED, {val}); .)
{comma (IF(checkTokenAfterIdent(_assign)) Ident<key> assign Expr<val>
| Expr<val> (. key = to_wstring(keyCounter++); .)
) (. e.addArg(Expression(val)); keys.push_back(Atom<Identifier_t>(key)); .)
} rcurbrack (. e.addBindings(keys.begin(), keys.end()); .)
.
ListLiteral<Expression& e> = (. Expression eFrom, eTo; .)
lbrack (. e.setOp(Operator::LIST); .)
[ Expr<eFrom> (. e.addArg(Expression(eFrom)); .)
( ".." Expr<eTo> (. e.addArg(Expression(eTo)); e.setOp(Operator::LIST_RANGE); .)
|{comma Expr<eFrom> (. e.addArg(Expression(eFrom)); .)
}
)
]
rbrack.
CalleeParams<Expression& e> = (. Expression e2; .)
ExprTyped<e2> (. e.addArg(Expression(e2)); .)
{comma ExprTyped<e2> (. e.addArg(Expression(e2)); .)
}.
AddOp< Operator& op>
= (. op = Operator::ADD; .)
( '+'
| '-' (. op = Operator::SUB; .)
).
MulOp< Operator& op>
= (. op = Operator::MUL; .)
( '*'
| '/' (. op = Operator::DIV; .)
).
RelOp< Operator& op>
= (. op = Operator::EQU; .)
( equal
| (ne1 | ne2) (. op = Operator::NE; .)
| lse (. op = Operator::LSE; .)
| lss (. op = Operator::LSS; .)
| gte (. op = Operator::GTE; .)
| gtr (. op = Operator::GTR; .)
).
SkipModulesSection = "module" lcurbrack {ANY} rcurbrack.
END Xreate.
diff --git a/scripts/cfa/context.lp b/scripts/cfa/context.lp
index eb6c9ef..b8167e0 100644
--- a/scripts/cfa/context.lp
+++ b/scripts/cfa/context.lp
@@ -1,106 +1,106 @@
% This Source Code Form is subject to the terms of the Mozilla Public
% License, v. 2.0. If a copy of the MPL was not distributed with this
% file, You can obtain one at http://mozilla.org/MPL/2.0/.
%% INPUT:
%% - latex_scope_demand(Scope, Subject)
%% Initial demand from clients
%%
%% - latex_registered_subjects(Subject, PossibleDecision)
%% Clients register possible decisions for respective subjects
%%
%% - latex_fn_signature
%%
%% OUTPUT:
%% - latex_fn_demand(Fn, Subject)
%% Which functions demand hidden latex arguments
%%
%% - latex_decision(Scope, Subject, Decision)
%% Provided decisions, values for hidden latex arguments
%%
%% SIGNATURES:
%% -Subject: string
%%
% CONTEXT PROPAGATION
%===========================================================
% nested scope propagation:
bind_scope(Scope, Context, Info):-
bind_scope(ScopeParent, Context, Info);
cfa_parent(Scope, scope(ScopeParent)).
% Strong or Uniform inter-function propagation:
bind_scope(Scope, Context, Info):-
bind_scope(ScopeParent, Context, Info): cfa_call(ScopeParent, FnCurrent);
cfa_parent(Scope, function(FnCurrent)); cfa_call(_, FnCurrent);
bind_scope(_, Context, Info); scope(Scope).
% weak inter-function propagation
bind_scope(Scope, Context, weak(ScopeParent)):-
not bind_scope(Scope, Context, strong);
bind_scope(ScopeParent, Context, strong);
cfa_call(ScopeParent, FnCurrent);
cfa_parent(Scope, function(FnCurrent)).
% DEMAND
%===========================================================
%demand propagations: scope level
latex_scope_demand(Scope, Subject):-
latex_scope_demand(ScopeChild, Subject);
cfa_parent(ScopeChild, scope(Scope)).
%propagation: fn level
latex_fn_demand(Fn, Subject):-
latex_scope_demand(ScopeFnBody, Subject);
cfa_parent(ScopeFnBody, function(Fn)).
latex_fn_demand_ordered(Fn, Subject, Id):-
Id= #sum{ 1, SubjLess : latex_fn_demand(Fn, SubjLess), SubjLess < Subject};
latex_fn_demand(Fn, Subject).
%propagation: inter-fn level
latex_scope_demand(Scope, Subject):-
latex_fn_demand(FnCallee, Subject);
not latex_decision(Scope, Subject, _);
cfa_call(Scope, FnCallee).
% DECISIONS
%===========================================================
latex_decision(Scope, Subject, Decision):-
latex_fn_demand(FnCallee, Subject);
bind_scope(Scope, Decision, strong);
cfa_call(Scope, FnCallee);
latex_registered_subjects(Subject, Decision).
-latex_fn_signature_size(Fn, IdMax + 1):-
- IdMax = #max{ Id, Id : ast_scope_binding(FnBody, Id, _) };
- cfa_parent(FnBody, function(Fn)).
-
-latex_fn_signature_size(Fn, 0):-
- not ast_scope_binding(FnBody, _, _);
- cfa_parent(FnBody, function(Fn)).
-
%late decision
-late((ScopeCaller, Subject), s(Size + SubjOrder+1, -2, FnCallerBody), (AnyDecision), latex_decision(ScopeCaller, Subject, AnyDecision)):-
+late((ScopeCaller, Subject), SubjectS, (AnyDecision), latex_decision(ScopeCaller, Subject, AnyDecision)):-
scope_fn(ScopeCaller, FnCaller);
cfa_parent(FnCallerBody, function(FnCaller));
- latex_fn_signature_size(FnCaller, Size);
- latex_fn_demand_ordered(FnCaller, Subject, SubjOrder);
+ latex_symbol(FnCaller, Subject, SubjectS);
cfa_call(ScopeCaller, FnCallee);
latex_fn_demand(FnCallee, Subject);
latex_registered_subjects(Subject, AnyDecision).
+% UTILITY
+%===========================================================
+latex_symbol(Fn, Topic, s(TopicsOffset + TopicId, -2, FnBody)):-
+ cfa_parent(FnBody, function(Fn));
+ latex_parameters_group_offset(TopicsOffset);
+ latex_fn_demand_ordered(Fn, Topic, TopicId).
+
% IMPLEMENTATION
%===========================================================
scope_fn(Scope, Fn):-cfa_parent(Scope, function(Fn)).
scope_fn(Scope, Fn):-
scope_fn(ScopeParent, Fn);
cfa_parent(Scope, scope(ScopeParent)).
+
+latex_parameters_group_offset(1000).
diff --git a/scripts/containers/Containers_Implementation_LinkedList1.xreate b/scripts/containers/Containers_Implementation_LinkedList1.xreate
index 510191f..6e26185 100644
--- a/scripts/containers/Containers_Implementation_LinkedList1.xreate
+++ b/scripts/containers/Containers_Implementation_LinkedList1.xreate
@@ -1,50 +1,50 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// EXTERN INCLUDES
interface(extern-c){
xml2 = library:: pkgconfig("libxml-2.0").
include {
xml2 = ["libxml/tree.h"]
}.
}
// CONTAINERS
interface(dfa) {
operator map:: (op(seqaccess)) -> impl(solid).
operator list_range:: ()->impl(on_the_fly).
operator list:: ()->impl(solid).
operator fold:: (op(seqaccess)).
/* operator index:: (op(randaccess)). - BREAKS THE ANALYSIS. MAKE tree VIEWED AS COLLECTION */
/* operator map: (op(seqaccess)) -> impl(llvm_array | on_the_fly); */
}
-import raw("core/containers.lp").
+import raw("scripts/containers/containers.lp").
// PROGRAM
XmlNode = type {
tag:: string,
/* attrs:: [string],*/
content:: string
}.
Tree = type {Leaf, [Tree(Leaf)]}.
XmlTree = type Tree(XmlNode).
test= function:: num; entry {
filename = "scripts/containers/Containers_Implementation_LinkedList1-data.xml" :: string.
docRaw = xmlParseFile(filename) :: xmlDocPtr.
tree= xmlDocGetRootElement(docRaw) :: xmlNodePtr.
childrenRaw = tree["children"]:: [xmlNodePtr]; linkedlist(next, null).
size = loop fold(childrenRaw->child:: xmlNodePtr, 0->count):: int {
count +1::int
}.
size
}
diff --git a/scripts/virtualization/test1.assembly.lp b/scripts/virtualization/test1.assembly.lp
index 3762dae..91f2ae1 100644
--- a/scripts/virtualization/test1.assembly.lp
+++ b/scripts/virtualization/test1.assembly.lp
@@ -1,2 +1,35 @@
-virtDomain(domainA).
-virtDomain(domainB).
+% INPUT
+%-----------------------------------
+% sizo(..).
+
+sizo(Sizo):-
+ bind_scope(_, attachedSizo(Sizo), strong).
+
+dict_sizo(Sizo, Id):-
+ Id= #sum{ 1, SizoLess : sizo(SizoLess), SizoLess < Sizo};
+ sizo(Sizo).
+
+% connect to latex
+%-----------------------------------
+latex_registered_subjects(sizo, Sizo):- sizo(Sizo).
+
+latex_scope_demand(ScopeDemandSizo, sizo):-
+ bind(Target, demand(sizo));
+ Target = s(_, _, ScopeDemandSizo).
+
+bind_scope(Scope, Sizo, strong):-
+ bind_scope(Scope, attachedSizo(Sizo), strong).
+
+% register late query
+%-----------------------------------
+late(Target, SymbolSizo, (SizoAny), sizo_current(SizoAny)):-
+ bind(Target, demand(sizo));
+ Target=s(_, _, TargetS);
+ scope_fn(TargetS, Fn);
+ cfa_parent(FnBody, function(Fn));
+ latex_symbol(Fn, sizo, SymbolSizo);
+ sizo(SizoAny).
+
+
+% IMPLEMENTATION
+%=========================================================== .
diff --git a/scripts/virtualization/test1.h b/scripts/virtualization/test1.h
new file mode 100644
index 0000000..9c5417d
--- /dev/null
+++ b/scripts/virtualization/test1.h
@@ -0,0 +1,4 @@
+#include <stdio.h>
+#include <string.h>
+
+typedef FILE* FILEP;
diff --git a/scripts/virtualization/test1.xreate b/scripts/virtualization/test1.xreate
index 35c05b1..c2cbe11 100644
--- a/scripts/virtualization/test1.xreate
+++ b/scripts/virtualization/test1.xreate
@@ -1,72 +1,47 @@
interface(extern-c){
externalLibs = library:: pkgconfig("libxml-2.0").
include {
- externalLibs = ["stdio.h"]
+ externalLibs = ["scripts/virtualization/test1.h"]
}.
}
import raw ("scripts/virtualization/test1.assembly.lp").
-import raw ("scripts/virtualization/virtualization.lp").
+import raw ("scripts/cfa/context.lp").
-Annotation = type variant {
- Num:: int,
- String:: string,
- Func:: {name::string, arguments::[Annotation]}
-}.
+DictSizo = type slave dict_sizo.
+Sizo = type slave sizo.
-DictEntry = type {Annotation, Id}.
-
-extractDictEntry = function(entry:: Annotation):: DictEntry; interpretation(force){
- resultWrong = { String("wrong"), 0 }:: DictEntry.
-
- switch variant (entry):: DictEntry
- case (Num) { resultWrong }
- case (String) { resultWrong }
- case (Func){
- domAnn = entry["arguments"][0]:: Annotation.
-
- switch variant ( entry["arguments"][1]->id ):: Annotation
- case (Num) { {domAnn, id} }
- case (String) { resultWrong }
- case (Func) { resultWrong }
- }
-}
+virt_getPrefix = function:: string
+{
+ dictSizo = intrinsic query("dict_sizo")::[DictSizo].
-encodeDomain = function(key::Annotation):: int; interpretation(force){
- dict = intrinsic query("virtDictDomains")::[Annotation].
-
- id = loop fold(dict->entryAnn::Annotation, 0->id):: int {
- entry = extractDictEntry(entryAnn):: DictEntry.
-
- if(entry[0] == key):: int { entry[1] } else { id }
+ sizoId = intrinsic query late("sizo_current"->sizoCurrent:: Sizo):: int; demand(sizo)
+ {
+ loop fold(dictSizo->entry::DictSizo, 0->id):: int {
+ if(entry[0] == sizoCurrent):: int { entry[1] } else { id }
+ }
}.
- id
-
- /*
buf = "000000000"::string.
seq
- { sprintf(buf, "%d", id).}
- { buf}
- */
+ { sprintf(buf, "%d", sizoId) }
+ { buf }
}
-
-main = function:: int; entry {
- encodeDomain(Func({"domainB", []}))
-}
-
-/*
-openfile = function(fileName::string, prefixPackedAnn:: Annotation) {
- prefixStr = encodeDomain(prefixPackedAnn):: string.
-
- fopen(prefixStr + fileName)
+openFile = function(filename::string):: int
+{
+ buf = "0000000000":: string.
+ prefix = virt_getPrefix():: string.
+ seq
+ {sprintf(buf, "/%s/%s", prefix, filename)}
+ {printf("file opened: %s ", buf)}
}
-main = function:: entry (
+main = function:: int; entry
+{
seq
- { context::virtualization(domainA). openFile("test1", intrinsic query("openFileAdditionalArgsDomA")[0]) }
- { context::virtualization(domainB). openFile("test1", intrinsic query("openFileAdditionalArgsDomB")[0]) }
-)
-*/
+ { context::attachedSizo(domainA). openFile("test1") }
+ { context::attachedSizo(domainB). openFile("test1") }
+ { 0 }
+}
diff --git a/scripts/virtualization/test2.assembly.lp b/scripts/virtualization/test2.assembly.lp
new file mode 100644
index 0000000..8ce61dc
--- /dev/null
+++ b/scripts/virtualization/test2.assembly.lp
@@ -0,0 +1,45 @@
+% INPUT
+%-----------------------------------
+% assign_sizo(..).
+
+sizo(Sizo):-
+ bind_scope(_, assign_sizo(Sizo), strong).
+
+dict_sizo(Sizo, Id):-
+ Id= #sum{ 1, SizoLess : sizo(SizoLess), SizoLess < Sizo};
+ sizo(Sizo).
+
+% connect to latex
+%-----------------------------------
+latex_registered_subjects(sizo, Sizo):- sizo(Sizo).
+
+latex_scope_demand(ScopeDemandSizo, sizo):-
+ bind(Target, demand(sizo));
+ Target = s(_, _, ScopeDemandSizo).
+
+bind_scope(Scope, Sizo, strong):-
+ bind_scope(Scope, assign_sizo(Sizo), strong).
+
+% register late query
+%-----------------------------------
+late(Target, SymbolSizo, (SizoAny), sizo_current(SizoAny)):-
+ bind(Target, demand(sizo));
+ Target=s(_, _, TargetS);
+ scope_fn(TargetS, Fn);
+ latex_symbol(Fn, sizo, SymbolSizo);
+ sizo(SizoAny).
+
+% polymorphism based on virtualizaion strategy
+%-----------------------------------
+dfa_callguard(SymbRet, strategy(Strategy)):-
+ dfa_callfn(SymbRet, FnName);
+ bind_func(FnName, requires(virt_dereference_strategy));
+ virt_dereference_strategy(Strategy).
+
+
+% IMPLEMENTATION
+%=========================================================== .
+virt_dereference_strategy(prefix) :- 2 #count{Sizo: sizo(Sizo)}.
+virt_dereference_strategy(none) :- not virt_dereference_strategy(prefix).
+
+
diff --git a/scripts/virtualization/test2.xreate b/scripts/virtualization/test2.xreate
index 83d68ef..47856be 100644
--- a/scripts/virtualization/test2.xreate
+++ b/scripts/virtualization/test2.xreate
@@ -1,39 +1,57 @@
-
-// Different sizos get different prefixes
+interface(extern-c){
+ externalLibs = library:: pkgconfig("libxml-2.0").
-SIZO = type slave sizo.
-
-findSizoId = function(key::Annotation):: int; interpretation(force){
- dict = intrinsic query("dictSizos")::[Annotation].
-
- id = loop fold(dict->entryAnn::Annotation, 0->id):: int {
- entry = extractDictEntry(entryAnn):: DictEntry.
-
- if(entry[0] == key):: int { entry[1] } else { id }
+ include {
+ externalLibs = ["scripts/virtualization/test1.h"]
}.
-
- id
}
-findSizoPrefx = function(sizo:: SIZO):: string
+import raw ("scripts/virtualization/test2.assembly.lp").
+import raw ("scripts/cfa/context.lp").
+
+DictSizo = type slave dict_sizo.
+Sizo = type slave sizo.
+
+guard:: strategy(prefix)
{
- id = findSizoId(sizo).
-
- buf = "0000"::string.
- seq
- { sprintf(buf, "%d", id).}
- { buf }
+ virt_dereferenceFilename = function(filename:: string):: string; requires(virt_dereference_strategy)
+ {
+ dictSizo = intrinsic query("dict_sizo")::[DictSizo].
+
+ sizoId = intrinsic query late("sizo_current"->sizoCurrent:: Sizo):: int; demand(sizo)
+ {
+ loop fold(dictSizo->entry::DictSizo, 0->id):: int
+ {
+ if(entry[0] == sizoCurrent):: int { entry[1] } else { id }
+ }
+ }.
+
+ buf = "000000000"::string.
+ seq
+ { sprintf(buf, "%d/%s", sizoId, filename) }
+ { buf }
+ }
}
-openfile = function
+guard:: strategy(none)
{
- domCurrent = query context:: SIZO.
- prefix = findSizoPrefx(domCurrent):: string.
-
- fopen(prefixStr + fileName)
+ virt_dereferenceFilename = function(filename:: string):: string; requires(virt_dereference_strategy)
+ {
+ filename
+ }
}
-writefile = function
+virt_openFile = function(filename:: string):: int
{
+ filenameReal = virt_dereferenceFilename(filename):: string.
+ seq{printf("file opened: %s ", filenameReal)}
+}
+main = function:: int; entry
+{
+ seq
+ { context::assign_sizo(domainA). virt_openFile("test1") }
+ { context::assign_sizo(domainA). virt_openFile("test1") }
+ { 0 }
}
+
diff --git a/scripts/virtualization/test3.assembly.lp b/scripts/virtualization/test3.assembly.lp
new file mode 100644
index 0000000..cb7af52
--- /dev/null
+++ b/scripts/virtualization/test3.assembly.lp
@@ -0,0 +1,63 @@
+% INPUT
+%-----------------------------------
+% assign_sizo(..).
+
+sizo(Sizo):-
+ bind_scope(_, assign_sizo(Sizo), strong).
+
+dict_sizo(Sizo, Id):-
+ Id= #sum{ 1, SizoLess : sizo(SizoLess), SizoLess < Sizo};
+ sizo(Sizo).
+
+% connect to latex
+%-----------------------------------
+latex_registered_subjects(sizo, Sizo):- sizo(Sizo).
+
+latex_scope_demand(ScopeDemandSizo, sizo):-
+ bind(Target, demand(sizo));
+ Target = s(_, _, ScopeDemandSizo).
+
+bind_scope(Scope, Sizo, strong):-
+ bind_scope(Scope, assign_sizo(Sizo), strong).
+
+% register late query
+%-----------------------------------
+late(Target, SymbolSizo, (SizoAny), sizo_current(SizoAny)):-
+ bind(Target, demand(sizo));
+ Target=s(_, _, TargetS);
+ scope_fn(TargetS, Fn);
+ latex_symbol(Fn, sizo, SymbolSizo);
+ sizo(SizoAny).
+
+% polymorphism based on virtualizaion strategy
+%-----------------------------------
+late(SymbRet, SymbolSizo, Sizo, dfa_callguard(SymbRet, strategy(Strategy))):-
+ dfa_callfn(SymbRet, FnName);
+ bind_func(FnName, requires(virt_dereference_strategy));
+ SymbRet=s(_, _, ScopeCaller);
+ scope_fn(ScopeCaller, Fn);
+ latex_symbol(Fn, sizo, SymbolSizo);
+ sizo(Sizo);
+ virt_dereference_strategy(Sizo, Strategy).
+
+
+% IMPLEMENTATION
+%=========================================================== .
+
+sizo_properties(Sizo, Prop):-
+ bind_scope(Scope, define_sizo_prop(Prop), strong);
+ bind_scope(Scope, Sizo, strong);
+ sizo(Sizo).
+
+virt_dereference_strategy(SizoOther, prefix):-
+ sizo_properties(Sizo, inner);
+ SizoOther <> Sizo;
+ sizo(SizoOther).
+
+virt_dereference_strategy(Sizo, prefix):-
+ sizo_properties(Sizo, outer).
+
+virt_dereference_strategy(Sizo, none) :-
+ not virt_dereference_strategy(Sizo, prefix);
+ sizo(Sizo).
+
diff --git a/scripts/virtualization/test3.xreate b/scripts/virtualization/test3.xreate
new file mode 100644
index 0000000..37d93f6
--- /dev/null
+++ b/scripts/virtualization/test3.xreate
@@ -0,0 +1,57 @@
+interface(extern-c){
+ externalLibs = library:: pkgconfig("libxml-2.0").
+
+ include {
+ externalLibs = ["scripts/virtualization/test1.h"]
+ }.
+}
+
+import raw ("scripts/virtualization/test3.assembly.lp").
+import raw ("scripts/cfa/context.lp").
+
+DictSizo = type slave dict_sizo.
+Sizo = type slave sizo.
+
+guard:: strategy(prefix)
+{
+ virt_dereferenceFilename = function(filename:: string):: string; requires(virt_dereference_strategy)
+ {
+ dictSizo = intrinsic query("dict_sizo")::[DictSizo].
+
+ sizoId = intrinsic query late("sizo_current"->sizoCurrent:: Sizo):: int; demand(sizo)
+ {
+ loop fold(dictSizo->entry::DictSizo, 0->id):: int
+ {
+ if(entry[0] == sizoCurrent):: int { entry[1] } else { id }
+ }
+ }.
+
+ buf = "000000000"::string.
+ seq
+ { sprintf(buf, "%d/%s", sizoId, filename) }
+ { buf }
+ }
+}
+
+guard:: strategy(none)
+{
+ virt_dereferenceFilename = function(filename:: string):: string; requires(virt_dereference_strategy)
+ {
+ filename
+ }
+}
+
+virt_openFile = function(filename:: string):: int
+{
+ filenameReal = virt_dereferenceFilename(filename):: string.
+ printf("file opened: %s ", filenameReal)
+}
+
+main = function:: int; entry
+{
+ seq
+ { context::assign_sizo(domainA); define_sizo_prop(inner). virt_openFile("test1") }
+ { context::assign_sizo(domainB); define_sizo_prop(outer). virt_openFile("test1") }
+ { 0 }
+}
+
diff --git a/scripts/virtualization/virtualization.lp b/scripts/virtualization/virtualization.lp
deleted file mode 100644
index 9aa3f5a..0000000
--- a/scripts/virtualization/virtualization.lp
+++ /dev/null
@@ -1,6 +0,0 @@
-% INPUT:
-% virtDomain() - different virtualization domains
-
-virtDictDomains(Dom, Id):- Id = #sum{1, DomLess : virtDomain(DomLess), DomLess < Dom};
- virtDomain(Dom).
-

Event Timeline