Happy to release a first version of Scivolo, a Scala Interpreter written in Rust. Unfortunately nothing was working at Scala Days, so it comes a week later.

Right now it interprets ~1140 of ~1710 of dotty's tests/run programs and passes 99% of Scala Native's precompiled NIR tests.

Performance is fine:

$ cat HelloWorld.scala
object HelloWorld {
  def hello(): Int = {
    42
  }
}

@main
def main(): Unit = {
  println(s"Hello World ${HelloWorld.hello()}")
}

$ time ./target/release/scivolo HelloWorld.scala  
Hello World 42
0,01s user 0,02s system 34% cpu 0,095 total
$ time ./target/release/scivolo HelloWorld.scala
Hello World 42
0,01s user 0,00s system 91% cpu 0,011 total

It also has an experimental AOT-Compilation path using Cranelift:

$ time ./target/release/scivolo-aot HelloWorld.scala -o HelloWorld
1,20s user 0,16s system 163% cpu 0,828 total
$ time ./HelloWorld # Slower, because OSX checks new binaries 
Hello World 42
0,00s user 0,01s system 3% cpu 0,245 total
$ time ./HelloWorld
Hello World 42
0,00s user 0,00s system 74% cpu 0,010 total
$ ls -lsah ./HelloWorld
9120 -rwxr-xr-x  1 nos  staff   4,4M 20 Okt 19:48 ./HelloWorld

The interpreter is using the NIR-Format (Version 0.5.x) of Scala-Native, because it is JVM independent and has an established, small C-Runtime. The AOT-Compiler compiles the NIR-Format using Cranelift into native executables. It is also reusing Scala Native's Standard library and calling coursier for dependency downloading.

There are no OS-Threads yet (only some green threads), and also some advanced features do not work yet. I got only one Macro to run (Circe's Object-Codec derivation). Only small snippets are exercised. The GC is the same as Scala Native (Immix).

Performance wise, there are some neat tricks: The whole Standard-library is mmaped into Memory, already search optimized. So there is basically no initialization overhead.

Disclaimer: The code is mostly unreviewed AI port of the Scala sources. It strives to generate Byte-Exact NIR-Code like the existing Scala Native Compiler. Use it for amusement.

Why? It all started with a small AI dialogue about why I can't have have fast (deployment) scripts in a typesafe language. Now I have.

Discuss with us on Reddit