diff --git a/build.sbt b/build.sbt index b1abb251..65953e20 100644 --- a/build.sbt +++ b/build.sbt @@ -1251,7 +1251,7 @@ lazy val interpreter = crossProject(JSPlatform, JVMPlatform, NativePlatform) .withoutSuffixFor(JVMPlatform) .crossType(CrossType.Full) .in(file("interpreter")) - .dependsOn(eval, parser) + .dependsOn(eval, parser, tyck) .settings(commonSettings) // https://github.com/b-studios/scala-graal-truffle-example/blob/c2747a6eece156f878c5b934116aaa00a2cd6311/build.sbt .settings( diff --git a/interpreter/jvm/src/main/scala/chester/truffle/Utils.scala b/interpreter/jvm/src/main/scala/chester/truffle/Utils.scala index ee8ba6e8..e3a90a8f 100644 --- a/interpreter/jvm/src/main/scala/chester/truffle/Utils.scala +++ b/interpreter/jvm/src/main/scala/chester/truffle/Utils.scala @@ -2,11 +2,17 @@ package chester.truffle import com.oracle.truffle.api.{CallTarget, TruffleLanguage} import chester.parser.* +import chester.tyck.* object Utils { @throws[Exception] def parse(request: TruffleLanguage.ParsingRequest): CallTarget = { - val parsed = Parser.parseExpr(FileNameAndContent(request.getSource.getPath, request.getSource.getCharacters.toString)) - ??? + Parser.parseTopLevel(FileNameAndContent(request.getSource.getPath, request.getSource.getCharacters.toString)) match { + case Left(err) => ??? + case Right(result) => Tycker.check(parsedBlock) match { + case TyckResult.Success(result, _, _) => ??? + case TyckResult.Failure(errors, _, _, _) => ??? + } + } } }