48 karma · joined April 17, 2018
No Python. No JNI. No native code. Just Java.
It’s (mostly) a single Java file implementing the full stack:
GGUF parsing, tokenization, Gemma 4 transformer inference, quantizations, CLI...
Built using the Java Vector API, with support for GraalVM Native Image.
I'm still in awe at how smooth the Truffle "unchaining" worked out with no API changes (just a few necessary additions).
How long does take to implement a programming language? Well, from hours to years... depending on the language. To make my point; how long would it take to implement a JVM? A JVM is a complex beast, so I would myself guess from years to a decade probably, what if I told you, that Espresso was written in just 6 months by an intern and a seasoned engineer... in just 6 months it was able to Minecraft and even run itself. I assure you there's no magic here, and certainly no blinding talent either; the only reason for this unheard productivity was Graal/Truffle. So, whenever I talk about Espresso I always give all credit to Graal/Truffle, it is a sublime platform for implementing fast languages and runtimes, of which Espresso is just a byproduct.
- (Polyglot) scripting with Java
- Augmenting native images e.g. native javac with instant startup + annotation processors (very dynamic) running on Espresso
- A simple non-invasive JVM for constrained environments
- DCEVM-like features for developers
- Approachable academic playground
- Fast prototyping of JVM features e.g. it took our intern just two weeks to implement invokedynamic/MethodHandles
Currently Graal/Truffle implements the first Futamura projection: you give it an interpreter written in Java, it automatically generates a compiler (JIT). In this mode we have to keep the interpreter IR graphs (blueprints) around for partial evaluation.
With the first Futamura projection: Partial evaluator + interpreter + user code.
There's active work on implementing the second Futamura projection, where you partial evaluate the partial evaluator with respect to the interpreter, generating a specialized partial evaluator for that interpreter. With the second Futamura projection: (Specialized partial evaluator + interpreter) + user code.
This is truly fascinating and beautiful and the fact that it works for Java and not just a toy academic prototype is mind-blowing.