scalacenter / student-projects

The list of the available projects at the Scala Center for bachelor and master students.
8 stars 0 forks source link

Scala.js REPL #1

Closed adpi2 closed 1 year ago

adpi2 commented 2 years ago

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.

repl

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.

adpi2 commented 2 years ago

Taken by https://github.com/641bill

mbovel commented 2 years ago

So is this project taken? Could we add a taken label like in the Dotty repo so that we can filter the list of projects?

sjrd commented 2 years ago

It is taken, yes. I added a label.