From e35561f417260c3ec375f554f9c3ed2910feb610 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BE=AA?= Date: Fri, 25 Oct 2024 17:23:32 +1300 Subject: [PATCH] no, annotation processor are bad --- build.sbt | 10 +++++----- .../main/resources/META-INF/truffle/language.old | 0 .../src/main/scala/chester/truffle/index.scala | 16 ++++++++++++++++ .../jvm/src/main/scala/effekt/Test.scala | 0 interpreter/references.md | 3 +++ 5 files changed, 24 insertions(+), 5 deletions(-) rename eval/jvm/src/main/resources/META-INF/truffle/language => interpreter/jvm/src/main/resources/META-INF/truffle/language.old (100%) create mode 100644 interpreter/jvm/src/main/scala/chester/truffle/index.scala rename {eval => interpreter}/jvm/src/main/scala/effekt/Test.scala (100%) create mode 100644 interpreter/references.md diff --git a/build.sbt b/build.sbt index 4e6f0c1c..843c8f42 100644 --- a/build.sbt +++ b/build.sbt @@ -1201,16 +1201,16 @@ lazy val buildTool = crossProject(JVMPlatform) ) ) -lazy val eval = crossProject(JSPlatform, JVMPlatform, NativePlatform) +lazy val interpreter = crossProject(JSPlatform, JVMPlatform, NativePlatform) .withoutSuffixFor(JVMPlatform) .crossType(CrossType.Full) - .in(file("eval")) + .in(file("interpreter")) .dependsOn(platform) .settings(commonSettings) // https://github.com/b-studios/scala-graal-truffle-example/blob/c2747a6eece156f878c5b934116aaa00a2cd6311/build.sbt .settings( - name := "eval", - assembly / assemblyOutputPath := file("target") / "chester-eval.jar" + name := "interpreter", + assembly / assemblyOutputPath := file("target") / "chester-interpreter.jar" ) .jvmSettings( assembly / test := {}, @@ -1282,7 +1282,7 @@ lazy val root = crossProject(JSPlatform, JVMPlatform, NativePlatform) lsp, buildProtocol, buildTool, - eval, + interpreter, js, site, docs diff --git a/eval/jvm/src/main/resources/META-INF/truffle/language b/interpreter/jvm/src/main/resources/META-INF/truffle/language.old similarity index 100% rename from eval/jvm/src/main/resources/META-INF/truffle/language rename to interpreter/jvm/src/main/resources/META-INF/truffle/language.old diff --git a/interpreter/jvm/src/main/scala/chester/truffle/index.scala b/interpreter/jvm/src/main/scala/chester/truffle/index.scala new file mode 100644 index 00000000..157c0014 --- /dev/null +++ b/interpreter/jvm/src/main/scala/chester/truffle/index.scala @@ -0,0 +1,16 @@ +package chester.truffle + +import com.oracle.truffle.api.{CallTarget, TruffleLanguage} +import com.oracle.truffle.api.TruffleLanguage.{Env, ParsingRequest} + +trait ChesterContext + +@TruffleLanguage.Registration(id = "cst", name = "Chester") +class ChesterLang extends TruffleLanguage[ChesterContext] { + @throws[Exception] + override protected def parse(request: ParsingRequest): CallTarget = { + ??? + } + + override protected def createContext(env: Env): ChesterContext = null +} \ No newline at end of file diff --git a/eval/jvm/src/main/scala/effekt/Test.scala b/interpreter/jvm/src/main/scala/effekt/Test.scala similarity index 100% rename from eval/jvm/src/main/scala/effekt/Test.scala rename to interpreter/jvm/src/main/scala/effekt/Test.scala diff --git a/interpreter/references.md b/interpreter/references.md new file mode 100644 index 00000000..153856a7 --- /dev/null +++ b/interpreter/references.md @@ -0,0 +1,3 @@ +https://github.com/skinny85/graalvm-truffle-tutorial/blob/master/part-15/src/main/java/com/endoflineblog/truffle/part_15/EasyScriptTruffleLanguage.java + +https://www.endoflineblog.com/graal-truffle-tutorial-part-0-what-is-truffle \ No newline at end of file