Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #39674 > unrolled thread

Looking for a JavaScript interpreter

Started byAnton Shepelev <anton.txt@g{oogle}mail.com>
First post2021-03-17 15:42 +0300
Last post2021-07-28 08:26 -0700
Articles 14 — 8 participants

Back to article view | Back to comp.lang.javascript


Contents

  Looking for a JavaScript interpreter Anton Shepelev <anton.txt@g{oogle}mail.com> - 2021-03-17 15:42 +0300
    Re: Looking for a JavaScript interpreter "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2021-03-17 06:33 -0700
      Re: Looking for a JavaScript interpreter Anton Shepelev <anton.txt@g{oogle}mail.com> - 2021-03-17 18:24 +0300
        Re: Looking for a JavaScript interpreter "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2021-03-17 11:50 -0700
    Re: Looking for a JavaScript interpreter Jon Ribbens <jon+usenet@unequivocal.eu> - 2021-03-17 15:39 +0000
    Re: Looking for a JavaScript interpreter JJ <jj4public@gmail.com> - 2021-03-18 01:43 +0700
    Re: Looking for a JavaScript interpreter Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2021-03-18 05:47 +0100
    Re: Looking for a JavaScript interpreter Jean-Francois Moine <moinejf@free.fr> - 2021-03-18 09:36 +0100
      Re: Looking for a JavaScript interpreter Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2021-03-18 12:07 +0100
        Re: Looking for a JavaScript interpreter Jean-Francois Moine <moinejf@free.fr> - 2021-03-18 15:28 +0100
          Re: Looking for a JavaScript interpreter Anton Shepelev <antonius@freeshell.de> - 2021-03-18 18:56 +0300
    Re: Looking for a JavaScript interpreter Anton Shepelev <anton.txt@g{oogle}mail.com> - 2021-03-18 15:57 +0300
    Re: Looking for a JavaScript interpreter "dcwh...@gmail.com" <dcwhatthe@gmail.com> - 2021-07-27 17:51 -0700
      Re: Looking for a JavaScript interpreter "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2021-07-28 08:26 -0700

#39674 — Looking for a JavaScript interpreter

FromAnton Shepelev <anton.txt@g{oogle}mail.com>
Date2021-03-17 15:42 +0300
SubjectLooking for a JavaScript interpreter
Message-ID<20210317154200.2f685719d07aa0270fea6a3c@g{oogle}mail.com>
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]

[toc] | [next] | [standalone]


#39677

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2021-03-17 06:33 -0700
Message-ID<035c21af-c813-414b-8189-25a4f630b704n@googlegroups.com>
In reply to#39674
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.

[toc] | [prev] | [next] | [standalone]


#39679

FromAnton Shepelev <anton.txt@g{oogle}mail.com>
Date2021-03-17 18:24 +0300
Message-ID<20210317182442.49086d812284518aad179927@g{oogle}mail.com>
In reply to#39677
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.

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

[toc] | [prev] | [next] | [standalone]


#39682

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2021-03-17 11:50 -0700
Message-ID<fa7281ff-73d0-419d-a82b-b998096985a9n@googlegroups.com>
In reply to#39679
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/>

[toc] | [prev] | [next] | [standalone]


#39680

FromJon Ribbens <jon+usenet@unequivocal.eu>
Date2021-03-17 15:39 +0000
Message-ID<slrns548m7.4lq.jon+usenet@raven.unequivocal.eu>
In reply to#39674
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.

[toc] | [prev] | [next] | [standalone]


#39681

FromJJ <jj4public@gmail.com>
Date2021-03-18 01:43 +0700
Message-ID<13pxbtgndf155.1lyrwjdusfjbz$.dlg@40tude.net>
In reply to#39674
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/

[toc] | [prev] | [next] | [standalone]


#39686

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2021-03-18 05:47 +0100
Message-ID<1930786.oMNUckLgyt@PointedEars.de>
In reply to#39674
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.

[toc] | [prev] | [next] | [standalone]


#39687

FromJean-Francois Moine <moinejf@free.fr>
Date2021-03-18 09:36 +0100
Message-ID<20210318093612.4c64c89bc14a9fa55bf45940@free.fr>
In reply to#39674
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 <moinejf@free.fr>

[toc] | [prev] | [next] | [standalone]


#39688

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2021-03-18 12:07 +0100
Message-ID<2578477.mvXUDI8C0e@PointedEars.de>
In reply to#39687
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”?
 
-- 
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.

[toc] | [prev] | [next] | [standalone]


#39691

FromJean-Francois Moine <moinejf@free.fr>
Date2021-03-18 15:28 +0100
Message-ID<20210318152822.bc148c4a2da8280ae8f3ec9a@free.fr>
In reply to#39688
On Thu, 18 Mar 2021 12:07:56 +0100
Thomas 'PointedEars' Lahn <PointedEars@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 <moinejf@free.fr>

[toc] | [prev] | [next] | [standalone]


#39692

FromAnton Shepelev <antonius@freeshell.de>
Date2021-03-18 18:56 +0300
Message-ID<20210318185609.81d6625628e04aef1f014800@freeshell.de>
In reply to#39691
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.

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

[toc] | [prev] | [next] | [standalone]


#39696

FromAnton Shepelev <anton.txt@g{oogle}mail.com>
Date2021-03-18 15:57 +0300
Message-ID<20210318155710.c11683510c35cab8a58f930f@g{oogle}mail.com>
In reply to#39674
I thank everybody for your recommendations. NodeJS seems the
best choice for now.

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

[toc] | [prev] | [next] | [standalone]


#40317

From"dcwh...@gmail.com" <dcwhatthe@gmail.com>
Date2021-07-27 17:51 -0700
Message-ID<d87dfa3d-b904-4a68-aebc-3041aef643fen@googlegroups.com>
In reply to#39674
On Wednesday, March 17, 2021 at 8:42:07 AM UTC-4, 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. 
> 
> -- 
> () ascii ribbon campaign - against html e-mail 
> /\ http://preview.tinyurl.com/qcy6mjc [archived]
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/

[toc] | [prev] | [next] | [standalone]


#40318

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2021-07-28 08:26 -0700
Message-ID<807eedaa-e38a-4b6a-ac7b-5cd37a391cc4n@googlegroups.com>
In reply to#40317
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.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web