I know that google's v8 compiles javascript into native machine (binary if I understand correctly) code.
Is there a way to take the output and turn it into a exe?
views:
1232answers:
3I don't think you can directly turn a piece of JavaScript into an executable using V8, but you can probably make an application that bundles the V8 engine with the JavaScript and runs it as a stand-alone.
You can find all information about V8 on its project page.
Also note that JavaScript can't be completely compiled as it's a dynamic language. With V8, it's JIT-compiled (like .NET, for example.) It's still possible to turn it into a stand-alone executable though (like .NET, for example.)
If you want to develop stand-alone applications that make use of HTML for rendering, you could have a look at Adobe Air as well.
Javascript cannot be compiled just once. The language has eval which is pretty widely used. (for JSON for instance) You need to carry around the JIT, and the whole runtime.
JIT here is only an optimization, not the way to get rid of the compiler/interpreter.