Narcissus is a JavaScript interpreter written in pure JavaScript (i.e., a meta-circular evaluator), using the SpiderMonkey engine.
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 and either 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