473,395 Members | 1,348 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Standalone Javascript interpreter for Linux?

I'm looking for a standalone Javascript interpreter like the ones of
Perl and Python. Does such a thing exist for Linux?

Thanks in advance.

-Erik

--
hackerkey://v4sw5hw2ln3pr5ck0ma2u7LwXm4l7Gi2e2t4b7Ken4/7a16s0r1p-5.62/-6.56g5OR
Oct 31 '08 #1
5 21410
Ah FFS. For *once* I'm not looking at the headers, and he's
cross-posting with f'up. Anyway, for the archives, here's what I just
unintentionally posted to comp.os.linux.misc...
On 2008-10-31 01:59, Erik Hahn wrote:
I'm looking for a standalone Javascript interpreter like the ones of
Perl and Python. Does such a thing exist for Linux?
Yes. There's Rhino (Java implementation of Mozilla's JavaScript engine),
SpiderMonkey (C implementation of the same, but not really usable as a
scripting environment), and a few other packages that look promising,
but that I haven't tested yet. I'd recommend starting with Rhino.

Mozilla Rhino
http://www.mozilla.org/rhino/

Mozilla SpiderMonkey
http://www.mozilla.org/js/spidermonkey/

JSDB
http://www.jsdb.org/

wxJavaScript
http://www.wxjavascript.net/
- Conrad
Oct 31 '08 #2
On Oct 31, 9:27 am, Conrad Lender <crlen...@yahoo.comwrote:
On 2008-10-31 01:59, Erik Hahn wrote:
I'm looking for a standalone Javascript interpreter like the ones of
Perl and Python. Does such a thing exist for Linux?
<snip>
SpiderMonkey (C implementation of the same, but not really usable as a
scripting environment)>
<snip>
Mozilla SpiderMonkeyhttp://www.mozilla.org/js/spidermonkey/
The demo js interpreter that comes with SpiderMonkey is actually
really easy to extend. I managed to add file IO capabilities
(fopen,fread,fgets,fputs,fseek,fclose) in around 250 lines of code. I
believe this was the origin of JSDB. JSDB looks really nice especially
the unified Streams API that lets you open files on disk as well as
URI.

I myself have been thinking of implementing a simple binary module/
package system for SipderMonkeys js interpreter (instead of directly
modifying the interpreter) so that you can simply "require" a module
and have it loaded. Lots of languages have gone this path,
implementing a very simple interpreter which is turing complete but
can't do much then load features from modules/packages.

Oct 31 '08 #3
On 2008-10-31 02:53, slebetman wrote:
>SpiderMonkey (C implementation of the same, but not really usable as a
scripting environment)>
<snip>
Mozilla SpiderMonkeyhttp://www.mozilla.org/js/spidermonkey/

The demo js interpreter that comes with SpiderMonkey is actually
really easy to extend. I managed to add file IO capabilities
(fopen,fread,fgets,fputs,fseek,fclose) in around 250 lines of code.
Sometimes I really regret that I haven't done more C programming. I
couldn't even build the stupid thing with support for the old File
object :-/
When I was experimenting with the SpiderMonkey jsshell, all I had was
the readline() function. Unfortunately this function isn't nearly as
useful as I had hoped - it doesn't recognize the EOF, and it seems to
automagically convert all input to Unicode. I had to resort to writing a
Perl wrapper that passed the number of lines to be read to the js file.
I myself have been thinking of implementing a simple binary module/
package system for SipderMonkeys js interpreter (instead of directly
modifying the interpreter)
I think the interpreter is meant to be embedded anyway, not modified
directly. I think this is what JSDB is doing. If you go ahead with this
and build a usable all-purpose interpreter, count me in as a beta tester.
so that you can simply "require" a module and have it loaded.
There's a load() function in jsshell. It works, but it's very basic and
doesn't do any fancy stuff like path management.
Lots of languages have gone this path,
implementing a very simple interpreter which is turing complete but
can't do much then load features from modules/packages.
A full scripting environment for JS on the command line would be very
exciting. In time, we could even have module repositories like CPAN =)
- Conrad
Oct 31 '08 #4
On Oct 30, 7:30*pm, Conrad Lender <crlen...@yahoo.comwrote:
On 2008-10-31 02:53, slebetman wrote:
SpiderMonkey (C implementation of the same, but not really usable as a
scripting environment)>
<snip>
Mozilla SpiderMonkeyhttp://www.mozilla.org/js/spidermonkey/
The demo js interpreter that comes with SpiderMonkey is actually
really easy to extend. I managed to add file IO capabilities
(fopen,fread,fgets,fputs,fseek,fclose) in around 250 lines of code.

