Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Looking for a JavaScript interpreter

92 views
Skip to first unread message

Anton Shepelev

unread,
Mar 17, 2021, 8:42:07 AM3/17/21
to
Hello, all

What interpreters can you suggest for learing JavaScript? I
can't seem to find a light and simple stand-alone
interpreter, not developed by a mega-corporation and
distributed as a small executable, so that I can develop
JavaScript programs in my favourite general-purpose IDE or
text editor, without reliance upon a browser or huge
specialised IDE. I need something like the Tiny C Compiler
for the C language -- a standalone minimalistic tool.

Such scripting languages as Lua and Python provide official
open-source interpreters with ready binaries for all major
OSes. Does JavaScript has anything like that?

I looking for a Windows interpreter, preferably supporting
Windows XP.

--
() ascii ribbon campaign - against html e-mail
/\ http://preview.tinyurl.com/qcy6mjc [archived]

Michael Haufe (TNO)

unread,
Mar 17, 2021, 9:33:17 AM3/17/21
to
On Wednesday, March 17, 2021 at 7:42:07 AM UTC-5, Anton Shepelev wrote:
> Hello, all
>
> What interpreters can you suggest for learing JavaScript? I
> can't seem to find a light and simple stand-alone
> interpreter, not developed by a mega-corporation and
> distributed as a small executable, so that I can develop
> JavaScript programs in my favourite general-purpose IDE or
> text editor, without reliance upon a browser or huge
> specialised IDE. I need something like the Tiny C Compiler
> for the C language -- a standalone minimalistic tool.
>
> Such scripting languages as Lua and Python provide official
> open-source interpreters with ready binaries for all major
> OSes. Does JavaScript has anything like that?
>
> I looking for a Windows interpreter, preferably supporting
> Windows XP.

The fact that you are on Windows XP makes things challenging. The Sublime editor might run on XP?

<https://www.sublimetext.com/>

Babel is the closest thing in spirit to what you are looking for as a standalone compiler which is well maintained:

<https://babeljs.io/>
<https://babeljs.io/docs/en/babel-cli>

To use that though assumes you know how to set up a JavaScript project.

Note that in WIndows XP you should have the Windows Scripting Host already installed. Just create a *.js file and double click it, or run it from the command line.

<https://www.robvanderwoude.com/wshstart.php>

The Windows Scripting Host is not maintained by Microsoft anymore and only supports a legacy version of the language.

You could try to install node.js but I don't know if that would run on your machine

<https://nodejs.org/en/>
<https://developer.mozilla.org/en-US/docs/Learn/Server-side/Express_Nodejs/Introduction>

That is a heavy weight JavaScript based server.

For education purposes I think it's best for you to stay in the browser. There are a number of editors and interpreters available that are good enough to get things done such as:

CodePen: <http://pen.new/>
Babel: <https://babeljs.io/repl>
TypeScript: <https://www.typescriptlang.org/play>
and others.

For basic tutorials:

<https://developer.mozilla.org/en-US/docs/Web/javascript>
<https://eloquentjavascript.net/>

There are others that could be suggested.

Anton Shepelev

unread,
Mar 17, 2021, 11:24:49 AM3/17/21
to
Michael Haufe:

> The fact that you are on Windows XP makes things
> challenging.

I have access to a newer Windows, too.

> The Sublime editor might run on XP?

Surprising though it is, but it does. Unfortuntely, it is a
commerical program, but I can live with it.

> Babel is the closest thing in spirit to what you are
> looking for as a standalone compiler which is well
> maintained:

Do I understand it correctly that Sublime itself is just a
text editor and needs Babel and the Babel plugin to
interpret and compile JavaScript?

> Note that in WIndows XP you should have the Windows
> Scripting Host already installed. Just create a *.js file
> and double click it, or run it from the command line.

