Mocha 1995
The original Mocha JavaScript engine, ported from Netscape 3.0.2 browser.
History
"Mocha" was the code name of the first JavaScript engine, originally written by Brendan Eich in his 10-day May 1995 sprint. For all of 1995 and most of 1996, Eich was the the only Netscape developer working full-time on the JavaScript engine. Untill August 1996, the Mocha codebase still consisted primarily of code from the 10-day prototype.
In late 1996, Eich "stayed home for two weeks to rewrite Mocha as the codebase that became known as SpiderMonkey", the JavaScript engine later released as open-source and currently maintained by the Mozilla Foundation.
Here is the source code of production version of Mocha, which ships as JavaScript 1.1. This version is released in August 1996 with Netscape 3.0. The release of JavaScript 1.1 marks the completion of the initial definition and development of JavaScript.
Live Playground
Besides native binary, the ported Mocha engine can also be compiled to WASM and JavaScript:
Build
For WASM and JS build, please make sure Emscripten is installed and activated (emcc
command is available):
$ source build.sh
# build native
$ compile_native
# build WASM
$ compile_wasm
# build js
$ compile_js
The Web build generates out/mocha_shell_js.html
and out/mocha_shell_wasm.html
as entries. For the native build, there is a binary runtime available:
$ out/mo_shell tests/ack.mocha
Debugging
The CMakeLists.txt
is added for single-step debugging on Linux with CLion.
$ cd out
$ cmake -H"../" -B"./" -DCMAKE_BUILD_TYPE=MinSizeRel
$ make
Resources
- Compiling World's First JavaScript Engine Back to JavaScript
- Netscape 3.0.2 Source Tree
- JavaScript: The First 20 Years
- JavaScript 二十年
License
License status of original Netscape source code is unknown yet. This port is intended for historic preservation and educational usage. Don't use in commerial projects!