Scala.js is an extension of the Scala compiler that can compile Scala code into JavaScript code.
The Scala.js project also contains a Scala.js implementation of the JDK, the Java standard library.
But some pieces are missing in the Scala.js implementation either because they depend on the JavaScript runtime, for instance the representation of a file, or because they are inherently specific to Java, for instance the java.lang.ClassLoader.
For those reasons it is not yet possible to run the Scala compiler in a JavaScript environment.
The goal of this project is to create a limited version of the Scala compiler that can run on a JavaScript environment.
The main motivation is to compile, and then execute, Scala code in a web browser.
Supervisors
Adrien Piquerez(adrien.piquerez@epfl.ch): Tooling Engineer at the Scala Center
Sébastien Doeraene(sebastien.doeraene@epfl.ch): Principal Engineer at the Scala Center and author of Scala.js
Milestones
M1 - Compiling dotty.tools.dotc.Main to JavaScript
Link the dotty.tools.dotc.Main class of the Scala 3 compiler in lampepfl/dotty into a JavaScript executable file.
All linkage errors must be solved by one of the possible solutions:
Providing a missing implementation, for example we need an implementation for java.io.File
Re-implementing in a Scala.js compatible way
Throwing an incompatible error, some features won't be easy to implement in Scala.js, for example the macros.
It should be able to produce the SJSIR files of a simple Hello World program.
M2 - Running the scalajs-compiler-tests in JavaScript
The scalajs-compiler-tests project should run in a JavaScript environment. The failing tests should be fixed or they should be ignored for an explicit reason. For example we can ignore the tests that depend on macros.
M3 - Explore and draft a solution for macro resolution
The expansion of macros use class-loading and reflection. This is not possible in JavaScript so we need to find an alternative solution.
Prerequisites
Some significant experience in programming in Scala
Some knowledge about compilers and their architectures
Nice to have: knowledge about the JavaScript language
Expected outcome
For a Master semester project, we expect the student to complete milestone M1 and to progress significantly on milestone M2. For a Master's project, all 3 milestones should be completed.
The final state of the code and the report should make it easy for another student to take up the project if need be.
Description
Scala.js is an extension of the Scala compiler that can compile Scala code into JavaScript code. The Scala.js project also contains a Scala.js implementation of the JDK, the Java standard library. But some pieces are missing in the Scala.js implementation either because they depend on the JavaScript runtime, for instance the representation of a file, or because they are inherently specific to Java, for instance the
java.lang.ClassLoader
.For those reasons it is not yet possible to run the Scala compiler in a JavaScript environment. The goal of this project is to create a limited version of the Scala compiler that can run on a JavaScript environment.
The main motivation is to compile, and then execute, Scala code in a web browser.
Supervisors
Adrien Piquerez(adrien.piquerez@epfl.ch): Tooling Engineer at the Scala Center Sébastien Doeraene(sebastien.doeraene@epfl.ch): Principal Engineer at the Scala Center and author of Scala.js
Milestones
M1 - Compiling
dotty.tools.dotc.Main
to JavaScriptLink the
dotty.tools.dotc.Main
class of the Scala 3 compiler in lampepfl/dotty into a JavaScript executable file.All linkage errors must be solved by one of the possible solutions:
java.io.File
It should be able to produce the SJSIR files of a simple Hello World program.
M2 - Running the
scalajs-compiler-tests
in JavaScriptThe
scalajs-compiler-tests
project should run in a JavaScript environment. The failing tests should be fixed or they should be ignored for an explicit reason. For example we can ignore the tests that depend on macros.M3 - Explore and draft a solution for macro resolution
The expansion of macros use class-loading and reflection. This is not possible in JavaScript so we need to find an alternative solution.
Prerequisites
Expected outcome
For a Master semester project, we expect the student to complete milestone M1 and to progress significantly on milestone M2. For a Master's project, all 3 milestones should be completed.
The final state of the code and the report should make it easy for another student to take up the project if need be.