Narcissus/Development

< Narcissus
Revision as of 16:07, 9 August 2010 by Dherman (talk | contribs) (more on host-JS feature requirements)

Terminology

Since JavaScript is both the language of the implementation and the language being implemented, it's helpful to distinguish the two levels conceptually:

  • host ("host code," "host JS," etc): JS code in the implementation of Narcissus
  • user ("user code," "user JS," etc): JS code being interpreted by Narcissus

Narcissus modules

Narcissus is divided into four "modules" (using the module pattern):

  • jsdefs: basic definitions shared by the other modules
  • jslex: lexer
  • jsparse: parser
  • jsexec: interpreter

The jsexec module is optional; that is, it's possible to use just the first three modules as a JavaScript parser written in portable JavaScript.

Host language versions

These are the host language versions required by each module:

  • jsdefs: ES3 + const + Object.defineProperty
  • jslex: ES3 + const + Object.defineProperty
  • jsparse: ES3 + const + Object.defineProperty
  • jsexec: SpiderMonkey JS 1.9:
    • const (Harmony)
    • catch guards (replaceable with catch + if)
    • let declarations (Harmony)
    • Proxy (Harmony)
    • Object.defineProperty (ES5)
    • Object.getOwnPropertyDescriptor (ES5)
    • Object.getPrototypeOf (ES5)
    • Object.getOwnPropertyNames (ES5)
    • __proto__ = null (replaceable with Harmony maps)

The first three modules are web-portable. Only the jsexec module depends on SpiderMonkey extensions.

User language versions

The versions of JavaScript interpreted by Narcissus are under development. Currently, the interpreter works reasonably well on ES3 code, with support for a few SpiderMonkey extensions.

TODO: tighten this up as it stabilizes

Configuration

TODO: write this

  • Narcissus global
  • Narcissus.options

Interpreter

TODO: write this

  • value representation
  • control flow
  • use of proxies
  • standard library