It works indeed, but does not see even the `console' module.

> For education purposes I think it's best for you to stay
> in the browser.

Most of the time, yes, but I don't know how to try modules
in the browser.

> https://eloquentjavascript.net/

This is a bood one, I am already reading it.

Jon Ribbens

unread,
Mar 17, 2021, 11:39:58 AM3/17/21
to
On 2021-03-17, Anton Shepelev <anton.txt@g{oogle}mail.com> wrote:
> What interpreters can you suggest for learing JavaScript? I
> can't seem to find a light and simple stand-alone
> interpreter, not developed by a mega-corporation and
> distributed as a small executable, so that I can develop
> JavaScript programs in my favourite general-purpose IDE or
> text editor, without reliance upon a browser or huge
> specialised IDE. I need something like the Tiny C Compiler
> for the C language -- a standalone minimalistic tool.

https://nodejs.org/

> I looking for a Windows interpreter, preferably supporting
> Windows XP.

Windows XP was end-of-life seven years ago.
It is not suitable to be used for any purpose.

JJ

unread,
Mar 17, 2021, 2:43:11 PM3/17/21
to
On Wed, 17 Mar 2021 15:42:00 +0300, Anton Shepelev wrote:
> Hello, all
>
> What interpreters can you suggest for learing JavaScript? I
> can't seem to find a light and simple stand-alone
> interpreter, not developed by a mega-corporation and
> distributed as a small executable, so that I can develop
> JavaScript programs in my favourite general-purpose IDE or
> text editor, without reliance upon a browser or huge
> specialised IDE. I need something like the Tiny C Compiler
> for the C language -- a standalone minimalistic tool.
>
> Such scripting languages as Lua and Python provide official
> open-source interpreters with ready binaries for all major
> OSes. Does JavaScript has anything like that?
>
> I looking for a Windows interpreter, preferably supporting
> Windows XP.

There are several non commercial JavaScript interpreters, but almost all of
them don't cover most of the "modern" version of JavaScript.

For Windows XP, Node.js is the best one out there. But version 5.5.0 is the
last Node.js version which can still (properly) run in Windows XP.

https://nodejs.org/dist/v5.5.0/

v14 is latest, so v5.5.0 is pretty old. But it has enough coverage of modern
JavaScript features. Some not-yet-available modern features *may* be
implemented with polyfills.

Or you can use the older version of Chromium, if GUI is important, or as an
alternative. Both Node.js and Chromium use the same JavaScript engine.

https://www.reddit.com/r/Chromium/comments/4a7hva/where_can_i_get_chromium_not_chrome_for_windows_xp/

Michael Haufe (TNO)

unread,
Mar 17, 2021, 2:50:15 PM3/17/21
to
On Wednesday, March 17, 2021 at 10:24:49 AM UTC-5, Anton Shepelev wrote:
> Michael Haufe:
> > The fact that you are on Windows XP makes things
> > challenging.
> I have access to a newer Windows, too.

Then the #1 suggestion is VS Code:

<https://code.visualstudio.com/>

> > The Sublime editor might run on XP?
> Surprising though it is, but it does. Unfortuntely, it is a
> commerical program, but I can live with it.
> > Babel is the closest thing in spirit to what you are
> > looking for as a standalone compiler which is well
> > maintained:
> Do I understand it correctly that Sublime itself is just a
> text editor and needs Babel and the Babel plugin to
> interpret and compile JavaScript?

I haven't used Sublime in a very long time. I assume Sublime still calls itself a text-editor, in which case yes: it would need plugins.

<https://www.c-sharpcorner.com/UploadFile/370e35/how-to-run-or-debug-javascript-in-sublime-text/>

Modern development is a different setup, but may be sufficient for your tutorial needs.

> > Note that in WIndows XP you should have the Windows
> > Scripting Host already installed. Just create a *.js file
> > and double click it, or run it from the command line.
> It works indeed, but does not see even the `console' module.

"console" is not part of JavaScript, it's part of the environment that the language is embedded in, similar to Lua in some regards if you're familiar with that.

For WSH the command is:

```jscript
WScript.Echo("Hello")
```

I highly suggest you don't use WSH if you have access to a newer system.

