mirror of
https://github.com/kanaka/mal.git
synced 2024-09-11 13:55:55 +03:00
[java-truffle] step 0
This commit is contained in:
parent
6a6e2cf3bc
commit
1f58e1123a
@ -36,7 +36,7 @@ wasm_MODE = wasmtime
|
||||
|
||||
IMPLS = ada ada.2 awk bash basic bbc-basic c c.2 chuck clojure coffee common-lisp cpp crystal cs d dart \
|
||||
elisp elixir elm erlang es6 factor fantom fennel forth fsharp go groovy gnu-smalltalk \
|
||||
guile haskell haxe hy io janet java js jq julia kotlin livescript logo lua make mal \
|
||||
guile haskell haxe hy io janet java java-truffle js jq julia kotlin livescript logo lua make mal \
|
||||
matlab miniMAL nasm nim objc objpascal ocaml perl perl6 php picolisp pike plpgsql \
|
||||
plsql powershell prolog ps python python.2 r racket rexx rpython ruby rust scala scheme skew sml \
|
||||
swift swift3 swift4 swift5 tcl ts vala vb vhdl vimscript wasm wren yorick xslt zig
|
||||
@ -64,6 +64,7 @@ dist_EXCLUDES += guile io julia matlab swift
|
||||
bbc-basic_TEST_OPTS = --test-timeout 60
|
||||
guile_TEST_OPTS = --test-timeout 120
|
||||
io_TEST_OPTS = --test-timeout 120
|
||||
java-truffle_TEST_OPTS = --start-timeout 30
|
||||
logo_TEST_OPTS = --start-timeout 60 --test-timeout 120
|
||||
mal_TEST_OPTS = --start-timeout 60 --test-timeout 120
|
||||
miniMAL_TEST_OPTS = --start-timeout 60 --test-timeout 120
|
||||
@ -140,6 +141,7 @@ hy_STEP_TO_PROG = impls/hy/$($(1)).hy
|
||||
io_STEP_TO_PROG = impls/io/$($(1)).io
|
||||
janet_STEP_TO_PROG = impls/janet/$($(1)).janet
|
||||
java_STEP_TO_PROG = impls/java/target/classes/mal/$($(1)).class
|
||||
java-truffle_STEP_TO_PROG = impls/java-truffle/build/classes/java/main/truffle/mal/$($(1)).class
|
||||
js_STEP_TO_PROG = impls/js/$($(1)).js
|
||||
jq_STEP_PROG = impls/jq/$($(1)).jq
|
||||
julia_STEP_TO_PROG = impls/julia/$($(1)).jl
|
||||
|
10
impls/java-truffle/.gitignore
vendored
Normal file
10
impls/java-truffle/.gitignore
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
.classpath
|
||||
.project
|
||||
.settings
|
||||
target
|
||||
/.gradle/
|
||||
/build/
|
||||
.factorypath
|
||||
.apt_generated
|
||||
bin
|
||||
graal_dumps
|
12
impls/java-truffle/Dockerfile
Normal file
12
impls/java-truffle/Dockerfile
Normal file
@ -0,0 +1,12 @@
|
||||
FROM ghcr.io/graalvm/graalvm-ce:21.1.0
|
||||
|
||||
RUN microdnf install python3 unzip && \
|
||||
ln -sf /usr/bin/python3 /usr/bin/python && \
|
||||
curl -o gradle.zip "https://downloads.gradle-dn.com/distributions/gradle-7.0.2-bin.zip" && \
|
||||
mkdir /opt/gradle && \
|
||||
unzip -d /opt/gradle gradle.zip
|
||||
|
||||
RUN mkdir -p /mal
|
||||
WORKDIR /mal
|
||||
ENV GRADLE_USER_HOME=/tmp/.gradle
|
||||
ENV PATH="$PATH:/opt/gradle/gradle-7.0.2/bin"
|
8
impls/java-truffle/Makefile
Normal file
8
impls/java-truffle/Makefile
Normal file
@ -0,0 +1,8 @@
|
||||
all:
|
||||
gradle build
|
||||
|
||||
build/classes/java/main/truffle/mal/step%.class: src/main/java/truffle/mal/*.java
|
||||
gradle build
|
||||
|
||||
clean:
|
||||
gradle clean
|
28
impls/java-truffle/build.gradle
Normal file
28
impls/java-truffle/build.gradle
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* This file was generated by the Gradle 'init' task.
|
||||
*/
|
||||
|
||||
plugins {
|
||||
id 'java'
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
maven {
|
||||
url = uri('https://repo.maven.apache.org/maven2')
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'org.graalvm.truffle:truffle-api:20.1.0'
|
||||
implementation 'org.organicdesign:Paguro:3.2.0'
|
||||
annotationProcessor 'org.graalvm.truffle:truffle-dsl-processor:20.1.0'
|
||||
}
|
||||
|
||||
group = 'com.github.mmcgill'
|
||||
version = '0.0.1'
|
||||
sourceCompatibility = '11'
|
||||
|
||||
task printClasspath {
|
||||
println sourceSets.main.runtimeClasspath.getAsPath()
|
||||
}
|
20
impls/java-truffle/run
Executable file
20
impls/java-truffle/run
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
CP=$(gradle -q --console plain printClasspath)
|
||||
|
||||
# -Dgraal.LogVerbose=true \
|
||||
# -Dgraal.TraceTruffleStackTraceLimit=100 \
|
||||
# -Dgraal.TruffleCompilationThreshold=100 \
|
||||
# -Dgraal.TraceTruffleCompilationDetails=true \
|
||||
# -Dgraal.Dump=Truffle:2 \
|
||||
# -Dgraal.TraceTruffleCompilation=true \
|
||||
# -Dgraal.TruffleFunctionInlining=true \
|
||||
# -Dgraal.TruffleCompilationExceptionsArePrinted=true \
|
||||
java \
|
||||
-Dgraalvm.locatorDisabled=true \
|
||||
-Xss8m \
|
||||
--add-opens org.graalvm.truffle/com.oracle.truffle.api=ALL-UNNAMED \
|
||||
--add-opens org.graalvm.truffle/com.oracle.truffle.api.interop=ALL-UNNAMED \
|
||||
--add-opens org.graalvm.truffle/com.oracle.truffle.api.nodes=ALL-UNNAMED \
|
||||
-classpath $CP \
|
||||
truffle.mal.${STEP:-stepA_mal} "$@"
|
5
impls/java-truffle/settings.gradle
Normal file
5
impls/java-truffle/settings.gradle
Normal file
@ -0,0 +1,5 @@
|
||||
/*
|
||||
* This file was generated by the Gradle 'init' task.
|
||||
*/
|
||||
|
||||
rootProject.name = 'truffle-mal'
|
33
impls/java-truffle/src/main/java/truffle/mal/step0_repl.java
Normal file
33
impls/java-truffle/src/main/java/truffle/mal/step0_repl.java
Normal file
@ -0,0 +1,33 @@
|
||||
package truffle.mal;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
public class step0_repl {
|
||||
private static String READ(String s) {
|
||||
return s;
|
||||
}
|
||||
|
||||
private static void PRINT(String s) {
|
||||
System.out.println(s);
|
||||
}
|
||||
|
||||
private static void rep(String s) {
|
||||
PRINT(READ(s));
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
boolean done = false;
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
|
||||
while (!done) {
|
||||
System.out.print("user> ");
|
||||
String s = reader.readLine();
|
||||
if (s == null) {
|
||||
done = true;
|
||||
} else {
|
||||
rep(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user