teq

A native Scala 3 compiler, written in Rust

Scala 3, compiled in milliseconds.

Teq interprets or compiles Scala 3 to JVM or JavaScript.
Including unmodified libraries from the ecosystem.

Pre-release · 0.1.9Check compatibility

No JVM at compile time

One native binary. Library macros run in the compiler’s own interpreter.

Your Scala libraries

Use unmodified published libraries, with conformance checked against scalac.

First-class JavaScript

ES modules, granular recompilation with feedback in milliseconds, and lean compiled bundles.

Compilation speed

Wall-clock time of a full build on an Apple M4 Max.

Hello world

A two-line Scala @main program

100–300× faster

Realistic Frontend

Synthetic · 64k lines · JavaScript target

41–49× faster

Realistic API

Synthetic · 51k lines · JVM target

160–180× faster

The realistic benchmark is a 104k-line synthetic application generated to the shape of a production Scala.js code base.

Benchmark methodology

Ways to use teq

As the compiler of an sbt build

sbt's own compile, test, run and packageBin run over teq's output, with sbt's own reporting, and nothing else in the build changes.

Add the plugin to an sbt 2 or sbt 1 build (the same line under both; the sbt 1 module comes with the plugin’s first release after 1.0.0):

project/plugins.sbt
addSbtPlugin("build.teq" % "sbt-teq" % "1.0.1")

Enable scalac replacement:

build.sbt
teqVersion := "0.1.9"
teqCompiler := true

The plugin comes from Maven Central; it fetches teq for your platform from teq’s GitHub release, checked against the release’s checksums before it runs. Enable it per project, or use TEQ_COMPILER=1 to switch without editing the build.

sbt integration guide

As a native build tool

Compile, test and run without sbt or Mill running. One lockfile describes the build; the launcher fetches the pinned compiler.

Add the sbt plugin and set teqBuildTool:

build.sbt
teqBuildTool := true

Then run sbt teqExportAll and commit the generated teq.lock, teq and teq.cmd files.

A Mill 1.x build exports the same lockfile through mill-teq, with no edit of the build ("buildTool": true in a teq.mill.json at its root writes it there with the launchers):

mill --import mvn:build.teq::mill-teq::0.1.0 dev.teq.mill.Teq/teqExportAll

Drive your project without a JVM:

./teq compile api
./teq test
./teq run api -- web

Teq keeps a daemon compiler running so subsequent builds are even faster. The Vite plugin uses the same lockfile for hot swapping in the browser.

Native build tool guide

In the editor

Use teq as you write Scala, with navigation, completion and diagnostics powered by the compiler.

  • Definitions and references
  • Hovers and completion
  • Call hierarchy
  • Diagnostics after each edit

Open your project in Zed.

Install the teq extension and disable Zed’s other Scala extension. Open your project folder: the server reads teq.lock, or exports the sbt build on first use, and fetches the pinned compiler. Without teqBuildTool that export lands in target/teq/teq.lock, adding nothing to the repository, and runs again after an sbt clean.

Or connect another editor.

Configure its language-server client to start this command in the project folder, communicating over stdin and stdout.

teq lsp
Editor setup guide

As an interpreter

Run Scala directly, with no output file and no JVM, using the same interpreter that runs library macros.

hello.scala
@main def hello(): Unit =
  println("hello from teq")
teq interp hello.scala

Download teq, rename the file to teq (teq.exe on Windows), make it executable and put it on your PATH. A browser download on macOS carries the quarantine attribute, which Gatekeeper enforces on a binary that is not notarized: xattr -d com.apple.quarantine teq clears it, and a download by curl never carries it.

Command-line reference

Pre-release, actively tested

Review the remaining gaps and intentional differences before adopting teq.

Compatibility and limitations

Developed against a production Scala.js application. Conformance tests use scalac 3.8.4 as the reference, including the Scala compiler’s own suites.

Verified to work with:

  • cats
  • zio
  • tapir
  • monocle
  • refined

and more

About the project

Written with AI

The code, tests and documentation are written with AI agents. Humans direct the work and own the design decisions.

Models and validation process

Implementation uses Claude Fable 5.1 and Claude Opus 5.5, with GPT 6 Astra reviewers. Each package lands with test expectations generated against scalac, a full gate run, and its compile-time cost measured and recorded. Read the code with that in mind.

Open source

Build it yourself

Build from source and run the same suites used to check language conformance, output, runtime speed and compilation budgets.

Build and test commands
cargo build --release
./tests/all.sh
./bench/pgo.sh
./bench/budget.sh

all.sh runs every suite. pgo.sh produces a profile-guided release build at target/pgo/use/release/teq; budget.sh checks its compile times against bench/budgets.txt.

The suites compare output with scalac, use scala-cli to regenerate expectations, and run the Scala 3 compiler tests from $SCALA3.