Wren
A small, fast, class-based concurrent scripting language that packs Smalltalk-style objects and lightweight fibers into an embeddable virtual machine of under 4,000 semicolons.
Created by Bob Nystrom
Wren is a small, fast, class-based concurrent scripting language designed to be embedded in larger applications. Its own tagline captures the pitch precisely: “Think Smalltalk in a Lua-sized package with a dash of Erlang and wrapped up in a familiar, modern syntax.” Created by Bob Nystrom — the language engineer best known for the books Game Programming Patterns and Crafting Interpreters — Wren asks a pointed question: what would an embeddable scripting language look like if it were designed today, with classes at its core, coroutines built in, and an implementation small enough to read in an afternoon?
History & Origins
Bob Nystrom made the Wren repository public on GitHub in November 2013, while working professionally on programming languages (he was a member of the Dart team at Google). Wren was a personal project with an unusually explicit design brief: be genuinely small like Lua, but object-oriented like Smalltalk, with lightweight concurrency reminiscent of Erlang’s processes — all beneath a curly-brace syntax that would feel immediately familiar to anyone coming from JavaScript, Java, or C#.
The implementation was as much the point as the language. Wren’s virtual machine is written in standards-compliant C (C99 and later), has no external dependencies, and famously totals under 4,000 semicolons — a deliberately whimsical metric for a codebase intended to be read, not just used. The source is heavily commented and organized so that a curious programmer can skim the entire VM in a sitting, and it became a reference point for people learning how real bytecode interpreters work.
In November 2018, Nystrom announced that he was stepping back from maintainership. As the project grew, he wrote, he found himself “in the weird position of finding it socially stressful to work on,” and concluded that “the best thing I can do for Wren is to get myself off the critical path so I’m not holding it back.” He handed the project to Sven Bergström — creator of the Luxe game engine, which had adopted Wren for scripting — and the repository moved to a new wren-lang organization on GitHub. Nystrom retained commit access and continued to participate.
Under community stewardship, the project shipped its first tagged releases: 0.2.0 in October 2019, 0.3.0 in June 2020, and 0.4.0 in April 2021, which remains the current stable version. Around this time the command-line interpreter was separated into its own wren-cli project — the wren-cli repository was created in September 2019, and the move was completed with the 0.3.0 release — keeping the core repository focused on the embeddable VM.
Design Philosophy
Wren’s design is best understood as a set of deliberate contrasts with Lua, the incumbent king of embeddable scripting:
- Classes, not prototypes or tables. Where Lua builds objects out of tables and metatables and JavaScript (historically) out of prototypes, Wren places classes front and center. Everything is an object, every object has a class — including numbers and booleans — and the object model is closer in spirit to Smalltalk than to C++.
- Fibers, not threads. Lightweight coroutines called fibers are core to the execution model, not a bolted-on library. A fiber costs little memory, and programs can be organized as, in the documentation’s words, “an army of communicating coroutines.” Fibers are cooperative — they yield control explicitly — which keeps the model simple and deterministic.
- Familiar syntax. Nystrom judged that syntactic novelty is a tax on adoption. Wren uses curly braces,
//comments, string interpolation with%(...), and method-call notation that reads naturally to mainstream programmers. - Smallness as a feature. A minimal standard library, no dependencies, and a compact C API make the VM easy to audit, easy to embed, and easy to keep out of your application’s way.
A taste of the language, adapted from the official homepage:
System.print("Hello, world!")
class Wren {
flyTo(city) {
System.print("Flying to %(city)")
}
}
var adjectives = Fiber.new {
["small", "clean", "fast"].each {|word| Fiber.yield(word) }
}
while (!adjectives.isDone) System.print(adjectives.call())
The snippet shows all three pillars at once: class definitions with methods, string interpolation, and a fiber used as a generator that yields values back to its caller.
Key Features
- Everything is an object. Numbers, booleans, ranges, functions, and fibers are all instances of classes, and operators are method calls that classes can define —
+,[], and comparison operators included. - Fiber-based concurrency.
Fiber.new,Fiber.yield, andfiber.call()provide coroutines that can be used for generators, cooperative multitasking, and error isolation (a runtime error aborts only the fiber it occurs in, and can be inspected by the caller). - Single-pass compiler to compact bytecode. Wren compiles source directly to bytecode in one pass with no separate parse tree, one of the design choices behind its speed and small footprint.
- C embedding API. The host application controls memory allocation, module resolution, and which foreign functions are exposed. Foreign classes let scripts hold handles to native data, and slots-based marshalling keeps the API boundary explicit.
- Modules with explicit imports. Code is organized into modules loaded via
import, with the embedder able to intercept and customize module loading — important for games that ship scripts in archives or generate them at runtime. - Raw strings and modern conveniences. Version 0.4.0 added raw strings via triple quotes and the
continuekeyword, alongside string, list, and number library improvements.
Performance
Wren’s homepage describes it as fast among interpreted dynamic languages, and — unusually — documents exactly how that claim was measured. The project’s own benchmark page reports four microbenchmarks (method call, DeltaBlue, binary trees, and recursive Fibonacci) run on a 2.3 GHz Intel Core i7 MacBook Pro with 16 GB of RAM, comparing Wren against Lua 5.2.3, LuaJIT 2.0.2, Python 2.7.5, Python 3.3.4, and Ruby 2.0.0. Each benchmark was run ten times with the best time kept, excluding interpreter startup.
In those tests, Wren was consistently among the fastest of the pure interpreters — competitive with LuaJIT running in interpreter-only mode and ahead of Lua, Python, and Ruby on the measured workloads. The page is equally frank about the caveats: LuaJIT with the JIT enabled “is much faster than all of the other languages benchmarked, including Wren, because Mike Pall is a robot from the future,” and, in the project’s own words, “most benchmarks aren’t worth the pixels they’re printed on.” The honest framing is itself characteristic of the project. The speed comes from architecture rather than heroics: a single-pass compiler, dense bytecode, compact value representation, and careful attention to cache behavior.
Evolution
Wren’s version history is short by design — the language reached a shape its creator considered essentially complete fairly early, and subsequent releases have refined rather than reinvented:
| Version | Date | Highlights |
|---|---|---|
| Initial public code | November 2013 | Class-based VM, fibers, embedding API |
| 0.2.0 | October 2019 | First tagged release under wren-lang; relative imports; string, number, and fiber refinements |
| 0.3.0 | June 2020 | Cross-platform build fixes; CLI moved fully into the separate wren-cli project |
| 0.4.0 | April 2021 | continue keyword, raw strings, userData in the allocator callback, WrenLoadModuleResult for module loading |
The most consequential evolution was organizational rather than technical: the 2018 transition from a single creator to community maintainership, which the project navigated gracefully at a time when single-maintainer burnout was ending many similar projects.
Current Relevance
Wren occupies a comfortable niche rather than chasing mainstream adoption. Its natural home is game development and application scripting — exactly the territory Lua has dominated for decades — and its notable adopters reflect that: the Luxe engine uses Wren as its gameplay scripting language, and the DOME framework wraps SDL2 and the Wren VM into a batteries-included environment for writing 2D games entirely in Wren. Exercism runs a mentored Wren track, and the separate wren-cli project serves those who want Wren as a standalone scripting tool.
The project remains active at a deliberate pace: the repository has seen commits into late 2025 and holds roughly 8,000 GitHub stars, and periodic discussions in the systems and game-development communities continue to evaluate it as a modern alternative to Lua. There has been no stable release since 0.4.0 in 2021, which is fairly described both ways — as slow-moving, and as finished in the way a small, focused tool can be finished.
Why It Matters
Wren matters for two distinct reasons. As a language, it is one of the strongest existence proofs that “embeddable” does not have to mean “minimal to the point of austerity”: you can have real classes, real coroutines, and a familiar syntax in a VM the size of Lua’s. Projects choosing a scripting layer today routinely shortlist Wren precisely because it delivers object orientation without the table-and-metatable ceremony.
As an artifact, Wren’s influence arguably exceeds its deployment. Its readable, exhaustively commented VM became study material for a generation of interpreter writers, and the bytecode virtual machine that Nystrom teaches in Crafting Interpreters — one of the most widely read programming-language books of its era — draws directly on the experience of building Wren. Many people who have never shipped a line of Wren have absorbed its implementation ideas secondhand. For a hobby-scale language with a sub-4,000-semicolon VM, that is a remarkable footprint.
Timeline
Notable Uses & Legacy
Luxe game engine
The cross-platform Luxe engine by Sven Bergström uses Wren as its primary gameplay scripting language, with an official Wren primer in the engine documentation.
DOME
A lightweight, cross-platform 2D game framework written in C that embeds the Wren VM on top of SDL2, letting developers write complete games purely in Wren.
Exercism
The Exercism programming-education platform offers a dedicated Wren track, with mentored exercises that use the language's small surface area as a teaching advantage.
wren-cli
The official standalone command-line interpreter maintained alongside the language, which layers file, network, and scheduler modules over the core VM so Wren can be used for general scripting outside a host application.