Live data from Hacker News

Ask HN: C/C++ plugin make JavaScipt end up with C/C++ binary?

news.ycombinator.com

1–6 of 6 posts

Re: Ask HN: C/C++ plugin make JavaScipt end up with C/C++ binary?

#3
There's no such thing as a "C/C++ binary." C and C++ both get compiled into machine code, and we call the result a binary, or executable. Executables, or binaries, contain low-level machine instructions, regardless of the original source language.

Javascript does not get compiled to an executable. It gets interpreted from source, or (more likely) just-in-time compiled into bytecode, which then gets executed by a runtime -- the Javascript interpreter in a browser, or Node.js on a server.

Python, Ruby, PHP, and numerous other languages are called interpreted because they require an interpreter and runtime libraries to execute. C, C++, Pascal, Go, Rust get compiled to executable binaries.

I can't think of any reason Javascript can't get compiled to a binary, or translated to C or C++, but that's not how Javascript generally gets executed and deployed.

Re: Ask HN: C/C++ plugin make JavaScipt end up with C/C++ binary?

#5
There are virtual machine plug-ins that add interpreted C/C++ to environments (browser, c/c++ interpreter for command line shell, gnumeric/excell, ....).

There are tools which can be run in same developer environment that javascript is run in which can be used to translate javascript into compilable C/C++ code (perhaps also adding/including the step of compilation of c/c++ code into runable binary)

Typically, a vm which directly interprets/runs javascript is used in place of the transpile steps (change javascript into c/c++ source code / compile source / run source)