Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/doodlewind/mocha1995
☕️ The world's first JavaScript engine written in 1995 by Brendan Eich, now compiled back to JS and WASM!
https://github.com/doodlewind/mocha1995
javascript js js-engine netscape retro wasm
Last synced: 16 days ago
JSON representation
☕️ The world's first JavaScript engine written in 1995 by Brendan Eich, now compiled back to JS and WASM!
- Host: GitHub
- URL: https://github.com/doodlewind/mocha1995
- Owner: doodlewind
- Created: 2020-11-29T01:03:01.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-09-24T12:56:11.000Z (about 3 years ago)
- Last Synced: 2024-10-11T22:48:18.462Z (about 1 month ago)
- Topics: javascript, js, js-engine, netscape, retro, wasm
- Language: C
- Homepage: https://mocha1995.js.org
- Size: 604 KB
- Stars: 306
- Watchers: 9
- Forks: 25
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Mocha 1995
The original Mocha JavaScript engine, ported from Netscape 3.0.2 browser.![mocha-wasm](./blog/mocha-wasm.png)
## 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:* [WASM Version](https://mocha1995.js.org)
* [JavaScript Version](https://mocha1995.js.org#js)## Build
For WASM and JS build, please make sure [Emscripten](https://emscripten.org/docs/getting_started/downloads.html) is installed and activated (`emcc` command is available):``` sh
$ 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:
``` sh
$ out/mo_shell tests/ack.mocha
```## Debugging
The `CMakeLists.txt` is added for single-step debugging on Linux with CLion.``` sh
$ cd out
$ cmake -H"../" -B"./" -DCMAKE_BUILD_TYPE=MinSizeRel
$ make
```## Resources
* [Compiling World's First JavaScript Engine Back to JavaScript](./blog/about.md)
* [Netscape 3.0.2 Source Tree](https://archive.org/details/netscape-communicator-3-0-2-source)
* [JavaScript: The First 20 Years](https://doi.org/10.1145/3386327)
* [JavaScript 二十年](https://cn.history.js.org/)## 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!