JavaScript in JavaScript
JavaScript Python Shell
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
build
codegen
lib
original
patched
selenium-old
testdata
tests
README
d8.sh
package.json

README

narcissus on Narwhal
--------------------

Here is the original Narcissus: http://mxr.mozilla.org/mozilla/source/js/narcissus/

This is a port to Narwhal: http://narwhaljs.org

To develop:

1) Make your changes to patched/*.js, which is a modified copy of the code in
original/*.js
2) Run build/makelib.py to make lib/narcissus.js
3) var narcissus = require('narcissus');

STATUS (as of 12/26/09)
-----------------------

Enhancements over the original Narcissus:

- Packaged as a CommonJS module (into a single JavaScript file by
  build/makelib.py)

- Defines a toJSON() method on Node instances, so the parse tree can be output
  as JSON
  - The bin/narcissus tool can be used to output a JSON parse tree
  - See codegen/*.json for examples, which are parse trees of the stuff in
    testdata/*.js
  - The JSON parse tree has been consumed (experimentally) by JSON Template (see
    codegen/) 

- Uses ES5 Object.defineProperty rather than Mozilla's __defineProperty__
  (halfway working in Narwhal, without writable/configurable/etc.)

- Engine compatibility
  - Fixed Mozilla-specific extensions ('catch if') so it works in narwhal-v8 in
    addition to narwhal-rhino
  - Fixed some subtle bugs related to using __proto__ in v8.  Prior to this,
    Narcissus couldn't parse itself in v8.

- Tests
  - Has some JavaScript tests based on Narwhal/CommonJS
  - There is a in-progress test in tests/narcissus_test.py, which borrows the
    approach of pynarcissus and runs over v8's JS test suites.  (See
    http://code.google.com/p/pynarcissus/)

Known issues
------------

- The meta-interpreter runs really basic code correctly, but some things appear
  broken (see narcissus-test.js).  Right now I care mostly about the parser.

- Under narwhal-rhino, tests/narcissus-test/testParseRealCode takes about 30
  seconds.  On narwhal-v8, it's more or less instant.  Could be a narwhal-rhino
  bug.

Details:
- Can parse JSON Template but not execute it
- Cannot parse or execute jsexec.js


Docs are not complete, so if you want to use this, feel free to mail me at
andy@chubot.org.