Narcissus is a JavaScript interpreter written in pure JavaScript (i.e., a meta-circular evaluator), using the SpiderMonkey engine.
This verson of Narcissus adds various experimental features that have been proposed for ES Harmony. See harmony.md
for a list of new features.
Originally a proof-of-concept by Brendan Eich, Narcissus is being revived as a test-bed for rapidly prototyping new language features for the JavaScript language (as well as the ECMAScript standard).
To run the Narcissus shell, install the SpiderMonkey shell (note that pre-built versions of the shell are available in the Firefox nightly builds,
for example http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-trunk/jsshell-win32.zip or http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-trunk/jsshell-mac.zip). After building or downloading set the NJS_SHELL
environment variable to the path to the js
executable, or creating a symbolic link to js
in the top-level Narcissus directory. Then run Narcissus with the njs
script.
Usage: njs
Options:
-h, --help show this help message and exit
-f FILE, --file=FILE JS file to load
-e JS_EXPS, --expression=JS_EXPS
JS expression to evaluate
-i, --interactive enable interactive shell
-H, --harmony enable ECMAScript Harmony mode
-S, --ssa enable parse-time SSA construction
The front end of Narcissus, consisting of a lexer and parser (js{defs,lex,parse}.js
), is written in portable ECMAScript Edition 3 code. The back end, consisting of the interpreter (js{ssa,exec}.js
), is written using JavaScript extensions currently supported only by SpiderMonkey.
More to come.
- Tom Austin
- Brendan Eich
- Andreas Gal
- Shu-yu Guo
- Dave Herman
- Dimitris Vardoulakis
- Patrick Walton
- Allen Wirfs-Brock