-
Notifications
You must be signed in to change notification settings - Fork 0
Migrating Flix Compiler to Scala 3
Jakob Schneider edited this page Apr 6, 2023
·
5 revisions
I think the correct way to do this is to build everything via Gradle.
- https://docs.scala-lang.org/scala3/guides/migration/tooling-migration-mode.html
- https://docs.scala-lang.org/scala3/guides/migration/incompatibility-table.html
- https://docs.gradle.org/current/dsl/org.gradle.language.scala.tasks.BaseScalaCompileOptions.html
- https://docs.gradle.org/current/dsl/org.gradle.api.tasks.scala.ScalaCompile.html
- https://docs.gradle.org/current/dsl/org.gradle.api.tasks.scala.ScalaCompile.html#org.gradle.api.tasks.scala.ScalaCompile:scalaCompileOptions
- https://docs.gradle.org/current/userguide/scala_plugin.html
- https://docs.scala-lang.org/scala3/guides/macros/reflection.html
- https://mvnrepository.com/artifact/org.scala-lang/scala3-library_3/3.2.2
- https://mvnrepository.com/artifact/org.scala-lang/scala3-compiler_3/3.2.2
- https://mvnrepository.com/artifact/org.scala-lang/scala-reflect
- https://docs.scala-lang.org/scala3/guides/migration/tutorial-macro-cross-building.html
- https://docs.scala-lang.org/scala3/guides/migration/incompat-dropped-features.html
- https://github.com/scala/scala-parser-combinators
- https://github.com/sirthias/parboiled
- https://mvnrepository.com/artifact/org.parboiled/parboiled_3
Running
scalac -Xsource:3 -sourcepath main/src/ -classpath lib/ main/src/ca/uwaterloo/flix/Main.scala
yields errors as it does not know where to find the online dependencies (from Maven central).
Maybe this can be fixed by adding the -Xsource:3 flag to the compiler in build.gradle or downloading the dependencies / jars manually
from Maven and including it in the lib/ directory.
When this works, the code has to be written to have zero incompatibilities, after which we should invoke the Scala 3 compiler (possibly also with some more library flags etc.):
scalac -rewrite -source:3.0-migration main/src/ca/uwaterloo/flix/Main.scala
Maybe this last part can also be invoked from Gradle.
What do we do with Scala reflect and the parser library that uses macros? Maybe replace with scala-parser-combinators