Sometimes I really regret that I haven't done more C programming. I
couldn't even build the stupid thing with support for the old File
object :-/
When I was experimenting with the SpiderMonkey jsshell, all I had was
the readline() function. Unfortunately this function isn't nearly as
useful as I had hoped - it doesn't recognize the EOF, and it seems to
automagically convert all input to Unicode. I had to resort to writing a
Perl wrapper that passed the number of lines to be read to the js file.
I myself have been thinking of implementing a simple binary module/
package system for SipderMonkeys js interpreter (instead of directly
modifying the interpreter)

I think the interpreter is meant to be embedded anyway, not modified
directly. I think this is what JSDB is doing. If you go ahead with this
and build a usable all-purpose interpreter, count me in as a beta tester.
so that you can simply "require" a module and have it loaded.

There's a load() function in jsshell. It works, but it's very basic and
doesn't do any fancy stuff like path management.
Lots of languages have gone this path,
implementing a very simple interpreter which is turing complete but
can't do much then load features from modules/packages.

A full scripting environment for JS on the command line would be very
exciting. In time, we could even have module repositories like CPAN =)
I'm working on this same idea for Rhino. (Actually my project could
incorporate C implementations as well. I started working on a
Spidermonkey version but moved to Rhino.)

The foundation of what I'm building is a package management client
called xpkg. The intention is this will work like CPAN or apt-get. The
xpkg client I'm building is written in Perl. The language here doesn't
really matter as it is just a command line tool. Clients in other
languages could be written too.

Then the entire JavaScript world of xjs packages can be installed and
managed. The core package does little more than just add "require" and
"load" as host objects. I have packages for a web server, database
access etc. Everything is alpha software and far from feature
complete.

You might be interested in the following.

http://peter.michaux.ca/article/8579

http://groups.google.com/group/xjs-t...75887cd0970b68

Peter
Oct 31 '08 #5
2008-10-31, 01:59(+01), Erik Hahn:
I'm looking for a standalone Javascript interpreter like the ones of
Perl and Python. Does such a thing exist for Linux?
[...]

$ apt-cache search standalone javascript interpreter
kjscmd - A script interpreter using the KDE JavaScript library
spidermonkey-bin - standalone JavaScript/ECMAScript (ECMA-262) interpreter

--
Stéphane
Oct 31 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: None | last post by:
JavaScript interpreter/evaluator class? Does anyone know of a way to parse JavaScript expressions in Java? I am working on a report writer and one of the requirements is a formula facility. ...
1
by: atodd_109 | last post by:
I currently have a page that is running from a windows based server with frontpage extensions installed. My mouseover script works great. I am now in the process of developing another page that...
2
by: bill | last post by:
Is there a nice interactive JavaScript interpreter, analogous to Python's or Perl's (perldb)? I'm looking for something for Linux, and that supports readline. I want to be able to try out small...
3
by: Bob | last post by:
Hi! I need a standalone javascript engine so that I can run the javascript statements directly from the command line(just like the interpreted languages) without using any internet environment....
8
by: me | last post by:
The subject line says it all really. Any figures for the size of a typical JS interpreter?
3
by: giangiammy | last post by:
as from the subject, anyone has comments about a Javascript IDE for visual programming in Linux environment? thanks giammy
3
by: Marco A. Cruz Quevedo | last post by:
Hi! I am a javascript newbie. I want to make a capture window in *standalone* (in a *.js file) javascript, much in the same way as the VBscript inputbox() function. I can make it inside a *.html...
1
by: Gvdc | last post by:
GromJS server-side JavaScript interpreter ------------------------------------------------------------------------ GromJS is server-side JavaScript implementation of Mozilla SpiderMonkey...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.