September 21, 2021

Enumerating and analyzing 40+ non-V8 JavaScript implementations

V8 is, I'm sure, the most used implementation of JavaScript today. Used in Chrome, (and by extension) Microsoft Edge, Node.js, etc. Safari's JavaScriptCore and Firefox's SpiderMonkey are also contenders for extremely mainstream implementations.

But what else is out there? What if I want to embed JavaScript in a C program, or a Go program, or a Rust program, or a Java program(, and so on)? Or what if I want to run JavaScript on a microcontroller? Or use it as a base for language research? It turns out there are many high-quality implementations out there.

This post describes a number of them and their implementation choices. I'm not going to cover V8, JavaScriptCore, or SpiderMonkey because they are massive and hide multiple various interpreters and compilers inside. Plus, you already know about them.

I'm going to miss some implementations and get some details wrong. Please Tweet or email me with your corrections! I'd be particularly interested to hear about pure-research; and commercial, closed-source implementations of JavaScript.

Corporate-backed

These are implementations that would make sense to look into for your own commercial, production applications.

On the JVM

  • Oracle's GraalJS: compiles JavaScript to JVM bytecode or GraalVM
    • Support: Full compatibility with latest ECMAScript specification
    • Implementation language: Java
    • Runtime: GraalVM or stock JDK
    • Parser: Hand-written
    • First release: 2019?
    • Notes: Replaced Nashorn as the default JavaScript implementation in JDK.
  • Mozilla's Rhino: interprets and compiles JavaScript to JVM bytecode
  • Oracle's Nashorn: compiles JavaScript to JVM bytecode
    • Support: ES5
    • Implementation language: Java
    • Runtime: compiles to JVM bytecode
    • Parser: Hand-written
    • First release: 2012?
    • Notes: Replaced Rhino as default JavaScript implementation on JVM. Replaced by GraalJS more recently, but remains actively developed.

Embeddable

  • Nginx's njs
  • ChowJS: proprietary AOT compiler based on QuickJS for game developers
    • Support: everything QuickJS does presumably (see further down for QuickJS)
    • Implementation language: C presumably
    • Runtime: QuickJS's bytecode interpreter but also an AOT compiler
    • Parser: QuickJS's presumably
    • First release: 2021
    • Notes: Code is not available so exact analysis on these points is not possible at the moment.
  • Artifex's mujs

Embedded Systems

Other

I don't know whether to put Microsoft's ChakraCore into this list or the next. So I'll put it here but note that as of this year 2021, they are transitioning it to become a community-driven project.

Mature, community-driven

Implementations toward the top are more reliable and proven. Implementations toward the bottom less so.

If you are a looking to get involved in language development, the implementation further down on the list can be a great place to start since they typically need work in documentation, testing, and language features.

These last few are not toys but they are also more experimental or, in AssemblyScript's case, not JavaScript.

Research Implementations

Thanks to @smarr for contributing eJS, Higgs, and b9!

Notable Abandoned

Notable toy implementations

Great for inspiriration if you've never implemented a language before.

  • js-to-c: A JavaScript to C compiler, written in C
  • mjs: AST interpreter for not just ES5 or even ES3 but also ES1
  • gojis: AST interpreter in Go
  • tojs: Bytecode VM in Rust
  • v2: Bytecode VM in Go
  • SparrowJS: AST interpreter in C++
  • jsc: My own experiment compiling JavaScript to C++/libV8