Narcissus JavaScript Engine

Javascript code
Sep
20

Narcissus is an Open Source JavaScript engine written in JavaScript and developed by the same engineer who wrote the SpiderMonkey engine.

The Narcissus JavaScript engine is what is known as a metacircular interpreter because of the engine being written in JavaScript itself. It's not obvious what the purpose of it is - if you've got an engine written in JavaScript surely it's just a framework? The engine is about 1000 lines of JavaScript using extensions only in SpiderMonkey and I can't help but think that'd it be better and quicker to just write your code normally for SpiderMonkey and not bother with Narcissus. That is the point though, Narcissus isn't necessarily for production code but for experimentation.

Narcissus came about as a way of demonstrating rules for new functions by programming language researchers instead of being forced to use a formal grammar notation. Instead this is implemented in Narcissus so it's possible to see how the code will behave without having to deal with a massive code-base. Zaphod then becomes useful for distributing and testing your Narcissus targeted code in a browser.

In order to get Mozilla Firefox 4 using Narcissus on specific pages you can now use Zaphod to switch your browser's JavaScript engine.

<meta http-equiv=”Content-Script-Type” content=”application/narcissus” />

One thing to note is that at present if you use Zaphod to disable SpiderMonkey as well it will mean that sites such as Gmail will no longer function. This is because Gmail uses functions which are not readily available in Narcissus.

your comments - Post a comment

blog comments powered by Disqus