Scala Days 2026

Blazing-Fast Lambda Calculus via Metaprogramming

Interpreting lambda calculus is simple but slow. Using multi-stage metaprogramming, we built a JIT that compiles each program to native JVM code at load time, running 2–10x faster than existing interpreters – including heavily optimized Rust and Haskell implementations. The surprising part: staging resulted in remarkably little code.


Many systems ship small programs in a tiny language based on lambda calculus – functions, function calls, a handful of built-in operations, and constants – and run them with an interpreter.
We replaced the interpreter with a JIT that translates each program into native JVM code as it loads: a lambda becomes a JVM lambda, an application becomes a real function call, and built-ins and constants map onto efficient runtime primitives.
What I find most compelling is how little code it took: multi-stage metaprogramming let us turn an interpreter into a compiler with surprisingly little code, which says a lot about how powerful the technique is.
I'll walk through the staging approach, the benchmark results against existing interpreters, and the subtle pitfalls of JIT-compiling an untyped language while preserving exact evaluation semantics – a practical tour of runtime code generation and metaprogramming on the JVM.

Alex Nemish

Alexander Nemish is the CTO and founder of Lantr, blockchain solutions and R&D labs, where he leads development of Scalus, an open-source platform for building Cardano smart contracts and decentralized applications in Scala 3.
He is a software engineer specializing in functional programming, type theory, metaprogramming, compilers, and blockchain systems, working primarily in Scala, Haskell, and Rust. Previously, he was an engineer at IOG (Input Output Global), where he contributed to the design and implementation of Marlowe, a domain-specific language for financial smart contracts on Cardano, and earlier he built server-side platforms in the banking sector.
He is a long-time member of the Scala community and a past speaker at ScalaUA.