> > For education purposes I think it's best for you to stay
> > in the browser.
> Most of the time, yes, but I don't know how to try modules
> in the browser.

If you use codepen it's pretty straightforward:

<https://blog.codepen.io/documentation/es-modules-on-codepen/>

Thomas 'PointedEars' Lahn

unread,
Mar 18, 2021, 12:47:38 AM3/18/21
to
Anton Shepelev wrote:

> What interpreters can you suggest for learing JavaScript?

First I would strongly recommend that you familiarize yourself with the
subject matter. You have several misconceptions there to clear before you
can begin developing (ECMAScript-based) software successfully:

You will NOT be learning one programming language named ”JavaScript”, but
basically several programming languages, some of which have “JavaScript” in
their name, that are very similar because they are based on, or are
implementations of, the same language standard, ECMAScript.

In which programming language your program is considered to have been
written will mostly be determined *at runtime* and depends on the runtime
environment and the implementation that it supports.

Therefore, you will have to learn to write code in a way that is most
compatible without sacrificing too much efficiency. Since there are many
different editions of ECMAScript, and several implementations whose many
versions implement them partially or not at all, the standard leaves some
wiggle room (implementation-dependent behavior), and not all language
features can be detected, doing this robustly *and* efficiently is *hard*,
and requires a lot of experience. Expect that process to take several
*years*, and you will have to keep up as changes are introduced into the
standard every year.

While writing the code, one uses code checkers like ESLint, which can be
integrated into an IDE, to avoid major pitfalls.

Second, there is no interpreter as such. In all relevant cases, programs
written in ECMAScript-based programming languages are JIT-*compiled*.
Scripting engines like Mozilla SpiderMonkey (used to) compile them to
bytecode which is then interpreted; scripting engines like Google V8 compile
them to machine code which is executed directly.

> I can't seem to find a light and simple stand-alone
> interpreter, not developed by a mega-corporation and
> distributed as a small executable,

That probably has to do with the fact that you are searching for a
*standalone* *interpreter*, which for the reasons mentioned above does not
exist. The only interpreter I know would have to be one that interprets
bytecode, and it is usually contained in the code of the virtual machine of
the scripting engine.

> so that I can develop JavaScript programs in my favourite general-purpose
> IDE or text editor, without reliance upon a browser or huge specialised
> IDE. I need something like the Tiny C Compiler for the C language -- a
> standalone minimalistic tool.

The main difference between ECMAScript-based programming languages and
languages like C is that the former are *scripting* languages: They are
general-purpose programming languages, but standalone they are useless:
Always there has to be a *runtime environment* that has to provide an API
such that its features can be accessed using the languages.

See also the ECMAScript Support Matrix referred by my signature.

> Such scripting languages as Lua and Python provide official
> open-source interpreters

Actually, Python source code is JIT-compiled to bytecode (.pyc files), and
then *the bytecode* is interpreted by a VM, too. In many cases (for another
example: Perl) this is how scripting languages actually work.

> with ready binaries for all major OSes. Does JavaScript has anything like
> that?

There are some implementations with “JavaScript” in their name whose
scripting engine is provided as a binary. One of them is Google V8
JavaScript.

> I looking for a Windows interpreter,

No problem, although you may have to compile it first.

> preferably supporting Windows XP.

A very bad idea.

--
PointedEars
FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.

Jean-Francois Moine

unread,
Mar 18, 2021, 4:36:54 AM3/18/21
to
On Wed, 17 Mar 2021 15:42:00 +0300
Anton Shepelev <anton.txt@g{oogle}mail.com> wrote:

> I can't seem to find a light and simple stand-alone
> interpreter

The best interpreter is QuickJS:

https://bellard.org/quickjs/
or
https://github.com/bellard/quickjs

You can find M$-windows binaries in:

https://github.com/mengmo/QuickJS-Windows-Build/releases

Also, there are a lot of small interpreters as duktape

https://duktape.org/

but I don't know which ones can be compiled for M$-windows.

--
Jean-Francois Moine <moi...@free.fr>

