My favorites | Sign in
js8
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Project Information
Members
Featured
Downloads

Home page on blogspot: http://nexusonline2003.blogspot.com/

JS8

JS8 is a Javascript shell based on Google V8 engine. It provides a shell to run Javascript and libraries to interface with the host operating system. It is currently being developed on Windows, however, JS8 has been using portable code and libraries. The aim is to support Windows and Linux at the least. The prerequisite libraries are: Google V8 (included in binary form), users can download and compile V8 seperately and install the "v8.dll" library, JS8 will be able to use it immediately. Another important library: Boost is a major requirement for portable filesystem operations and parser construction. Please install the recommended binary Boost distribution if you have trouble compiling on your own. Curl library (included in binary form) may also required.

What Exactly Is JS8?

Javascript is rarely used outside of a browser applicaton, however Javascript is a very simple and very powerful language (Lisp-1 with a C syntax). It's security model was designed to restrict access to nothing but the host application (browser). Therefore, you cannot write in Javascript to open a file, let alone deleting one: file system access must be done via the browser. As a scripting language, Javascript is very simple, supports modern features and very powerful. Thanks to Google V8 engine, embedding Javascript into YOUR host application is easier. This is where JS8 comes in: provide interface libraries to the filesystem, networking and the outside world (like a browser DOM). You may be able to connect Javascript to your C/C++ host applications, but then you will have to write your own library to perform something like: travel a directory and retrieve all the filenames, timestamp and many others low-level non-portable O/S tasks.

Design

Unlike Python, Perl or other languages, JS8 libraries are not designed in a traditional way: it is being model after POSIX tools, or rather GNU tools. JS8 libraries not only communicate via text, but also via list/array within the Javascript space to reduce unnecessary parsing. In particulars, JS8 libraries commands are model after GNU tools such as ls(), grep(), sort(), mv(), println(), dirname(), which() and so on.

Benefits

  1. performance - the V8 engine is basically the most efficient compiler everyone can use;
  2. simplicity - one simple command trigger a powerfull and complex C++ functions, for example the internal application sync() will synchronize two directories in both directions (not related to fsync());
  3. code reuse - for example sync() call JS8 libraries such as cp(), mv(), rm(), cmp(), dircmp() fuctions which can be used by YOUR applications;
  4. job control - for example your application resize a JPEG image, you can expose such resize() function to JS8, then you can write Javascript to loop through an entire directory of images and call the resize() function on each of them;
  5. Now that JS8 is model after POSIX environment, it will be possible to support at least Windows and Linux, or may be other platforms where Google V8 can be compiled, the libraries interface will stay the same;
  6. You no longer need to deal with different libraries like Python, Perl, Ruby, Lua where each has their own HUGE sets of libraries with different namespaces to remember, that is exactly why JS8 is model after POSIX tools or to some degree the BusyBox distribution;
  7. Although JS8 is model after POSIX tools, it is not neccessary to be 100% compatible with them, the first reason is the use of list/array instead of just text. Afterall, Javascript environment is different from Bourne shell and therefore not every options of a tool is needed;
  8. Javascript syntax is a subset of C, it is simple and popular among web developers and the barrier to learn the language is the lowest of all. Besides, advanced features of Javascript is rarely needed in simple scripting anyway;

N.B The name jsa clash with someone else unrelated project, Javascript for Application is now renamed to JS8. Sorry for the lack of documentations at this point.

Powered by Google Project Hosting