The Scala REPL, also known as the scala command, is an interactive shell that takes Scala expressions as input, compiles them into JVM byte code, executes them and returns the results to the user.
Scala.js is an extension of the Scala compiler that can compile Scala code into SJSIR (Scala.js Intermediate Representation) and link SJSIR files into JavaScript code.
The goal of the project is to extend the Scala REPL with a JavaScript runtime (e.g. Node.js). The REPL will use the Scala.js compiler and linker to produce JavaScript code. The REPL engine itself will run in the JVM but the execution of expressions will happen on a JavaScript runtime.
For the Scala and Scala.js users, the Scala.js REPL would be directly useful to:
Test and debug a Scala.js application or library
Interact with JavaScript libraries in a Scala REPL
Moreover, the Scala.js REPL is a step towards more advanced tools such as:
A Scala REPL running in the browser
A Scala.js evaluator for the debugger
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
1. An intermediate REPL, using the SJSIR interpreter
Adapt the Scala 3 REPL in lampepfl/dotty to use the Scala.js compiler on the JVM and an SJSIR interpreter in a JavaScript process.
This intermediate Scala.js REPL can be tested against the existing tests of the REPL.
2. An interactive linker
The role of the linker is to transform a set of SJSIR files into a single JavaScript file.
To build the Scala.js REPL, we need to adapt the linker in scala-js/scala-js so that it can link a series of expressions incrementally.
It must emit only the classes and methods that are reachable by the latest expression and it must remember which ones were already emitted, not to emit them again.
This is the most challenging part of the project.
3. A Scala.js REPL
Once we have an interactive linker we can use it in the REPL to replace the SJSIR interpreter.
The user should be able to configure the REPL with a JavaScript runtime from this list and some JavaScript libraries.
Prerequisites
Some significant experience in programming in Scala
A good knowledge of the JavaScript language is preferable
Expected outcome
This project is a difficult one and it contains some level of uncertainty that could prevent the student from completing it.
For a semester Master semester project, we expect the student to complete milestone 1 and we also expect some progress on the interactive linker. For a Master's project all 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
The Scala REPL, also known as the
scala
command, is an interactive shell that takes Scala expressions as input, compiles them into JVM byte code, executes them and returns the results to the user.Scala.js is an extension of the Scala compiler that can compile Scala code into SJSIR (Scala.js Intermediate Representation) and link SJSIR files into JavaScript code.
The goal of the project is to extend the Scala REPL with a JavaScript runtime (e.g. Node.js). The REPL will use the Scala.js compiler and linker to produce JavaScript code. The REPL engine itself will run in the JVM but the execution of expressions will happen on a JavaScript runtime.
For the Scala and Scala.js users, the Scala.js REPL would be directly useful to:
Moreover, the Scala.js REPL is a step towards more advanced tools such as:
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
1. An intermediate REPL, using the SJSIR interpreter
Adapt the Scala 3 REPL in lampepfl/dotty to use the Scala.js compiler on the JVM and an SJSIR interpreter in a JavaScript process. This intermediate Scala.js REPL can be tested against the existing tests of the REPL.
2. An interactive linker
The role of the linker is to transform a set of SJSIR files into a single JavaScript file.
To build the Scala.js REPL, we need to adapt the linker in scala-js/scala-js so that it can link a series of expressions incrementally. It must emit only the classes and methods that are reachable by the latest expression and it must remember which ones were already emitted, not to emit them again.
This is the most challenging part of the project.
3. A Scala.js REPL
Once we have an interactive linker we can use it in the REPL to replace the SJSIR interpreter. The user should be able to configure the REPL with a JavaScript runtime from this list and some JavaScript libraries.
Prerequisites
Expected outcome
This project is a difficult one and it contains some level of uncertainty that could prevent the student from completing it.
For a semester Master semester project, we expect the student to complete milestone 1 and we also expect some progress on the interactive linker. For a Master's project all 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.