diff --git a/language/pom.xml b/language/pom.xml
index c7ae315..1bb0598 100644
--- a/language/pom.xml
+++ b/language/pom.xml
@@ -20,11 +20,24 @@
test
+
+ org.graalvm.polyglot
+ js-community
+ pom
+ test
+
+
org.graalvm.truffle
truffle-api
+
+ org.graalvm.truffle
+ truffle-runtime
+ runtime
+
+
org.graalvm.truffle
truffle-dsl-processor
diff --git a/language/src/main/java/com/github/arvyy/islisp/ISLISPContext.java b/language/src/main/java/com/github/arvyy/islisp/ISLISPContext.java
index 2cdfe79..a5861ab 100644
--- a/language/src/main/java/com/github/arvyy/islisp/ISLISPContext.java
+++ b/language/src/main/java/com/github/arvyy/islisp/ISLISPContext.java
@@ -136,6 +136,7 @@ void initGlobalFunctions() {
initGlobalFunction("error-output", ISLISPErrorOutputStream::makeLispFunction);
initGlobalFunction("eq", ISLISPEq::makeLispFunction);
initGlobalFunction("equal", ISLISPEqual::makeLispFunction);
+ initGlobalFunction("eval", ISLISPEval::makeLispFunction);
initGlobalFunction("format", ISLISPFormat::makeLispFunction);
initGlobalFunction("format-char", ISLISPFormatChar::makeLispFunction);
initGlobalFunction("format-integer", ISLISPFormatInteger::makeLispFunction);
@@ -167,6 +168,7 @@ void initGlobalFunctions() {
//extension
initGlobalFunction("current-stacktrace", ISLISPCurrentStacktrace::makeLispFunction);
initGlobalFunction("exit", ISLISPExit::makeLispFunction);
+ initGlobalFunction("truffle-object-fields", ISLISPTruffleObjectFields::makeLispFunction);
}
private void initInitializeObjectMethod() {
@@ -269,6 +271,9 @@ void initBuiltinClasses() {
initBuiltin("", "");
initBuiltin("", "
+
+
+
+ org.graalvm.polyglot
+ js-community
+ pom
+
+
org.graalvm.polyglot
tools
diff --git a/launcher/src/main/java/com/github/arvyy/islisp/launcher/Main.java b/launcher/src/main/java/com/github/arvyy/islisp/launcher/Main.java
index af77d18..90e7dcc 100644
--- a/launcher/src/main/java/com/github/arvyy/islisp/launcher/Main.java
+++ b/launcher/src/main/java/com/github/arvyy/islisp/launcher/Main.java
@@ -2,7 +2,9 @@
import org.apache.commons.cli.*;
import org.graalvm.polyglot.Context;
+import org.graalvm.polyglot.PolyglotAccess;
import org.graalvm.polyglot.Source;
+import org.graalvm.polyglot.io.IOAccess;
import java.io.*;
@@ -42,7 +44,10 @@ public static void main(String[] args) throws IOException, ParseException {
var contextBuilder = Context.newBuilder()
.in(System.in)
.out(System.out)
- .err(System.err);
+ .err(System.err)
+ .allowIO(IOAccess.ALL)
+ .allowNativeAccess(true)
+ .allowPolyglotAccess(PolyglotAccess.ALL);
if (commandLine.hasOption(chromeDebuggerOpt)) {
if (chromeDebuggerOpt.hasArg()) {
diff --git a/pom.xml b/pom.xml
index d3069ea..0f6bbd3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,6 +29,16 @@
truffle-api
${graalvm.version}
+
+ org.graalvm.truffle
+ truffle-runtime
+ ${graalvm.version}
+
+
+ org.graalvm.truffle
+ truffle-nfi-libffi
+ ${graalvm.version}
+
org.graalvm.polyglot
polyglot
@@ -45,6 +55,13 @@
${graalvm.version}
pom
+
+
+ org.graalvm.polyglot
+ js-community
+ ${graalvm.version}
+ pom
+
diff --git a/tests2/evalinterop.expect.txt b/tests2/evalinterop.expect.txt
new file mode 100644
index 0000000..42ce418
--- /dev/null
+++ b/tests2/evalinterop.expect.txt
@@ -0,0 +1 @@
+evalinterop.lisp end
\ No newline at end of file
diff --git a/tests2/evalinterop.lisp b/tests2/evalinterop.lisp
new file mode 100644
index 0000000..f59f48c
--- /dev/null
+++ b/tests2/evalinterop.lisp
@@ -0,0 +1,20 @@
+(defmacro test-equal (expr value)
+ (let ((actual (gensym)))
+ `(let ((,actual ,expr))
+ (if (not (equal ,actual ,value))
+ (progn
+ (format-object (standard-output) ',expr t)
+ (format-char (standard-output) #\newline)
+ (format-object (standard-output) "Expect: " t)
+ (format-object (standard-output) ,value nil)
+ (format-char (standard-output) #\newline)
+ (format-object (standard-output) "Actual: " t)
+ (format-object (standard-output) ,actual nil)
+ (format-char (standard-output) #\newline)
+ (format-object (standard-output) "-------" nil)
+ (format-char (standard-output) #\newline))))))
+
+(let ((fun (eval "js" "(function(arg) { return 1 + arg; })")))
+ (test-equal (funcall fun 2) 3))
+
+(format (standard-output) "evalinterop.lisp end")