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

Compilers for Javascript?

80 views
Skip to first unread message

gro...@cyberdude.com

unread,
Sep 23, 2019, 10:57:07 AM9/23/19
to
Hi,
I was wondering if there were any COMPILERS for JS, that can make an executable? I came across this one, thought I'd tell yall about it (I've not used it myself yet):

https://nectarjs.com/#


Are there any others? How do they compare, if anyone knows?



Thanks! :)

Evertjan.

unread,
Sep 23, 2019, 11:38:24 AM9/23/19
to
gro...@cyberdude.com wrote on 23 Sep 2019 in comp.lang.javascript:

> I was wondering if there were any COMPILERS for JS, that can make an
> executable? I came across this one, thought I'd tell yall about it (I've
> not used it myself yet):

Why and where would you need one?

[Meaning, I don't think you would, but let's discuss that first.]

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Ben Bacarisse

unread,
Sep 23, 2019, 3:01:20 PM9/23/19
to
"Evertjan." <exxjxw.h...@inter.nl.net> writes:

> gro...@cyberdude.com wrote on 23 Sep 2019 in comp.lang.javascript:
>
>> I was wondering if there were any COMPILERS for JS, that can make an
>> executable? I came across this one, thought I'd tell yall about it (I've
>> not used it myself yet):
>
> Why and where would you need one?

That's an odd question, so I'm wondering if I've missed the point. Are
you talking specifically to the OP? Are you stressing the "need"? If
neither, and you just meant why would anyone want one, I would have
thought it's obvious.

> [Meaning, I don't think you would, but let's discuss that first.]

--
Ben.

Evertjan.

unread,
Sep 23, 2019, 4:20:13 PM9/23/19
to
Ben Bacarisse <ben.u...@bsb.me.uk> wrote on 23 Sep 2019 in
comp.lang.javascript:

> "Evertjan." <exxjxw.h...@inter.nl.net> writes:
>
>> gro...@cyberdude.com wrote on 23 Sep 2019 in comp.lang.javascript:
>>
>>> I was wondering if there were any COMPILERS for JS, that can make an
>>> executable? I came across this one, thought I'd tell yall about it (I've
>>> not used it myself yet):
>>
>> Why and where would you need one?
>
> That's an odd question, so I'm wondering if I've missed the point. Are
> you talking specifically to the OP? Are you stressing the "need"? If
> neither, and you just meant why would anyone want one, I would have
> thought it's obvious.

Discussion is not about skipping what is obvious to someone.

One could "want" a compiler just for the fun of it,
but if it is not usefull outside the fun,
I would call that: "no need".

Let's start with the "WHERE":

Javascript is used on many different platforms, and on its own misses the
interfaces with the outside. So Javascript in a browser uses the DOM as
input/output interface, Javascript in a specific text-editor only needs to
interface with the text at hand, Javascript on a server, say in classic ASP,
cannot interface the DOM or the user directly, Javascript in Cscript/Wscript
again has a different interface, like the line-interface and the file-
interface.

Then The "WHY":

This depends on the answer to the first question,
and then one should answer:

Is it about speed?
Is it about file-size?
Is it about obfuscation?
Etc.

So I think the question is not that odd,
and I doubt can be answered in general,
and in specific, say in a browser or in an editor,
it probably is not usefull.

>> [Meaning, I don't think you would, but let's discuss that first.]

See, this was part of the answer.

Ben Bacarisse

unread,
Sep 23, 2019, 4:29:50 PM9/23/19
to
"Evertjan." <exxjxw.h...@inter.nl.net> writes:

> Ben Bacarisse <ben.u...@bsb.me.uk> wrote on 23 Sep 2019 in
> comp.lang.javascript:
>
>> "Evertjan." <exxjxw.h...@inter.nl.net> writes:
>>
>>> gro...@cyberdude.com wrote on 23 Sep 2019 in comp.lang.javascript:
>>>
>>>> I was wondering if there were any COMPILERS for JS, that can make an
>>>> executable? I came across this one, thought I'd tell yall about it (I've
>>>> not used it myself yet):
>>>
>>> Why and where would you need one?
>>
>> That's an odd question, so I'm wondering if I've missed the point. Are
>> you talking specifically to the OP? Are you stressing the "need"? If
>> neither, and you just meant why would anyone want one, I would have
>> thought it's obvious.
>
> Discussion is not about skipping what is obvious to someone.

