Implementing the relevant standards of JavaScript fully would be prohibitively expensive for a hobby project. Feel free to review the complexity of existing small independent solutions as an alternative.
Elk: a tiny JS engine for embedded systems. Does not use malloc. Operates with a given memory buffer only. Small footprint: about 20KB on flash/disk, about 100 bytes RAM for core VM. No bytecode. Interprets JS code directly. Elk is completely bare, it does not even have a standard library.
CL-JavaScript allows you to add user scripting to your Common Lisp application without requiring your poor users to learn Common Lisp. It is a JavaScript to Common Lisp translator, runtime, and standard library. We are ECMAScript 3 compatible, with some of the ECMAScript 5 extensions.
By using the Lisp compiler to compile JavaScript (and by using some clever tricks for the things that Lisp normally isn't good at), this implementation manages to be faster than most of the 2009 generation of JavaScript engines. The new generation (V8, Jägermonkey) beats it by, depending on the benchmark, a factor 4 or so.
Embeddable, portable, compact: can run on platforms with 160kB flash and 64kB RAM
ECMAScript E5/E5.1, with some semantics updated from ES2015+
Partial support for ECMAScript 2015 (E6) and ECMAScript 2016 (E7)
ES2015 TypedArray and Node.js Buffer bindings
Includes a web based example interpreter.
Espruino is a JavaScript interpreter for microcontrollers. It is designed for devices with as little as 128kB Flash and 8kB RAM.
includes all the benefits from the GraalVM stack including interoperability with Java.
Hermes is a JavaScript engine optimized for fast start-up of React Native apps. It features ahead-of-time static optimization and compact bytecode.
JerryScript is a lightweight JavaScript engine for resource-constrained devices such as microcontrollers. It can run on devices with less than 64 KB of RAM and less than 200 KB of flash memory.
Full ECMAScript 5.1 standard compliance
Heavily optimized for low memory consumption
Snapshot support for precompiling JavaScript source code to byte code
Kinoma's XS6 library implements a JavaScript virtual machine optimized for devices with limited resources. This virtual machine conforms to the 6th edition of the ECMAScript specification (ECMAScript 2015).
The Kinoma Porting Layer (KPL) is the bottom of the KinomaJS stack. It is a very light portability layer, modeled, as much as practical, on POSIX. Because KinomaJS runs on a wide variety of operating systems, the goal is to isolate all direct calls to the host operating in KPL. Some RTOS hosts do not support the full ANSI C library, so it cannot even be safely assumed that functions like printf are available. To avoid surprises with the size of types, a portable-type system modeled on that used by QuickTime is used.
Microvium is a tiny JavaScript engine (less than 16kB compiled size) for microcontrollers for running a small but useful subset of the JavaScript language. The runtime engine is portable C code and easy to integrate. Microvium takes the unique approach partially running the JS code at build time and deploying a snapshot, which leads to a number of advantages over other embedded JavaScript engines.
MuJS is a lightweight Javascript interpreter designed for embedding in other software to extend them with scripting capabilities.
MuJS was designed with a focus on small size, correctness, and simplicity. It is written in portable C and implements ECMAScript as specified by ECMA-262. The interface for binding with native code is designed to be as simple as possible to use, and is very similar to Lua.
It was originally developed for use with the MuPDF viewer
Package otto is a JavaScript parser and interpreter written natively in Go.
Otto targets ES5
Go translates JavaScript-style regular expressions into something that is "regexp" compatible via parser.TransformRegExp. Unfortunately, RegExp requires backtracking for some patterns, and backtracking is not supported by the standard Go engine. re2 (Go) has a different definition for \s: [\t\n\f\r ]
Package natto is an example/offshoot of otto that implements an event loop (supporting setTimeout/setInterval).
QuickJS is a small and embeddable Javascript engine. It supports the ES2020 specification including modules, asynchronous generators, proxies and BigInt.
It supports mathematical extensions such as big decimal float float numbers (BigDecimal), big binary floating point numbers (BigFloat), and operator overloading.
Small and easily embeddable: just a few C files, no external dependency, 210 KiB of x86 code for a simple "hello world" program.
Fast interpreter with very low startup time
Garbage collection using reference counting (to reduce memory usage and have deterministic behavior) with cycle removal.
Small built-in standard library with C library wrappers.
Friendly QuickJS fork focused on reigniting the project.
JavaScript-like language with optional templating
The ucode language is a small, general-purpose scripting language that resembles ECMAScript syntax. It can be used as a standalone interpreter or embedded into host applications. Ucode supports template mode with control flow and expression logic statements embedded in Jinja-like markup blocks.
The development of ucode was motivated by the need to rewrite the OpenWrt firewall framework using nftables. Initially intended as a template processor, ucode evolved into a versatile scripting language for various system scripting tasks. Its design goals include easy integration with C applications, efficient handling of JSON data and complex data structures, support for OpenWrt's ubus message bus system, and a comprehensive set of built-in functions inspired by Perl 5.
A sandboxed JavaScript interpreter in JavaScript. Execute arbitrary ES5 JavaScript code line by line in isolation and safety.
Both invasived and sandbox modes available. Based on parser Acorn.
Boa is an embeddable and experimental Javascript engine written in Rust. Currently, it has support for some of the language.
It's probably not as fast as compilers that produce native code, but because it hooks into Guile's compiler at a high level, as Guile's compiler improves and eventually gets native code compilation, it will be plenty fast.
An ahead of time compiler and runtime for ES6. Things only build reliably on OSX. You'll need a couple of external dependencies to get things running: node.js, llvm 3.6, coffeescript
Complete ECMAScript Fifth Edition Implemention in Object Pascal
mJS is designed for microcontrollers with limited resources. Main design goals are: small footprint and simple C/C++ interoperability. mJS implements a strict subset of ES6 (JavaScript version 6).
On 32-bit ARM mJS engine takes about 50k of flash memory, and less than 1k of RAM. mJS is part of MongooseOS
V7 is the smallest JavaScript engine written in C.
Cross-platform: works on anything, starting from Arduino to MS Windows
Small size. Compiled static size is in 40k - 120k range, RAM footprint on initialization is about 800 bytes with freeze feature, 15k without freeze feature
Standard: V7 implements JavaScript 5.1
Usable out-of-the-box: V7 provides an auxiliary library with Hardware (SPI, UART, etc), File, Crypto, Network API
part of the full stack Mongoose OS Platform
ECMAScript Lexer / Parser / Interpreter / VM / method JIT written in C++
Ejacs is basically a toy. It is regrettably insufficient in several important dimensions
provides types to increase maintainability, has builtin support for web and database, A Jsi function may have parameters with types and default values
This project aims to be an extremely simple (~2000 line) JavaScript interpreter, meant for inclusion in applications that require a simple, familiar script language that can be included with no dependencies other than normal C++ libraries. It currently consists of two source files: one containing the interpreter, another containing built-in functions such as String.substring.
TinyJS is not designed to be fast or full-featured. However it is great for scripting simple behaviour, or loading & saving settings.
I make absolutely no guarantees that this is compliant to JavaScript/EcmaScript standard. In fact I am sure it isn't. However I welcome suggestions for changes that will bring it closer to compliance without overly complicating the code, or useful test cases to add to the test suite.
TinyJS uses a Recursive Descent Parser, so there is no 'Parser Generator' required. It does not compile to an intermediate code, and instead executes directly from source code. This makes it quite fast for code that is executed infrequently, and slow for loops.
Variables, Arrays and Objects are stored in a simple linked list tree structure (42tiny-js uses a C++ Map). This is simple, but relatively slow for large structures or arrays.
This a toy programming language, utterly useless. I'm using it to experiment parser, compiler and interpreter designs
keywords: function (only supports named function), while, for, if, else, return, let, null, undefined, continue, break
operators: + - * / ** %, > < >= <= ==, ! && ||, ++foo foo++ --foo foo--
separators: ; for expressions, ( ) for sub-expressions, { }
literals: booleans, float/integers, strings
A Simplified JavaScript Compiler and Virtual Machine
Narcissus is a JavaScript interpreter written in pure JavaScript (i.e., a meta-circular evaluator), using the SpiderMonkey engine.
Originally a proof-of-concept, a test-bed for rapidly prototyping new language features for the JavaScript language (as well as the ECMAScript standard).
HTML rich text support by desktop widget toolkits
FOSS web browsers by engine