forked from souffle-lang/souffle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into oraculariserisation
- Loading branch information
Showing
67 changed files
with
11,549 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,13 @@ | ||
#! /bin/sh -e | ||
|
||
if [ "$(uname -s)" = "Darwin" ]; then | ||
glibtoolize --force | ||
else | ||
libtoolize --force | ||
fi | ||
|
||
aclocal -I m4 | ||
autoheader | ||
automake --gnu --add-missing | ||
autoconf | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,11 +4,13 @@ | |
# - https://opensource.org/licenses/UPL | ||
# - <souffle root>/licenses/SOUFFLE-UPL.txt | ||
|
||
|
||
AC_INIT(souffle, m4_esyscmd([git describe --tags --abbrev=0 | tr -d '\n']), [[email protected]]) | ||
AC_PREREQ(2.68) | ||
AC_COPYRIGHT(['2013-15 Oracle and/or its affiliates']) | ||
|
||
#LT_PREREQ([2.4]) | ||
LT_INIT([dlopen]) | ||
|
||
AC_CANONICAL_TARGET # target_cpu, target_vendor, and target_os | ||
AC_CANONICAL_BUILD # build_cpu, build_vendor, and build_os | ||
AC_CANONICAL_HOST # host_cpu, host_vendor, and host_os | ||
|
@@ -17,6 +19,16 @@ AM_INIT_AUTOMAKE([foreign subdir-objects]) | |
AM_MAINTAINER_MODE | ||
AC_CONFIG_HEADERS(config.h) | ||
|
||
AC_ARG_ENABLE([java], | ||
[ --enable-java Turn on java interface], | ||
[case "${enableval}" in | ||
yes) java=true ;; | ||
no) java=false ;; | ||
*) AC_MSG_ERROR([bad value ${enableval} for --enable-java]) ;; | ||
esac],[java=false]) | ||
|
||
AM_CONDITIONAL([JAVAI], [test x$java = xtrue]) | ||
|
||
dnl Do not set default CFLAGS and CXXFLAGS | ||
CXXFLAGS=" -Wall -std=c++11 $CXXFLAGS" | ||
if test "$BUILD_TYPE" == "Debug" ; then | ||
|
@@ -34,11 +46,19 @@ AC_PROG_CXX | |
AC_PROG_INSTALL | ||
AC_PROG_MAKE_SET | ||
AM_PROG_CC_STDC | ||
AC_PROG_RANLIB | ||
|
||
# Java | ||
AX_PROG_JAVAC | ||
AX_PROG_JAVAH | ||
AX_PROG_JAVA | ||
AX_PROG_JAR | ||
AX_JNI_INCLUDE_DIR | ||
for dir in $JNI_INCLUDE_DIRS; do | ||
JNIFLAGS="$JNIFLAGS -I$dir" | ||
done | ||
AC_SUBST([JNIFLAGS]) | ||
|
||
# Check for flex and bison | ||
AM_PROG_LEX | ||
AC_PROG_YACC | ||
|
||
|
@@ -161,6 +181,7 @@ AC_CONFIG_FILES([ | |
Makefile | ||
src/Makefile | ||
src/wavelib/Makefile | ||
interfaces/Makefile | ||
prof/Makefile | ||
tests/Makefile | ||
tests/atlocal | ||
|
@@ -213,6 +234,7 @@ AC_FUNC_STRERROR_R | |
AC_CHECK_FUNCS([dup2 fchdir getcwd getpagesize gettimeofday isascii memset mkdir munmap pow regcomp rmdir setenv socket strcasecmp strchr strdup strerror strrchr strstr strtol strtoull]) | ||
|
||
AC_OUTPUT( | ||
[ src/souffle-compile src/souffle-config debian/changelog ], | ||
[ chmod +x src/souffle-compile src/souffle-config ] | ||
[ src/souffle-compile src/souffle-config interfaces/souffle-compilelib debian/changelog ], | ||
[ chmod +x src/souffle-compile src/souffle-config interfaces/souffle-compilelib ] | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
jni/include/Jni_*.h | ||
*.jar | ||
*.la | ||
*.class | ||
/com/ | ||
.* | ||
!/.gitignore | ||
*.o | ||
*.Plo | ||
*.Po | ||
*.lo | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# Souffle - A Datalog Compiler | ||
# (c) 2016 by the Souffle Development Team | ||
# Licensed under the Universal Permissive License v 1.0 as shown at: | ||
# - https://opensource.org/licenses/UPL | ||
# - <souffle root>/licenses/SOUFFLE-UPL.txt | ||
|
||
SUFFIXES = .cpp .h .cc .o .a .class .java | ||
|
||
souffle_jar = com.soufflelang.souffle.jar | ||
dist_bin_SCRIPTS = souffle-compilelib | ||
|
||
# Java source files | ||
java_sources = $(wildcard $(srcdir)/jni/java/*.java) | ||
|
||
# Distribute the Java sources | ||
EXTRA_DIST = examples $(java_sources) | ||
|
||
# C++ source files | ||
cpp_sources = \ | ||
jni/src/Arg.cpp \ | ||
jni/src/Clause.cpp \ | ||
jni/src/Data.cpp \ | ||
jni/src/PrimData.cpp \ | ||
jni/src/Relation.cpp \ | ||
jni/src/Solver.cpp \ | ||
jni/src/Atom.cpp \ | ||
jni/src/Const.cpp \ | ||
jni/src/Executor.cpp \ | ||
jni/src/PrimType.cpp \ | ||
jni/src/Result.cpp \ | ||
jni/src/Var.cpp \ | ||
jni/src/BinOp.cpp \ | ||
jni/src/Constraint.cpp \ | ||
jni/src/Negation.cpp \ | ||
jni/src/Program.cpp \ | ||
jni/src/SConst.cpp | ||
|
||
# Heades generated from the Java class files | ||
cpp_headers = $(patsubst jni/src/%.cpp, $(builddir)/jni/include/Jni_%.h, $(cpp_sources)) | ||
|
||
BUILT_SOURCES = $(cpp_headers) | ||
|
||
$(souffle_jar): $(java_sources) | ||
$(JAVAC) -d $(builddir) $? | ||
$(JAR) -cf $@ $(builddir)/com/soufflelang/souffle/*.class | ||
|
||
all-local: $(souffle_jar) | ||
|
||
$(cpp_headers): jni/include/Jni_%.h : jni/src/%.cpp $(souffle_jar) | ||
$(JAVAH) -jni -o $@ com.soufflelang.souffle.$(basename $(notdir $<)) | ||
|
||
# libsoufflejni.a library | ||
lib_LTLIBRARIES = libsoufflejni.la | ||
libsoufflejni_la_SOURCES = $(cpp_sources) \ | ||
include/AstBuilder.h \ | ||
include/Executor.h \ | ||
include/InterfaceResult.h \ | ||
include/Interfaces.h \ | ||
include/Logger.h \ | ||
jni/include/conversion.h \ | ||
jni/include/handle.h | ||
|
||
libsoufflejni_la_CXXFLAGS = $(JNIFLAGS) \ | ||
-Iinclude -Ijni/include -Ijni/include/generated \ | ||
-I@abs_top_srcdir@ -I@abs_top_srcdir@/src -I@abs_top_srcdir@/include | ||
|
||
libsoufflejni_la_LIBADD = @abs_top_srcdir@/src/libsouffle.la | ||
|
||
# Cleanup | ||
CLEANFILES = $(souffle_jar) $(BUILT_SOURCES) | ||
|
||
clean-local: | ||
rm -rf $(builddir)/com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import scala.collection.JavaConversions._ | ||
import scala.collection.mutable.ArrayBuffer | ||
import com.soufflelang.souffle._ | ||
|
||
object Main { | ||
System.loadLibrary("soufflejni"); | ||
|
||
def main(args: Array[String]): Unit = { | ||
// Create Solver | ||
val souffle = new Solver(); | ||
|
||
// Create Program | ||
val p = new Program(); | ||
p.getExample1(p); | ||
|
||
val data = new Data(); | ||
data.addRelationTuple("edge", ArrayBuffer("A", "B")) | ||
data.addRelationTuple("edge", ArrayBuffer("B", "C")) | ||
data.addRelationTuple("edge", ArrayBuffer("C", "D")) | ||
data.addRelationTuple("edge", ArrayBuffer("D", "E")) | ||
data.addRelationTuple("edge", ArrayBuffer("E", "F")) | ||
data.addRelationTuple("edge", ArrayBuffer("F", "Z")) | ||
|
||
// Parse | ||
val e = souffle.parse(p); | ||
|
||
// Execute | ||
val r = e.executeCompiler(data, "scalaEx"); | ||
|
||
data.release(); | ||
|
||
// Read Data | ||
val vals = r.getRelationRows("path").toSeq; | ||
|
||
println("==============PATH==================="); | ||
for(rec <- vals) { | ||
for(v <- rec) { | ||
print(v + "\t") | ||
} | ||
println("\n") | ||
} | ||
|
||
r.release(); | ||
souffle.release(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* | ||
* Souffle - A Datalog Compiler | ||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved | ||
* Licensed under the Universal Permissive License v 1.0 as shown at: | ||
* - https://opensource.org/licenses/UPL | ||
* - <souffle root>/licenses/SOUFFLE-UPL.txt | ||
*/ | ||
|
||
/************************************************************************ | ||
* | ||
* @file ParserDriver.h | ||
* | ||
* Defines the parser driver. | ||
* | ||
***********************************************************************/ | ||
#pragma once | ||
|
||
#include <memory> | ||
#include <config.h> | ||
#include <stdlib.h> | ||
#include <stdio.h> | ||
#include <assert.h> | ||
#include <unistd.h> | ||
#include <stdarg.h> | ||
#include <string> | ||
#include <stack> | ||
#include <unistd.h> | ||
|
||
#include "Util.h" | ||
#include "AstProgram.h" | ||
#include "AstClause.h" | ||
#include "AstComponent.h" | ||
#include "AstRelation.h" | ||
#include "AstArgument.h" | ||
#include "AstTranslationUnit.h" | ||
#include "AstNode.h" | ||
#include "BinaryOperator.h" | ||
#include "AstParserUtils.h" | ||
|
||
#include "Logger.h" | ||
|
||
namespace souffle { | ||
|
||
class AstTranslationUnit; | ||
class ErrorReport; | ||
class AstRelation; | ||
class AstType; | ||
class AstProgram; | ||
class SymbolTable; | ||
|
||
|
||
class AstBuilder { | ||
public: | ||
AstBuilder(); | ||
virtual ~AstBuilder(); | ||
|
||
AstTranslationUnit* translationUnit; | ||
|
||
bool trace_scanning; | ||
|
||
AstRelation* getRelation(std::string name); | ||
|
||
void addRelation(AstRelation *r); | ||
void addType(AstType *t); | ||
void addClause(AstClause *c); | ||
void addComponent(AstComponent *c); | ||
void addInstantiation(AstComponentInit *ci); | ||
std::string print(); | ||
void compose(AstBuilder* other); | ||
|
||
AstTranslationUnit* getTranslationUnit() { | ||
return translationUnit; | ||
} | ||
|
||
AstProgram* getProgram() { return translationUnit->getProgram(); } | ||
|
||
bool trace_parsing; | ||
|
||
souffle::SymbolTable &getSymbolTable(); | ||
|
||
void error(const std::string &msg); | ||
}; | ||
|
||
} // end of namespace souffle | ||
|
Oops, something went wrong.