Sure.

--
Ben.

Jonas Thörnvall

unread,
Sep 23, 2019, 5:40:46 PM9/23/19
to
I am not sure Phonegap compile the files or if it just run the script in a browser package for the native platform, but it do create exe cutatbles for Android, Win and Mac. And they seem to have access to some part of filesystem.

"At least on Android the only one i have tested"

dr.j.r....@gmail.com

unread,
Sep 24, 2019, 5:04:45 AM9/24/19
to
On Monday, 23 September 2019 16:38:24 UTC+1, Evertjan. wrote:
> groovee wrote on 23 Sep 2019 in comp.lang.javascript:
>
> > I was wondering if there were any COMPILERS for JS, that can make an
> > executable? I came across this one, thought I'd tell yall about it (I've
> > not used it myself yet):
>
> Why and where would you need one?

Compiled code is safer than script :
(1) It cannot easily be edited,
(2) It cannot easily be read,
(3) It uses the CPU and the OS, but is safe against browser variations.


Re (2) A long time ago, I requested and received some Pascal source code to study and maybe use. The compiler could read it; but the variable names and comment were in Hungarian. :-(

--
(c) John Stockton, near London, UK. Using Google Groups. |
Mail: J.R.""""""""@physics.org - or as Reply-To, if any. |

Evertjan.

unread,
Sep 24, 2019, 5:45:05 AM9/24/19
to
=?UTF-8?Q?Jonas_Th=C3=B6rnvall?= <jonas.t...@gmail.com> wrote on 23
Sep 2019 in comp.lang.javascript:

> I am not sure

You better be!

> Phonegap compile

Is Phonegap a plural? Wat is a "Phonegap"?

> the files or if it just run the script in
> a browser package

Wat is a "package"?

A **script** is run by an engine-programme,
An **executable** runs on the microprocessor.

A script could be run as a realtime compiled executable,
I think after Pascal, and that via "intermediate code",
that was not done anymore.

> for the native platform,

What is "the native platform"??

> but it do create executatbles for Android, Win and Mac.

Is "it" a plural?

"executatbles", do you mean "executables"?

"Creating executables" from a script is called **compiling**.

How do you know "it" [What "it?] does that?

> And they

Who are "they"? The Russians?

> seem to have access to some part of filesystem.

So?

> "At least on Android the only one i have tested"

What did you test, the access to the file system? And how did you test that?

And "who" are having that, the compiling engine or the executable?

The compiling engine must have access to the file system to store the
executable for later use anyway.

Evertjan.

unread,
Sep 24, 2019, 6:12:25 AM9/24/19
to
dr.j.r....@gmail.com wrote on 24 Sep 2019 in comp.lang.javascript:

> On Monday, 23 September 2019 16:38:24 UTC+1, Evertjan. wrote:
>> groovee wrote on 23 Sep 2019 in comp.lang.javascript:
>>
>> > I was wondering if there were any COMPILERS for JS, that can make an
>> > executable? I came across this one, thought I'd tell yall about it
>> > (I've not used it myself yet):
>>
>> Why and where would you need one?
>
> Compiled code is safer than script :
> (1) It cannot easily be edited,
> (2) It cannot easily be read,
But unsafer in modern times, John,
as malicious code can more easily be hidden inside.

[It seems the definition of "safer" has shifted!

> (3) It uses the CPU and the OS, but is safe against browser
> variations.

You would still need some interface to the DOM,
when using a browser environment.

> Re (2) A long time ago, I requested and received some Pascal source code
> to study and maybe use. The compiler could read it; but the variable
> names and comment were in Hungarian. :-(

Perhaps it looked like intermediate P-code,
but in fact being Hungarian assembler-code:

"egy, ketto, három, négy, öt, hat, hét, nyolc, kilenc, tíz"

[I learned this from my father, who again got it from his parents's
Hungarian maid around 1918. They, those maids, were cheap at that time,
having escaped the famine overthere.]

<https://en.wikipedia.org/wiki/P-code_machine>

Jonas Thörnvall

unread,
Sep 24, 2019, 7:39:14 AM9/24/19
to
Fuck you are annoying EvertJan, Åhonegap is an application by Adobe. And it "probably" deliver a package, "a compiled browser" and "your script" in a package exe. "An executable browser script monolith" i guess you could call a package?. It does not however compile your code. A native platform is the architecture "the package" will run on. Yeah it do produce executables "packages" in plural form for the platform "architecture" of you choice.

No i do not think it comiple the script it is in the executable package you moron "the executabel package is a browser that run the script".

No "they" is the packages you moron.

I made an executable Android package APK from my midisequenser script, i run the package, the script opens files it has code to reach filesystem. And it did at least in my "Android emulator" it is called Bluestacks.

You never feel annoyed can't seconguess anything, but have to go all in anal retentive on texts? Isn't that annoying as hell reading newspaper articles, but maybe you just read manuals LoL



Jonas Thörnvall

unread,
Sep 24, 2019, 7:54:15 AM9/24/19
to
Den tisdag 24 september 2019 kl. 11:45:05 UTC+2 skrev Evertjan.:
Instead of being anal retentive about my semantics, how about you go anal retentive over syntax for a while, a ***bug*** in the javascript ***engine***.

At least you could come up with a solution to sidestep it, "which i can't" because i am clueless about how the code withunder the "scriptengine" do what it do.

The fault/bug goes like this when you have a thread with a scrollbar running that moves horisontal over canvas, and write out rectangles that chase it with an offset, somehow the second x argument "the length". Start to add more pixels on canvas, then you can see it do in the console.

Yes that is a bug, at very low level with the canvas drawing. Some variable pointers that fucks up a memory area.

JJ

unread,
Sep 24, 2019, 8:34:36 AM9/24/19
to
I've searched for it some years ago and couldn't find any.

That NectarJS seems to be a new project. The compiling part is almost
perfect, because it produces Windows EXE files which are not entirely valid
(miscalculated field value(s) in PE header). The JavaScript part seems to be
at an early stage, considering that the try-catch exception handling has not
yet fully functional. But the project's future is promising. Worth to wait
for.

dr.j.r....@gmail.com

unread,
Sep 24, 2019, 9:02:07 AM9/24/19
to
On Tuesday, 24 September 2019 11:12:25 UTC+1, Evertjan. wrote:
> JRS wrote on 24 Sep 2019 in comp.lang.javascript:
>
> > On Monday, 23 September 2019 16:38:24 UTC+1, Evertjan. wrote:
> >> groovee wrote on 23 Sep 2019 in comp.lang.javascript:
> >>
> >> > I was wondering if there were any COMPILERS for JS, that can make an
> >> > executable? I came across this one, thought I'd tell yall about it
> >> > (I've not used it myself yet):
> >>
> >> Why and where would you need one?
> >
> > Compiled code is safer than script :
> > (1) It cannot easily be edited,
> > (2) It cannot easily be read,
> But unsafer in modern times, John,
> as malicious code can more easily be hidden inside.

True. But script can easily be made malicious, by simply subtly
changing a calculation to give plausible but incorrect answers -
or, sometimes, by changing new Date(0) to new Date() -
or even by using a different browser.

>
> [It seems the definition of "safer" has shifted!
>
> > (3) It uses the CPU and the OS, but is safe against browser
> > variations.
>
> You would still need some interface to the DOM,
> when using a browser environment.

I presumed that compiled executable code would not be for running
(how?) in a browser.
> > Re (2) A long time ago, I requested and received some Pascal source code
> > to study and maybe use. The compiler could read it; but the variable
> > names and comment were in Hungarian. :-(
>
> Perhaps it looked like intermediate P-code,
> but in fact being Hungarian assembler-code:

No, it was perfectly normal Pascal code, but with unpronounceable
variable names and unreadable comment (except that it might have
been Algol 60 (I knew which it was at the time)). It was, however,
mathematically clever (for its time), which is why I asked for it.

Joao Rodrigues

unread,
Sep 24, 2019, 9:16:28 AM9/24/19
to
With Electron, one can build desktop apps using JS / Node.js, HTML and CSS:
https://electronjs.org/

Evertjan.

unread,
Sep 24, 2019, 4:50:52 PM9/24/19
to
<jonas.t...@gmail.com> wrote on 24 Sep 2019 in comp.lang.javascript:

> Fuck you are annoying EvertJan

Didn't you grow up yet?

JJ

unread,
Sep 25, 2019, 12:47:44 PM9/25/19
to
On Tue, 24 Sep 2019 10:16:21 -0300, Joao Rodrigues wrote:
>
> With Electron, one can build desktop apps using JS / Node.js, HTML and CSS:
> https://electronjs.org/

Electron doesn't actually compiles the JavaScript code. It merely bundles
the JavaScript code with native application which uses embedded web browser
to run the JavaScript code.

gro...@cyberdude.com

unread,
Sep 25, 2019, 3:13:24 PM9/25/19
to
On Tuesday, 24 September 2019 17:09:14 UTC+5:30, Jonas Thörnvall wrote:

> Fuck you are annoying EvertJan,

To put it Mildly! :)

Yes, it was speed, ie. performance I was Generally talking about. ...I just LIKE the "feeling" of an EXE! :)

Obfuscation wouldn't hurt either - matter of fact, I was wondering, if this "NectarJS" thing exists, why is node.js needed at all???

Michael Haufe (TNO)

unread,
Sep 25, 2019, 4:10:22 PM9/25/19
to
On Wednesday, September 25, 2019 at 2:13:24 PM UTC-5, gro...@cyberdude.com wrote:
> Yes, it was speed, ie. performance I was Generally talking about. ...I just LIKE the "feeling" of an EXE! :)
>
> Obfuscation wouldn't hurt either - matter of fact, I was wondering, if this "NectarJS" thing exists, why is node.js needed at all???


JavaScript is probably fast enough for your use case. Modern engines utilize a JIT. I've seen benchmarks from years ago where the speed was 50% the speed of native is not better. There have been significant improvements since then:

https://www.extremetech.com/computing/151403-firefox-sticks-it-to-google-with-odinmonkey-which-can-boost-javascript-performance-by-1000-or-more

https://hacks.mozilla.org/2014/11/massive-the-asm-js-benchmark/

If you utilize the asm.js <http://asmjs.org/> subset of JavaScript you can even guarantee that the garbage collector will not run during execution.

What you're looking for these days is a JavaScript -> WebAssembly compiler which is based on the original asm.js hack. There are runtimes being introduced often:

https://wasmtime.dev/

Arno Welzel

unread,
Sep 25, 2019, 7:40:30 PM9/25/19
to
Jonas Thörnvall:

> I am not sure Phonegap compile the files or if it just run the script
> in a browser package for the native platform, but it do create exe
> cutatbles for Android, Win and Mac. And they seem to have access to
> some part of filesystem.

Adobe Phonegap (<https://phonegap.com>) is a tool to build applications
for mobile devices using JavaScript and HTML and uses Cordova
(<https://cordova.apache.org/>).

The "executable" is a bundled package with a runtime and a browser
component and interfaces for JavaScript to provide access to the API of
the mobile OS.

--
Arno Welzel
https://arnowelzel.de

Arno Welzel

unread,
Sep 25, 2019, 7:46:28 PM9/25/19
to

Jonas Thörnvall

unread,
Sep 26, 2019, 1:43:19 AM9/26/19
to
So you say EvertJan was wrong the script is not compiled?

Evertjan.

unread,
Sep 26, 2019, 6:14:57 AM9/26/19
to
<jonas.t...@gmail.com> wrote on 26 Sep 2019 in comp.lang.javascript:

> So you say EvertJan was wrong the script is not compiled?

Even this sentence is gramatically insufficient without a comma,
it is impossible to reliably detect what you mean,
so one can only guess.

I am often wrong, but not often so wrong that you, Jonas could detect that.

[1]
Adobe Phonegap is a tool to build applications for mobile devices using
JavaScript and HTML and uses Cordova.

[2]
Cordova runs on Node.js

[3]
Node.jsŽ is a JavaScript runtime built on Chrome's V8 JavaScript engine

[4]
Chrome's V8 JavaScript engine runs Javascript source.

Arno Welzel

unread,
Sep 26, 2019, 11:05:45 AM9/26/19
to
Jonas Thörnvall:

Please DO NOT FULL QUOTE when you just answer with ONE SINGLE LINE!

[full quote removed]

> So you say EvertJan was wrong the script is not compiled?
Look for yourself how Cordova works - thank you.

gro...@cyberdude.com

unread,
Sep 26, 2019, 11:38:11 AM9/26/19
to
On Thursday, 26 September 2019 01:40:22 UTC+5:30, Michael Haufe (TNO) wrote:

>
> If you utilize the asm.js <http://asmjs.org/> subset of JavaScript you can even guarantee that the garbage collector will not run during execution.
>
> What you're looking for these days is a JavaScript -> WebAssembly compiler which is based on the original asm.js hack. There are runtimes being introduced often:
>
> https://wasmtime.dev/

Sorry - I have only a *hazy* idea what these are - do they give an executable I can run on the cmd line or not? For Linux??

Arno Welzel

unread,
Sep 26, 2019, 2:17:12 PM9/26/19
to
gro...@cyberdude.com:

> On Thursday, 26 September 2019 01:40:22 UTC+5:30, Michael Haufe (TNO)
> wrote:
[...]
>> https://wasmtime.dev/
>
> Sorry - I have only a *hazy* idea what these are - do they give an
> executable I can run on the cmd line or not? For Linux??

No.

Arno Welzel

unread,
Sep 26, 2019, 2:19:14 PM9/26/19
to
gro...@cyberdude.com:

> On Tuesday, 24 September 2019 17:09:14 UTC+5:30, Jonas Thörnvall
> wrote:
>
>> Fuck you are annoying EvertJan,
>
> To put it Mildly! :)
>
> Yes, it was speed, ie. performance I was Generally talking about.
> ...I just LIKE the "feeling" of an EXE! :)

What exactly is your use case of JavaScript compiled to a binary?

Michael Haufe (TNO)

unread,
Sep 26, 2019, 3:30:10 PM9/26/19
to

Michael Haufe (TNO)

unread,
Sep 26, 2019, 3:38:50 PM9/26/19
to
On Thursday, September 26, 2019 at 10:38:11 AM UTC-5, gro...@cyberdude.com wrote:
Additional overview:

<https://hacks.mozilla.org/2017/02/a-cartoon-intro-to-webassembly/>

This is bleeding edge, but there does exist a TypeScript to wasm compiler. I haven't used it yet, but it looks promising and might be my first choice when I engage on a project that needs it (Game engine, compiler, etc.):

<https://docs.assemblyscript.org/>

gro...@cyberdude.com

unread,
Sep 27, 2019, 2:59:13 AM9/27/19
to
On Thursday, 26 September 2019 23:49:14 UTC+5:30, Arno Welzel wrote:

> > Yes, it was speed, ie. performance I was Generally talking about.
> > ...I just LIKE the "feeling" of an EXE! :)
>
> What exactly is your use case of JavaScript compiled to a binary?
>
>
> --
> Arno Welzel
> https://arnowelzel.de

Well, if you must know, I was kind of planning on writing a particular program *in asm*, like in the old days, implementing the same program in JS, and seeing whether I could Beat the compiler! :) Donno whether I can, (indeed I have no idea what kind of code NectarJS *produces*), but that was what I was gonna *try*! :) So now you know :)

Also, sizecoding was somewhat on the agenda too.... :)
Message has been deleted
0 new messages