Thomas 'PointedEars' Lahn

unread,
Mar 18, 2021, 7:08:03 AM3/18/21
to
Jean-Francois Moine wrote:

> On Wed, 17 Mar 2021 15:42:00 +0300
> Anton Shepelev <anton.txt@g{oogle}mail.com> wrote:
>> I can't seem to find a light and simple stand-alone
>> interpreter
>
> The best interpreter is QuickJS:
>
> https://bellard.org/quickjs/
> or
> https://github.com/bellard/quickjs

Which criteria does it meet, or standard for "interpreters" (AISB, there is
no such thing for *ECMAScript-based* *source* code) does it exceed, that
make you think that it is “the best”?

Jean-Francois Moine

unread,
Mar 18, 2021, 10:29:06 AM3/18/21
to
On Thu, 18 Mar 2021 12:07:56 +0100
Thomas 'PointedEars' Lahn <Point...@web.de> wrote:

> > The best interpreter is QuickJS:
> >
> > https://bellard.org/quickjs/
> > or
> > https://github.com/bellard/quickjs
>
> Which criteria does it meet, or standard for "interpreters" (AISB, there is
> no such thing for *ECMAScript-based* *source* code) does it exceed, that
> make you think that it is “the best”?

For me, the 'best' is the one I can compile on my machine (ARM board),
that starts quickly (see below) and offers enough system primitives
for developing simple tools.

About speed, let's compare quickjs (qjs) and nodejs (node):

$ touch /tmp/toto.js
$ time qjs /tmp/toto.js
0m00.00s real 0m00.00s user 0m00.00s system
$ time node /tmp/toto.js
0m02.56s real 0m00.91s user 0m00.24s system

--
Jean-Francois Moine <moi...@free.fr>

Anton Shepelev

unread,
Mar 18, 2021, 11:56:18 AM3/18/21
to
Jean-Francois Moine:

> For me, the 'best' is the one I can compile on my machine
> (ARM board), that starts quickly (see below) and offers
> enough system primitives for developing simple tools.
>
> About speed, let's compare quickjs (qjs) and nodejs
> (node):

Thanks. By the way, QuickJS is by the original author of
TCC -- Tiny C compiler.

Anton Shepelev

unread,
Mar 18, 2021, 12:40:37 PM3/18/21
to
I thank everybody for your recommendations. NodeJS seems the
best choice for now.

dcwh...@gmail.com

unread,
Jul 27, 2021, 8:51:50 PM7/27/21
to
Anton,

I know this was a query of yours from months ago. But if you decide to go with the legacy JScript interpreter that Windows/WScript offers, a very useful IDE/Editor is VBSEdit. I've used it for years, primarily for VBScript.

https://www.vbsedit.com/

Michael Haufe (TNO)

unread,
Jul 28, 2021, 11:26:33 AM7/28/21
to
On Tuesday, July 27, 2021 at 7:51:50 PM UTC-5, dcwh...@gmail.com wrote:

> Anton,
>
> I know this was a query of yours from months ago. But if you decide to go with the legacy JScript interpreter that Windows/WScript offers, a very useful IDE/Editor is VBSEdit. I've used it for years, primarily for VBScript.
>
> https://www.vbsedit.com/

JSedit is more appropriate in that scenario and it's made by the same company

Do a web search for "Adersoft JSEdit" and you might find a usable version.

I don't know if it's maintained actively anymore but an evaluation version can be obtained from the Internet Archive:

https://web.archive.org/web/20070206013511/http://www.vbsedit.com:80/jsedit30.exe

Note that VSCode recognizes JScript and will provide autocompletion for a number of scripting host objects such as WScript.
Other interfaces that VSCode provides out of the box for WSH can be seen here:

<https://github.com/microsoft/TypeScript/blob/main/lib/lib.scripthost.d.ts>

VSCode won't provide autocompletion for arbitrary dll's though. JSEdit/VBSEdit will. The evaluation version of both are nearly unusable though.
0 new messages