Neko
A lightweight, dynamically typed scripting language and embeddable virtual machine designed to serve as a common runtime target for many higher-level languages, most notably Haxe.
Created by Nicolas Cannasse
Neko is a high-level, dynamically typed scripting language paired with a small, fast, embeddable virtual machine called NekoVM. Created by Nicolas Cannasse, Neko was conceived less as a language for end users to write applications in directly and more as a common runtime — a clean, compact target that authors of other languages could compile down to. That design goal makes Neko unusual: its most important user is not a human programmer but another compiler. Its best-known “client,” and the project that grew out of it, is the cross-platform language Haxe, also created by Cannasse.
History & Origins
Neko was born out of research and development at Motion Twin, an independent video-game studio in Bordeaux, France. Cannasse released NekoVM 1.0 on August 17, 2005, under the GPL. The project was relicensed to the LGPL with version 1.1 in November 2005, and ultimately to the permissive MIT License with version 2.0 in 2013.
The motivation was practical. Building web and game backends meant juggling several languages and runtimes, each with its own quirks, memory model, and library bindings. Cannasse wanted a single lightweight runtime that was simple enough to understand fully, fast enough to be useful, and easy to embed into a host application or generate code for. Neko was the answer: a minimal core language with just a handful of value types, a small bytecode instruction set, and a clean C foreign-function interface.
Neko’s influence on Cannasse’s later work was direct. By February 2006, the first beta of Haxe was emitting NekoVM bytecode, making Neko Haxe’s original execution target. As Haxe grew into a multi-target toolkit (JavaScript, C++, the JVM, and more), Neko remained one of its supported outputs, particularly convenient for command-line tools and server-side code. Development of NekoVM later continued at Shiro Games, the studio Cannasse co-founded, and the project is maintained today under the Haxe Foundation.
Design Philosophy
Neko’s design is organized around a single overarching aim, stated plainly in its documentation: to offer “the best tradeoff between simplicity, extensibility and speed” as a runtime for many languages.
- A runtime, not just a language. Neko is meant to be a compilation target. Rather than writing programs in Neko by hand, language authors write a generator that emits Neko source or bytecode, then reuse Neko’s VM, garbage collector, and library bindings instead of building their own.
- Minimal core. The language has a small set of value types and a compact instruction set. The compiler that turns
.nekosource into.nbytecode is itself written in Neko and is small and fast. - Embeddability. The VM is deliberately tiny so it can be dropped into a host application. The Neko distribution notes the VM binary is only around 68 KB on Linux and 40 KB on Windows, while still offering good execution speed.
- Dynamic and flexible. Neko is dynamically typed with no fixed classes; objects are built from prototypes and fields, so a language targeting Neko can map its own (possibly statically typed) object model onto Neko’s flexible runtime structures.
Key Features
Compiler and bytecode
Neko separates compilation from execution. The compiler converts a source .neko file into a .n bytecode file, which the virtual machine then runs:
| |
A small “hello world” looks like this:
$print("Hello, World!\n");
Built-in primitives are accessed with a $ prefix (such as $print), while library functions are loaded dynamically.
Dynamic values and prototype objects
Neko’s value space is small: null, integers, floats, booleans, strings, arrays, objects, and functions. Objects are bags of fields rather than instances of rigid classes, which makes them a convenient backing store for the object systems of higher-level languages compiling to Neko.
var o = $new(null);
o.name = "Neko";
o.greet = function() {
$print("Hi from " + this.name + "\n");
};
o.greet();
Garbage collection
Neko manages memory automatically using the Boehm GC, described in the project’s FAQ as “a conservative multithreaded mark and sweep collector.” This frees both Neko programmers and the authors of languages targeting Neko from manual memory management.
Just-in-time compilation
Beginning with Neko 1.4 (August 2006), the VM gained a fast x86 JIT compiler, which translates bytecode to native machine code for faster execution on supported x86 hardware. Where the JIT is unavailable, the VM falls back to executing bytecode directly.
Web integration
Neko ships with mod_neko, an Apache module that embeds the VM into the web server so Neko bytecode can generate web pages, and mod_tora, an application-server layer aimed at higher-throughput deployments.
NekoML
The distribution also includes NekoML, a separate ML-family language (in the tradition of OCaml) with algebraic data types and pattern matching, which itself compiles to Neko bytecode — an early demonstration of Neko’s role as a shared runtime for more than one language.
Performance
Neko aims for a good balance rather than raw peak throughput, and its own documentation is candid about the trade-offs. The FAQ notes that compared with Lua, Neko is “faster for data structures manipulation, but slower for floating-point arithmetics,” and that because its bytecode maps onto a relatively concrete instruction set, “Neko is perhaps less suitable to optimizations than these abstract processors.” These are the maintainers’ own qualitative comparisons rather than formal published benchmarks, so they are best read as guidance about where Neko’s strengths lie — lightweight embedding and data-structure-heavy scripting — rather than precise performance figures.
Platform Support
According to the project’s FAQ, “Neko is known to run on Windows x86, Linux, BSD, OSX, and Linux AMD64 architectures.” The fast JIT is specific to x86; on other architectures the VM runs bytecode without JIT acceleration. Recent releases have continued to address portability, including build fixes for BSD-based systems in version 2.4.1.
Current Relevance
Neko occupies a niche but durable place in the programming-language landscape. It is not a language most developers reach for to write applications directly; its enduring importance is as the foundational runtime behind Haxe and as a clean, studied example of how to build a small embeddable VM with garbage collection and a JIT. The project remains under active maintenance through the Haxe Foundation, with releases continuing into the 2020s — 2.4.0 in July 2024 and 2.4.1 in April 2025 — long after many contemporaries have gone dormant.
Why It Matters
Neko is a case study in deliberate minimalism. By refusing to be everything to everyone — and instead targeting the narrow but valuable role of a common runtime for compiler authors — it stayed small, fast, and comprehensible. That decision paid off most visibly through Haxe, which used Neko as its launch pad before spreading to a dozen other targets. For anyone interested in how higher-level languages are actually implemented, Neko offers a refreshingly readable model: a tiny core, dynamic values, automatic memory management, an optional JIT, and a foreign-function interface that lets a new language reuse a mature runtime instead of reinventing one.
Timeline
Notable Uses & Legacy
Haxe Toolkit
Neko was the original runtime and compilation target for Haxe, a cross-platform language also created by Nicolas Cannasse. Haxe compiles to NekoVM bytecode, which is still offered as one of its output targets for server-side and command-line programs.
Motion Twin
Neko and NekoVM originated as in-house R&D at Motion Twin, the independent Bordeaux game studio (later known for Dead Cells), where it served as a scripting and server-side runtime for the studio's web games.
Shiro Games
Development of NekoVM continued at Shiro Games, the studio Cannasse co-founded, where the broader Neko/Haxe technology stack underpins game tooling and infrastructure.
mod_neko and mod_tora web applications
The mod_neko Apache module embeds the VM directly into a web server so Neko bytecode can generate web pages, with mod_tora providing an application-server front end for higher-throughput deployments.