My favorites | Sign in
Project Logo
             
Show all Featured wiki pages:
Building ToDo
Blogs:
Feeds:
People details
Project owners:
  jonhohle

jscsh is an interactive JavaScript shell similar to Ruby's irb or the interactive Python shell. It uses Apple's JavaScriptCore for its internal JS engine and provides several built-in function with similar functionality to SpiderMonkey's js shell.

jscsh is very early in development, but can run and load any JavaScripts which use the built-in JavaScript classes (no DOM or XMLHttpRequest support). It's already pretty fast. It also has an interface to system(3) and a wrapper around popen(3).

jscsh also includes several classes inspired by classes from the Ruby standard library. Dir, File, and IO all have at least partial implementations.

jscsh is still young and immature, but it allows for high performance JavaScript without the need for a web browser.

Standard Global Objects

In addition to JavaScript's built-in standard global objects, jscsh also provides a additional StandardGlobalObjects which are written in a combination of C and JavaScript.

Screenshots

Interactive Console

js> print('Hello World!')
Hello World!

js> Dir.foreach('/Library/Ruby', function(item) { print(item) }) 
.
..
Gems
Site

js> load('perfect.js')

A number is 'perfect' if it is equal to the sum of its
divisors (excluding itself).

The perfect numbers up to 500 are:
6 = 1 + 2 + 3
28 = 1 + 2 + 4 + 7 + 14
496 = 1 + 2 + 4 + 8 + 16 + 31 + 62 + 124 + 248
That's all.

js> perfect(10000)
The perfect numbers up to 10000 are:
6 = 1 + 2 + 3
28 = 1 + 2 + 4 + 7 + 14
496 = 1 + 2 + 4 + 8 + 16 + 31 + 62 + 124 + 248
8128 = 1 + 2 + 4 + 8 + 16 + 32 + 64 + 127 + 254 + 508 + 1016 + 2032 + 4064
That's all.

js> 

Interpreter

Running perfect.js from the SpiderMonkey sources:

$> ijs perfect.js 

A number is 'perfect' if it is equal to the sum of its
divisors (excluding itself).

The perfect numbers up to 500 are:
6 = 1 + 2 + 3
28 = 1 + 2 + 4 + 7 + 14
496 = 1 + 2 + 4 + 8 + 16 + 31 + 62 + 124 + 248
That's all.
$>








Hosted by Google Code