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.