Ask HN: C/C++ plugin make JavaScipt end up with C/C++ binary?
1–6 of 6 posts
Re: Ask HN: C/C++ plugin make JavaScipt end up with C/C++ binary?
#2Re: Ask HN: C/C++ plugin make JavaScipt end up with C/C++ binary?
#3Javascript 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?
#4I don't have personal experience using this but have come across https://github.com/surma/jsxx .
Re: Ask HN: C/C++ plugin make JavaScipt end up with C/C++ binary?
#5There 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)